diff options
author | thakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-01-21 03:11:48 +0000 |
---|---|---|
committer | thakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-01-21 03:11:48 +0000 |
commit | 2ea7fc242dfb8896b5499167d38d96cb8292c420 (patch) | |
tree | ccb290e16bb8c7d477383aa2fdd5212aaa93bd91 /chrome/browser/task_manager/task_manager.cc | |
parent | 2f5635f26eb68d0d53bb3e4fa8910f8e0c079c11 (diff) | |
download | chromium_src-2ea7fc242dfb8896b5499167d38d96cb8292c420.zip chromium_src-2ea7fc242dfb8896b5499167d38d96cb8292c420.tar.gz chromium_src-2ea7fc242dfb8896b5499167d38d96cb8292c420.tar.bz2 |
Revert 72095 - Attribute orphaned or anonymous network usage to the Browser resources.
BUG=47955,69883
TEST=When a tab is closed with a download in-progress and Task Manager displayed, the network activity is reflected in the Browser resource's Network total.
Review URL: http://codereview.chromium.org/6383002
Patch from James Weatherall <wez@chromium.org>.
TBR=thakis@chromium.org
Review URL: http://codereview.chromium.org/6341006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@72096 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/task_manager/task_manager.cc')
-rw-r--r-- | chrome/browser/task_manager/task_manager.cc | 29 |
1 files changed, 13 insertions, 16 deletions
diff --git a/chrome/browser/task_manager/task_manager.cc b/chrome/browser/task_manager/task_manager.cc index c1724e8..cc440b9 100644 --- a/chrome/browser/task_manager/task_manager.cc +++ b/chrome/browser/task_manager/task_manager.cc @@ -845,16 +845,10 @@ void TaskManagerModel::BytesRead(BytesReadParam param) { if (resource) break; } - if (resource == NULL) { - // We can't match a resource to the notification. That might mean the - // tab that started a download was closed, or the request may have had - // no originating resource associated with it in the first place. - // We attribute orphaned/unaccounted activity to the Browser process. - CHECK(param.origin_child_id != base::GetCurrentProcId()); - param.origin_child_id = base::GetCurrentProcId(); - param.render_process_host_child_id = param.routing_id = -1; - BytesRead(param); + // We may not have that resource anymore (example: close a tab while a + // a network resource is being retrieved), in which case we just ignore the + // notification. return; } @@ -893,15 +887,18 @@ void TaskManagerModel::OnJobRedirect(net::URLRequestJob* job, void TaskManagerModel::OnBytesRead(net::URLRequestJob* job, const char* buf, int byte_count) { - // Only net::URLRequestJob instances created by the ResourceDispatcherHost - // have a render view associated. All other jobs will have -1 returned for - // the render process child and routing ids - the jobs may still match a - // resource based on their origin id, otherwise BytesRead() will attribute - // the activity to the Browser resource. int render_process_host_child_id = -1, routing_id = -1; - ResourceDispatcherHost::RenderViewForRequest(job->request(), + if (!ResourceDispatcherHost::RenderViewForRequest(job->request(), &render_process_host_child_id, - &routing_id); + &routing_id)) { + // Only net::URLRequestJob instances created by the ResourceDispatcherHost + // have a render view associated. Jobs from components such as the + // SearchProvider for autocomplete, have no associated view, so we can't + // correctly attribute the bandwidth they consume. + // TODO(wez): All jobs' resources should ideally be accountable, even if + // only by contributing to the Browser process' stats. + return; + } // This happens in the IO thread, post it to the UI thread. int origin_child_id = |