diff options
author | willchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-22 19:00:58 +0000 |
---|---|---|
committer | willchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-22 19:00:58 +0000 |
commit | 8523ba5fab2b52f359b644fea1b9c2b3ea078260 (patch) | |
tree | f77d449eb28f0fa1b2f0bc0bf8006751423be59f /chrome/browser/task_manager | |
parent | 653f4ec848607162cd842a3dbcb6d5f18f72bcba (diff) | |
download | chromium_src-8523ba5fab2b52f359b644fea1b9c2b3ea078260.zip chromium_src-8523ba5fab2b52f359b644fea1b9c2b3ea078260.tar.gz chromium_src-8523ba5fab2b52f359b644fea1b9c2b3ea078260.tar.bz2 |
Kill URLRequestJobTracker.
BUG=81160
TEST=none
Review URL: http://codereview.chromium.org/7043007
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@86241 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/task_manager')
-rw-r--r-- | chrome/browser/task_manager/task_manager.cc | 55 | ||||
-rw-r--r-- | chrome/browser/task_manager/task_manager.h | 25 |
2 files changed, 12 insertions, 68 deletions
diff --git a/chrome/browser/task_manager/task_manager.cc b/chrome/browser/task_manager/task_manager.cc index 15282d2..68e5bfc 100644 --- a/chrome/browser/task_manager/task_manager.cc +++ b/chrome/browser/task_manager/task_manager.cc @@ -34,8 +34,6 @@ #include "grit/app_resources.h" #include "grit/chromium_strings.h" #include "grit/generated_resources.h" -#include "net/url_request/url_request.h" -#include "net/url_request/url_request_job.h" #include "ui/base/l10n/l10n_util.h" #include "ui/base/resource/resource_bundle.h" #include "unicode/coll.h" @@ -500,13 +498,6 @@ void TaskManagerModel::StartUpdating() { } update_state_ = TASK_PENDING; - // Register jobs notifications so we can compute network usage (it must be - // done from the IO thread). - BrowserThread::PostTask( - BrowserThread::IO, FROM_HERE, - NewRunnableMethod( - this, &TaskManagerModel::RegisterForJobDoneNotifications)); - // Notify resource providers that we are updating. for (ResourceProviderList::iterator iter = providers_.begin(); iter != providers_.end(); ++iter) { @@ -531,12 +522,6 @@ void TaskManagerModel::StopUpdating() { (*iter)->StopUpdating(); } - // Unregister jobs notification (must be done from the IO thread). - BrowserThread::PostTask( - BrowserThread::IO, FROM_HERE, - NewRunnableMethod( - this, &TaskManagerModel::UnregisterForJobDoneNotifications)); - // Must clear the resources before the next attempt to start updating. Clear(); } @@ -549,14 +534,6 @@ void TaskManagerModel::AddResourceProvider( providers_.push_back(provider); } -void TaskManagerModel::RegisterForJobDoneNotifications() { - net::g_url_request_job_tracker.AddObserver(this); -} - -void TaskManagerModel::UnregisterForJobDoneNotifications() { - net::g_url_request_job_tracker.RemoveObserver(this); -} - void TaskManagerModel::AddResource(TaskManager::Resource* resource) { base::ProcessHandle process = resource->GetProcess(); @@ -836,41 +813,21 @@ void TaskManagerModel::BytesRead(BytesReadParam param) { } -// In order to retrieve the network usage, we register for net::URLRequestJob -// notifications. Every time we get notified some bytes were read we bump a -// counter of read bytes for the associated resource. When the timer ticks, -// we'll compute the actual network usage (see the Refresh method). -void TaskManagerModel::OnJobAdded(net::URLRequestJob* job) { -} - -void TaskManagerModel::OnJobRemoved(net::URLRequestJob* job) { -} - -void TaskManagerModel::OnJobDone(net::URLRequestJob* job, - const net::URLRequestStatus& status) { -} - -void TaskManagerModel::OnJobRedirect(net::URLRequestJob* job, - const GURL& location, - int status_code) { -} - -void TaskManagerModel::OnBytesRead(net::URLRequestJob* job, const char* buf, - int byte_count) { +void TaskManagerModel::NotifyBytesRead(const net::URLRequest& request, + 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(), + ResourceDispatcherHost::RenderViewForRequest(&request, &render_process_host_child_id, &routing_id); // Get the origin PID of the request's originator. This will only be set for // plugins - for renderer or browser initiated requests it will be zero. - int origin_pid = - chrome_browser_net::GetOriginPIDForRequest(job->request()); + int origin_pid = chrome_browser_net::GetOriginPIDForRequest(&request); // This happens in the IO thread, post it to the UI thread. BrowserThread::PostTask( @@ -879,8 +836,8 @@ void TaskManagerModel::OnBytesRead(net::URLRequestJob* job, const char* buf, this, &TaskManagerModel::BytesRead, BytesReadParam(origin_pid, - render_process_host_child_id, - routing_id, byte_count))); + render_process_host_child_id, + routing_id, byte_count))); } bool TaskManagerModel::GetProcessMetricsForRow( diff --git a/chrome/browser/task_manager/task_manager.h b/chrome/browser/task_manager/task_manager.h index 2b8d0a2..bfe7174 100644 --- a/chrome/browser/task_manager/task_manager.h +++ b/chrome/browser/task_manager/task_manager.h @@ -20,7 +20,6 @@ #include "base/string16.h" #include "base/timer.h" #include "chrome/browser/renderer_host/web_cache_manager.h" -#include "net/url_request/url_request_job_tracker.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebCache.h" class Extension; @@ -31,6 +30,9 @@ class TaskManagerModel; namespace base { class ProcessMetrics; } +namespace net { +class URLRequest; +} // This class is a singleton. class TaskManager { @@ -214,8 +216,7 @@ class TaskManagerModelObserver { }; // The model that the TaskManager is using. -class TaskManagerModel : public net::URLRequestJobTracker::JobObserver, - public base::RefCountedThreadSafe<TaskManagerModel> { +class TaskManagerModel : public base::RefCountedThreadSafe<TaskManagerModel> { public: explicit TaskManagerModel(TaskManager* task_manager); @@ -297,18 +298,6 @@ class TaskManagerModel : public net::URLRequestJobTracker::JobObserver, // Returns Extension of given resource or NULL if not applicable. const Extension* GetResourceExtension(int index) const; - // JobObserver methods: - virtual void OnJobAdded(net::URLRequestJob* job); - virtual void OnJobRemoved(net::URLRequestJob* job); - virtual void OnJobDone(net::URLRequestJob* job, - const net::URLRequestStatus& status); - virtual void OnJobRedirect(net::URLRequestJob* job, - const GURL& location, - int status_code); - virtual void OnBytesRead(net::URLRequestJob* job, - const char* buf, - int byte_count); - void AddResource(TaskManager::Resource* resource); void RemoveResource(TaskManager::Resource* resource); @@ -329,6 +318,8 @@ class TaskManagerModel : public net::URLRequestJobTracker::JobObserver, size_t v8_memory_allocated, size_t v8_memory_used); + void NotifyBytesRead(const net::URLRequest& request, int bytes_read); + private: friend class base::RefCountedThreadSafe<TaskManagerModel>; FRIEND_TEST_ALL_PREFIXES(TaskManagerTest, RefreshCalled); @@ -379,10 +370,6 @@ class TaskManagerModel : public net::URLRequestJobTracker::JobObserver, void AddItem(TaskManager::Resource* resource, bool notify_table); void RemoveItem(TaskManager::Resource* resource); - // Register for network usage updates - void RegisterForJobDoneNotifications(); - void UnregisterForJobDoneNotifications(); - // Returns the network usage (in bytes per seconds) for the specified // resource. That's the value retrieved at the last timer's tick. int64 GetNetworkUsageForResource(TaskManager::Resource* resource) const; |