Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(652)

Unified Diff: content/browser/loader/resource_dispatcher_host_impl.cc

Issue 1569673002: [NOT FOR LANDING] Detailed loading traces Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/loader/resource_buffer.cc ('k') | content/browser/loader/resource_loader.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/loader/resource_dispatcher_host_impl.cc
diff --git a/content/browser/loader/resource_dispatcher_host_impl.cc b/content/browser/loader/resource_dispatcher_host_impl.cc
index ce9d8029d60a87f1de70d48064c9dbf8d20cc7c4..bb32acf535d7db45480bebc62e08d96a6c0bdf9c 100644
--- a/content/browser/loader/resource_dispatcher_host_impl.cc
+++ b/content/browser/loader/resource_dispatcher_host_impl.cc
@@ -986,6 +986,8 @@ void ResourceDispatcherHostImpl::DidReceiveRedirect(ResourceLoader* loader,
}
void ResourceDispatcherHostImpl::DidReceiveResponse(ResourceLoader* loader) {
+ TRACE_EVENT0("toplevel", "ResourceDispatcherHostImpl::DidReceiveResponse");
+
ResourceRequestInfoImpl* info = loader->GetRequestInfo();
net::URLRequest* request = loader->request();
if (request->was_fetched_via_proxy() &&
@@ -1022,6 +1024,7 @@ void ResourceDispatcherHostImpl::DidReceiveResponse(ResourceLoader* loader) {
}
void ResourceDispatcherHostImpl::DidFinishLoading(ResourceLoader* loader) {
+ TRACE_EVENT0("toplevel", "ResourceDispatcherHostImpl::DidFinishLoading");
ResourceRequestInfoImpl* info = loader->GetRequestInfo();
// Record final result of all resource loads.
@@ -1133,8 +1136,11 @@ void ResourceDispatcherHostImpl::DidFinishLoading(ResourceLoader* loader) {
info->GetResourceType());
}
- if (delegate_)
+ if (delegate_) {
+ TRACE_EVENT0("toplevel", "ResourceDispatcherHostDelegate::RequestComplete");
+
delegate_->RequestComplete(loader->request());
+ }
// Destroy the ResourceLoader.
RemovePendingRequest(info->GetChildID(), info->GetRequestID());
@@ -1217,6 +1223,8 @@ void ResourceDispatcherHostImpl::OnRequestResource(
int routing_id,
int request_id,
const ResourceHostMsg_Request& request_data) {
+ TRACE_EVENT0("toplevel", "ResourceDispatcherHostImpl::OnRequestResource");
+
// TODO(pkasting): Remove ScopedTracker below once crbug.com/477117 is fixed.
tracked_objects::ScopedTracker tracking_profile(
FROM_HERE_WITH_EXPLICIT_FUNCTION(
@@ -1361,6 +1369,7 @@ void ResourceDispatcherHostImpl::BeginRequest(
const ResourceHostMsg_Request& request_data,
IPC::Message* sync_result, // only valid for sync
int route_id) {
+ TRACE_EVENT0("toplevel", "ResourceDispatcherHostImpl::BeginRequest");
int process_type = filter_->process_type();
int child_id = filter_->child_id();
@@ -1434,15 +1443,18 @@ void ResourceDispatcherHostImpl::BeginRequest(
}
// Allow the observer to block/handle the request.
- if (delegate_ && !delegate_->ShouldBeginRequest(request_data.method,
- request_data.url,
- request_data.resource_type,
- resource_context)) {
- AbortRequestBeforeItStarts(filter_, sync_result, request_id);
- return;
+ {
+ TRACE_EVENT0("toplevel",
+ "ResourceDispatcherHostDelegate::ShouldBeginRequest");
+
+ if (delegate_ &&
+ !delegate_->ShouldBeginRequest(request_data.method, request_data.url,
+ request_data.resource_type,
+ resource_context)) {
+ AbortRequestBeforeItStarts(filter_, sync_result, request_id);
+ return;
+ }
}
-
- // Construct the request.
scoped_ptr<net::URLRequest> new_request = request_context->CreateRequest(
is_navigation_stream_request ? request_data.resource_body_stream_url
: request_data.url,
@@ -1478,8 +1490,11 @@ void ResourceDispatcherHostImpl::BeginRequest(
new_request->SetExtraRequestHeaders(headers);
- storage::BlobStorageContext* blob_context =
- GetBlobStorageContext(filter_->blob_storage_context());
+ storage::BlobStorageContext* blob_context;
+ {
+ TRACE_EVENT0("toplevel", "GetBlobStorageContext");
+ blob_context = GetBlobStorageContext(filter_->blob_storage_context());
+ }
// Resolve elements from request_body and prepare upload data.
if (request_data.request_body.get()) {
// |blob_context| could be null when the request is from the plugins because
@@ -1489,6 +1504,9 @@ void ResourceDispatcherHostImpl::BeginRequest(
// Attaches the BlobDataHandles to request_body not to free the blobs and
// any attached shareable files until upload completion. These data will
// be used in UploadDataStream and ServiceWorkerURLRequestJob.
+ TRACE_EVENT0("toplevel",
+ "ResourceDispatcherHostImpl::BeginRequest::"
+ "AttachRequestBodyBlobDataHandles");
AttachRequestBodyBlobDataHandles(
request_data.request_body.get(),
blob_context);
@@ -1635,6 +1653,8 @@ scoped_ptr<ResourceHandler> ResourceDispatcherHostImpl::CreateResourceHandler(
int process_type,
int child_id,
ResourceContext* resource_context) {
+ TRACE_EVENT0("toplevel", "ResourceDispatcherHostImpl::CreateResourceHandler");
+
// TODO(pkasting): Remove ScopedTracker below once crbug.com/456331 is fixed.
tracked_objects::ScopedTracker tracking_profile(
FROM_HERE_WITH_EXPLICIT_FUNCTION(
@@ -1702,6 +1722,7 @@ scoped_ptr<ResourceHandler> ResourceDispatcherHostImpl::AddStandardHandlers(
int child_id,
int route_id,
scoped_ptr<ResourceHandler> handler) {
+ TRACE_EVENT0("toplevel", "ResourceDispatcherHostImpl::AddStandardHandlers");
// PlzNavigate: do not add ResourceThrottles for main resource requests from
// the renderer. Decisions about the navigation should have been done in the
// initial request.
@@ -2059,6 +2080,8 @@ void ResourceDispatcherHostImpl::CancelRequestsForRoute(
// Cancels the request and removes it from the list.
void ResourceDispatcherHostImpl::RemovePendingRequest(int child_id,
int request_id) {
+ TRACE_EVENT0("toplevel", "ResourceDispatcherHostImpl::RemovePendingRequest");
+
LoaderMap::iterator i = pending_loaders_.find(
GlobalRequestID(child_id, request_id));
if (i == pending_loaders_.end()) {
@@ -2070,13 +2093,18 @@ void ResourceDispatcherHostImpl::RemovePendingRequest(int child_id,
void ResourceDispatcherHostImpl::RemovePendingLoader(
const LoaderMap::iterator& iter) {
+ TRACE_EVENT0("toplevel", "ResourceDispatcherHostImpl::RemovePendingLoader");
+
ResourceRequestInfoImpl* info = iter->second->GetRequestInfo();
// Remove the memory credit that we added when pushing the request onto
// the pending list.
IncrementOutstandingRequestsMemory(-1, *info);
-
- pending_loaders_.erase(iter);
+ {
+ TRACE_EVENT0("toplevel",
+ "ResourceDispatcherHostImpl::RemovePendingLoader::Erase");
+ pending_loaders_.erase(iter);
+ }
}
void ResourceDispatcherHostImpl::CancelRequest(int child_id,
@@ -2117,6 +2145,10 @@ ResourceDispatcherHostImpl::OustandingRequestsStats
ResourceDispatcherHostImpl::IncrementOutstandingRequestsMemory(
int count,
const ResourceRequestInfoImpl& info) {
+ TRACE_EVENT0(
+ "toplevel",
+ "ResourceDispatcherHostImpl::IncrementOutstandingRequestsMemory");
+
DCHECK_EQ(1, abs(count));
// Retrieve the previous value (defaulting to 0 if not found).
@@ -2153,6 +2185,9 @@ ResourceDispatcherHostImpl::IncrementOutstandingRequestsCount(
bool ResourceDispatcherHostImpl::HasSufficientResourcesForRequest(
net::URLRequest* request) {
+ TRACE_EVENT0("toplevel",
+ "ResourceDispatcherHostImpl::HasSufficientResourcesForRequest");
+
ResourceRequestInfoImpl* info = ResourceRequestInfoImpl::ForRequest(request);
OustandingRequestsStats stats = IncrementOutstandingRequestsCount(1, info);
@@ -2360,6 +2395,7 @@ int ResourceDispatcherHostImpl::CalculateApproximateMemoryCost(
void ResourceDispatcherHostImpl::BeginRequestInternal(
scoped_ptr<net::URLRequest> request,
scoped_ptr<ResourceHandler> handler) {
+ TRACE_EVENT0("toplevel", "ResourceDispatcherHostImpl::BeginRequestInternal");
DCHECK(!request->is_pending());
ResourceRequestInfoImpl* info =
ResourceRequestInfoImpl::ForRequest(request.get());
@@ -2412,6 +2448,7 @@ void ResourceDispatcherHostImpl::BeginRequestInternal(
void ResourceDispatcherHostImpl::StartLoading(
ResourceRequestInfoImpl* info,
scoped_ptr<ResourceLoader> loader) {
+ TRACE_EVENT0("toplevel", "ResourceDispatcherHostImpl::StartLoading");
// TODO(pkasting): Remove ScopedTracker below once crbug.com/456331 is fixed.
tracked_objects::ScopedTracker tracking_profile(
FROM_HERE_WITH_EXPLICIT_FUNCTION(
@@ -2642,6 +2679,9 @@ int ResourceDispatcherHostImpl::BuildLoadFlagsForRequest(
const ResourceHostMsg_Request& request_data,
int child_id,
bool is_sync_load) {
+ TRACE_EVENT0(
+ "toplevel",
+ "ResourceDispatcherHostImpl::BeginRequest::BuildLoadFlagsForRequest");
int load_flags = request_data.load_flags;
// Although EV status is irrelevant to sub-frames and sub-resources, we have
« no previous file with comments | « content/browser/loader/resource_buffer.cc ('k') | content/browser/loader/resource_loader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698