Chromium Code Reviews| 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 fa9c0442eab427857bb35e2af52400fbc225d749..da6ebafea626d0c3be4d25e820f4f816f7ad06c2 100644 |
| --- a/content/browser/loader/resource_dispatcher_host_impl.cc |
| +++ b/content/browser/loader/resource_dispatcher_host_impl.cc |
| @@ -21,6 +21,7 @@ |
| #include "base/message_loop/message_loop.h" |
| #include "base/metrics/histogram.h" |
| #include "base/metrics/sparse_histogram.h" |
| +#include "base/profiler/scoped_tracker.h" |
| #include "base/stl_util.h" |
| #include "base/third_party/dynamic_annotations/dynamic_annotations.h" |
| #include "content/browser/appcache/appcache_interceptor.h" |
| @@ -2151,6 +2152,11 @@ void LoadInfoUpdateCallback(const LoadInfoMap& info_map) { |
| } // namespace |
| void ResourceDispatcherHostImpl::UpdateLoadStates() { |
| + // TODO(pkasting): Remove ScopedTracker below once crbug.com/455952 is |
| + // fixed. |
| + tracked_objects::ScopedTracker tracking_profile1( |
| + FROM_HERE_WITH_EXPLICIT_FUNCTION( |
| + "455952 ResourceDispatcherHostImpl::UpdateLoadStates1")); |
| // Populate this map with load state changes, and then send them on to the UI |
| // thread where they can be passed along to the respective RVHs. |
| LoadInfoMap info_map; |
| @@ -2160,48 +2166,62 @@ void ResourceDispatcherHostImpl::UpdateLoadStates() { |
| // Determine the largest upload size of all requests |
| // in each View (good chance it's zero). |
| std::map<GlobalRoutingID, uint64> largest_upload_size; |
| - for (i = pending_loaders_.begin(); i != pending_loaders_.end(); ++i) { |
| - net::URLRequest* request = i->second->request(); |
| - ResourceRequestInfoImpl* info = i->second->GetRequestInfo(); |
| - uint64 upload_size = request->GetUploadProgress().size(); |
| - if (request->GetLoadState().state != net::LOAD_STATE_SENDING_REQUEST) |
| - upload_size = 0; |
| - GlobalRoutingID id(info->GetGlobalRoutingID()); |
| - if (upload_size && largest_upload_size[id] < upload_size) |
| - largest_upload_size[id] = upload_size; |
| + { |
| + // TODO(pkasting): Remove ScopedTracker below once crbug.com/455952 is |
| + // fixed. |
| + tracked_objects::ScopedTracker tracking_profile2( |
| + FROM_HERE_WITH_EXPLICIT_FUNCTION( |
|
vadimt
2015/02/06 01:48:08
Will work, but you don't need curlies. The time in
Peter Kasting
2015/02/06 01:54:54
I didn't want the code at the bottom of the functi
|
| + "455952 ResourceDispatcherHostImpl::UpdateLoadStates2")); |
| + for (i = pending_loaders_.begin(); i != pending_loaders_.end(); ++i) { |
| + net::URLRequest* request = i->second->request(); |
| + ResourceRequestInfoImpl* info = i->second->GetRequestInfo(); |
| + uint64 upload_size = request->GetUploadProgress().size(); |
| + if (request->GetLoadState().state != net::LOAD_STATE_SENDING_REQUEST) |
| + upload_size = 0; |
| + GlobalRoutingID id(info->GetGlobalRoutingID()); |
| + if (upload_size && largest_upload_size[id] < upload_size) |
| + largest_upload_size[id] = upload_size; |
| + } |
| } |
| - for (i = pending_loaders_.begin(); i != pending_loaders_.end(); ++i) { |
| - net::URLRequest* request = i->second->request(); |
| - ResourceRequestInfoImpl* info = i->second->GetRequestInfo(); |
| - net::LoadStateWithParam load_state = request->GetLoadState(); |
| - net::UploadProgress progress = request->GetUploadProgress(); |
| - |
| - // We also poll for upload progress on this timer and send upload |
| - // progress ipc messages to the plugin process. |
| - i->second->ReportUploadProgress(); |
| - |
| - GlobalRoutingID id(info->GetGlobalRoutingID()); |
| - |
| - // If a request is uploading data, ignore all other requests so that the |
| - // upload progress takes priority for being shown in the status bar. |
| - if (largest_upload_size.find(id) != largest_upload_size.end() && |
| - progress.size() < largest_upload_size[id]) |
| - continue; |
| - |
| - net::LoadStateWithParam to_insert = load_state; |
| - LoadInfoMap::iterator existing = info_map.find(id); |
| - if (existing != info_map.end()) { |
| - to_insert = |
| - MoreInterestingLoadState(existing->second.load_state, load_state); |
| - if (to_insert.state == existing->second.load_state.state) |
| + { |
| + // TODO(pkasting): Remove ScopedTracker below once crbug.com/455952 is |
| + // fixed. |
| + tracked_objects::ScopedTracker tracking_profile3( |
| + FROM_HERE_WITH_EXPLICIT_FUNCTION( |
| + "455952 ResourceDispatcherHostImpl::UpdateLoadStates3")); |
| + for (i = pending_loaders_.begin(); i != pending_loaders_.end(); ++i) { |
| + net::URLRequest* request = i->second->request(); |
| + ResourceRequestInfoImpl* info = i->second->GetRequestInfo(); |
| + net::LoadStateWithParam load_state = request->GetLoadState(); |
| + net::UploadProgress progress = request->GetUploadProgress(); |
| + |
| + // We also poll for upload progress on this timer and send upload |
| + // progress ipc messages to the plugin process. |
| + i->second->ReportUploadProgress(); |
| + |
| + GlobalRoutingID id(info->GetGlobalRoutingID()); |
| + |
| + // If a request is uploading data, ignore all other requests so that the |
| + // upload progress takes priority for being shown in the status bar. |
| + if (largest_upload_size.find(id) != largest_upload_size.end() && |
| + progress.size() < largest_upload_size[id]) |
| continue; |
| + |
| + net::LoadStateWithParam to_insert = load_state; |
| + LoadInfoMap::iterator existing = info_map.find(id); |
| + if (existing != info_map.end()) { |
| + to_insert = |
| + MoreInterestingLoadState(existing->second.load_state, load_state); |
| + if (to_insert.state == existing->second.load_state.state) |
| + continue; |
| + } |
| + LoadInfo& load_info = info_map[id]; |
| + load_info.url = request->url(); |
| + load_info.load_state = to_insert; |
| + load_info.upload_size = progress.size(); |
| + load_info.upload_position = progress.position(); |
| } |
| - LoadInfo& load_info = info_map[id]; |
| - load_info.url = request->url(); |
| - load_info.load_state = to_insert; |
| - load_info.upload_size = progress.size(); |
| - load_info.upload_position = progress.position(); |
| } |
| if (info_map.empty()) |