Add timeline markers for HTTP requests, JS evaluation, and HTML parsing.

This commit is contained in:
Josh Matthews 2016-05-04 18:42:57 -04:00
parent 36df00ae96
commit 9e8cf19e51
19 changed files with 126 additions and 30 deletions

View file

@ -31,6 +31,8 @@ use net_traits::response::HttpsState;
use net_traits::{CookieSource, IncludeSubdomains, LoadConsumer, LoadContext, LoadData};
use net_traits::{Metadata, NetworkError};
use openssl::ssl::error::{SslError, OpensslError};
use profile_traits::time::{ProfilerCategory, profile, ProfilerChan, TimerMetadata};
use profile_traits::time::{TimerMetadataReflowType, TimerMetadataFrameType};
use resource_thread::{CancellationListener, send_error, start_sending_sniffed_opt, AuthCache, AuthCacheEntry};
use std::borrow::ToOwned;
use std::boxed::FnBox;
@ -52,6 +54,7 @@ use uuid;
pub fn factory(user_agent: String,
http_state: HttpState,
devtools_chan: Option<Sender<DevtoolsControlMsg>>,
profiler_chan: ProfilerChan,
connector: Arc<Pool<Connector>>)
-> Box<FnBox(LoadData,
LoadConsumer,
@ -59,14 +62,21 @@ pub fn factory(user_agent: String,
CancellationListener) + Send> {
box move |load_data: LoadData, senders, classifier, cancel_listener| {
spawn_named(format!("http_loader for {}", load_data.url), move || {
load_for_consumer(load_data,
senders,
classifier,
connector,
http_state,
devtools_chan,
cancel_listener,
user_agent)
let metadata = TimerMetadata {
url: load_data.url.as_str().into(),
iframe: TimerMetadataFrameType::RootWindow,
incremental: TimerMetadataReflowType::FirstReflow,
};
profile(ProfilerCategory::NetHTTPRequestResponse, Some(metadata), profiler_chan, || {
load_for_consumer(load_data,
senders,
classifier,
connector,
http_state,
devtools_chan,
cancel_listener,
user_agent)
})
})
}
}