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

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: Created 9 years, 1 month 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"
18 #include "content/public/browser/devtools/devtools_agent_host_registry.h"
19 #include "content/public/browser/browser_thread.h" 19 #include "content/public/browser/browser_thread.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::DevToolsAgentHostRegistry;
28 29
29 // Objects of this class are created on the IO thread and then passed to the UI 30 // 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 31 // 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. 32 // only on the UI thread. Destructor may be called on any thread.
32 class TaskManagerSharedWorkerResource : public TaskManager::Resource { 33 class TaskManagerSharedWorkerResource : public TaskManager::Resource {
33 public: 34 public:
34 TaskManagerSharedWorkerResource(const ChildProcessInfo& process_info, 35 TaskManagerSharedWorkerResource(const ChildProcessInfo& process_info,
35 int routing_id, const GURL& url, 36 int routing_id, const GURL& url,
36 const string16& name); 37 const string16& name);
37 virtual ~TaskManagerSharedWorkerResource(); 38 virtual ~TaskManagerSharedWorkerResource();
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 return true; 120 return true;
120 } 121 }
121 122
122 void TaskManagerSharedWorkerResource::Inspect() const { 123 void TaskManagerSharedWorkerResource::Inspect() const {
123 // TODO(yurys): would be better to get profile from one of the tabs connected 124 // TODO(yurys): would be better to get profile from one of the tabs connected
124 // to the worker. 125 // to the worker.
125 Profile* profile = ProfileManager::GetLastUsedProfile(); 126 Profile* profile = ProfileManager::GetLastUsedProfile();
126 if (!profile) 127 if (!profile)
127 return; 128 return;
128 DevToolsAgentHost* agent_host = 129 DevToolsAgentHost* agent_host =
129 WorkerDevToolsManager::GetDevToolsAgentHostForWorker( 130 DevToolsAgentHostRegistry::GetDevToolsAgentHostForWorker(
130 process_info_.id(), 131 process_info_.id(),
131 routing_id_); 132 routing_id_);
132 DevToolsWindow::OpenDevToolsWindowForWorker(profile, agent_host); 133 DevToolsWindow::OpenDevToolsWindowForWorker(profile, agent_host);
133 } 134 }
134 135
135 bool TaskManagerSharedWorkerResource::SupportNetworkUsage() const { 136 bool TaskManagerSharedWorkerResource::SupportNetworkUsage() const {
136 return false; 137 return false;
137 } 138 }
138 139
139 void TaskManagerSharedWorkerResource::SetSupportNetworkUsage() { 140 void TaskManagerSharedWorkerResource::SetSupportNetworkUsage() {
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 int process_id = resource->process_info().id(); 345 int process_id = resource->process_info().id();
345 launching_workers_[process_id].push_back(resource); 346 launching_workers_[process_id].push_back(resource);
346 } else { 347 } else {
347 task_manager_->AddResource(resource); 348 task_manager_->AddResource(resource);
348 } 349 }
349 } 350 }
350 351
351 void TaskManagerWorkerResourceProvider::DeleteAllResources() { 352 void TaskManagerWorkerResourceProvider::DeleteAllResources() {
352 STLDeleteElements(&resources_); 353 STLDeleteElements(&resources_);
353 } 354 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698