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

Side by Side Diff: chrome/browser/task_manager/task_manager_worker_resource_provider.cc

Issue 8549022: Define DevTools content API (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed comments Created 9 years 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/task_manager/task_manager_worker_resource_provider.h" 5 #include "chrome/browser/task_manager/task_manager_worker_resource_provider.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/stl_util.h" 9 #include "base/stl_util.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
11 #include "chrome/browser/browser_process.h" 11 #include "chrome/browser/browser_process.h"
12 #include "chrome/browser/debugger/devtools_window.h" 12 #include "chrome/browser/debugger/devtools_window.h"
13 #include "chrome/browser/profiles/profile_manager.h" 13 #include "chrome/browser/profiles/profile_manager.h"
14 #include "content/browser/browser_child_process_host.h" 14 #include "content/browser/browser_child_process_host.h"
15 #include "content/browser/debugger/worker_devtools_manager.h"
16 #include "content/browser/worker_host/worker_process_host.h" 15 #include "content/browser/worker_host/worker_process_host.h"
17 #include "content/browser/worker_host/worker_service.h" 16 #include "content/browser/worker_host/worker_service.h"
18 #include "content/browser/worker_host/worker_service_observer.h" 17 #include "content/browser/worker_host/worker_service_observer.h"
19 #include "content/public/browser/browser_thread.h" 18 #include "content/public/browser/browser_thread.h"
19 #include "content/public/browser/devtools_agent_host_registry.h"
20 #include "content/public/browser/notification_service.h" 20 #include "content/public/browser/notification_service.h"
21 #include "content/public/browser/notification_types.h" 21 #include "content/public/browser/notification_types.h"
22 #include "grit/generated_resources.h" 22 #include "grit/generated_resources.h"
23 #include "grit/theme_resources_standard.h" 23 #include "grit/theme_resources_standard.h"
24 #include "ui/base/l10n/l10n_util.h" 24 #include "ui/base/l10n/l10n_util.h"
25 #include "ui/base/resource/resource_bundle.h" 25 #include "ui/base/resource/resource_bundle.h"
26 26
27 using content::BrowserThread; 27 using content::BrowserThread;
28 using content::DevToolsAgentHost;
29 using content::DevToolsAgentHostRegistry;
28 30
29 // Objects of this class are created on the IO thread and then passed to the UI 31 // Objects of this class are created on the IO thread and then passed to the UI
30 // thread where they are passed to the task manager. All methods must be called 32 // thread where they are passed to the task manager. All methods must be called
31 // only on the UI thread. Destructor may be called on any thread. 33 // only on the UI thread. Destructor may be called on any thread.
32 class TaskManagerSharedWorkerResource : public TaskManager::Resource { 34 class TaskManagerSharedWorkerResource : public TaskManager::Resource {
33 public: 35 public:
34 TaskManagerSharedWorkerResource(const ChildProcessInfo& process_info, 36 TaskManagerSharedWorkerResource(const ChildProcessInfo& process_info,
35 int routing_id, const GURL& url, 37 int routing_id, const GURL& url,
36 const string16& name); 38 const string16& name);
37 virtual ~TaskManagerSharedWorkerResource(); 39 virtual ~TaskManagerSharedWorkerResource();
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 return true; 121 return true;
120 } 122 }
121 123
122 void TaskManagerSharedWorkerResource::Inspect() const { 124 void TaskManagerSharedWorkerResource::Inspect() const {
123 // TODO(yurys): would be better to get profile from one of the tabs connected 125 // TODO(yurys): would be better to get profile from one of the tabs connected
124 // to the worker. 126 // to the worker.
125 Profile* profile = ProfileManager::GetLastUsedProfile(); 127 Profile* profile = ProfileManager::GetLastUsedProfile();
126 if (!profile) 128 if (!profile)
127 return; 129 return;
128 DevToolsAgentHost* agent_host = 130 DevToolsAgentHost* agent_host =
129 WorkerDevToolsManager::GetDevToolsAgentHostForWorker( 131 DevToolsAgentHostRegistry::GetDevToolsAgentHostForWorker(
130 process_info_.id(), 132 process_info_.id(),
131 routing_id_); 133 routing_id_);
132 DevToolsWindow::OpenDevToolsWindowForWorker(profile, agent_host); 134 DevToolsWindow::OpenDevToolsWindowForWorker(profile, agent_host);
133 } 135 }
134 136
135 bool TaskManagerSharedWorkerResource::SupportNetworkUsage() const { 137 bool TaskManagerSharedWorkerResource::SupportNetworkUsage() const {
136 return false; 138 return false;
137 } 139 }
138 140
139 void TaskManagerSharedWorkerResource::SetSupportNetworkUsage() { 141 void TaskManagerSharedWorkerResource::SetSupportNetworkUsage() {
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 int process_id = resource->process_info().id(); 346 int process_id = resource->process_info().id();
345 launching_workers_[process_id].push_back(resource); 347 launching_workers_[process_id].push_back(resource);
346 } else { 348 } else {
347 task_manager_->AddResource(resource); 349 task_manager_->AddResource(resource);
348 } 350 }
349 } 351 }
350 352
351 void TaskManagerWorkerResourceProvider::DeleteAllResources() { 353 void TaskManagerWorkerResourceProvider::DeleteAllResources() {
352 STLDeleteElements(&resources_); 354 STLDeleteElements(&resources_);
353 } 355 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698