| OLD | NEW |
| 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 "content/browser/debugger/worker_devtools_manager.h" | 5 #include "content/browser/debugger/worker_devtools_manager.h" |
| 6 | 6 |
| 7 #include <list> | 7 #include <list> |
| 8 #include <map> | 8 #include <map> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| 11 #include "content/browser/debugger/devtools_agent_host.h" | 11 #include "content/browser/debugger/devtools_agent_host.h" |
| 12 #include "content/browser/debugger/devtools_manager.h" | 12 #include "content/browser/debugger/devtools_manager.h" |
| 13 #include "content/browser/debugger/worker_devtools_message_filter.h" | 13 #include "content/browser/debugger/worker_devtools_message_filter.h" |
| 14 #include "content/browser/worker_host/worker_process_host.h" | 14 #include "content/browser/worker_host/worker_process_host.h" |
| 15 #include "content/browser/worker_host/worker_service.h" | 15 #include "content/browser/worker_host/worker_service.h" |
| 16 #include "content/common/devtools_messages.h" | 16 #include "content/common/devtools_messages.h" |
| 17 #include "content/public/browser/browser_thread.h" | 17 #include "content/public/browser/browser_thread.h" |
| 18 #include "content/public/browser/notification_observer.h" | 18 #include "content/public/browser/notification_observer.h" |
| 19 #include "content/public/browser/notification_registrar.h" | 19 #include "content/public/browser/notification_registrar.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 "content/public/common/process_type.h" |
| 22 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCString.h" | 23 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCString.h" |
| 23 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDevToolsAgent.h" | 24 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDevToolsAgent.h" |
| 24 #include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" | 25 #include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" |
| 25 | 26 |
| 26 using content::BrowserThread; | 27 using content::BrowserThread; |
| 27 | 28 |
| 28 class WorkerDevToolsManager::AgentHosts | 29 class WorkerDevToolsManager::AgentHosts |
| 29 : private content::NotificationObserver { | 30 : private content::NotificationObserver { |
| 30 public: | 31 public: |
| 31 static void Add(WorkerId id, WorkerDevToolsAgentHost* host) { | 32 static void Add(WorkerId id, WorkerDevToolsAgentHost* host) { |
| (...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 348 InspectedWorkersList::iterator it = inspected_workers_.begin(); | 349 InspectedWorkersList::iterator it = inspected_workers_.begin(); |
| 349 while (it != inspected_workers_.end()) { | 350 while (it != inspected_workers_.end()) { |
| 350 if (it->host->id() == host_id && it->route_id == route_id) | 351 if (it->host->id() == host_id && it->route_id == route_id) |
| 351 break; | 352 break; |
| 352 ++it; | 353 ++it; |
| 353 } | 354 } |
| 354 return it; | 355 return it; |
| 355 } | 356 } |
| 356 | 357 |
| 357 static WorkerProcessHost* FindWorkerProcess(int worker_process_id) { | 358 static WorkerProcessHost* FindWorkerProcess(int worker_process_id) { |
| 358 BrowserChildProcessHost::Iterator iter(ChildProcessInfo::WORKER_PROCESS); | 359 BrowserChildProcessHost::Iterator iter(content::PROCESS_TYPE_WORKER); |
| 359 for (; !iter.Done(); ++iter) { | 360 for (; !iter.Done(); ++iter) { |
| 360 if (iter->id() == worker_process_id) | 361 if (iter->id() == worker_process_id) |
| 361 return static_cast<WorkerProcessHost*>(*iter); | 362 return static_cast<WorkerProcessHost*>(*iter); |
| 362 } | 363 } |
| 363 return NULL; | 364 return NULL; |
| 364 } | 365 } |
| 365 | 366 |
| 366 void WorkerDevToolsManager::RegisterDevToolsAgentHostForWorker( | 367 void WorkerDevToolsManager::RegisterDevToolsAgentHostForWorker( |
| 367 int worker_process_id, | 368 int worker_process_id, |
| 368 int worker_route_id) { | 369 int worker_route_id) { |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 472 AgentHosts::GetAgentHost(WorkerId(worker_process_id, worker_route_id)); | 473 AgentHosts::GetAgentHost(WorkerId(worker_process_id, worker_route_id)); |
| 473 if (host) | 474 if (host) |
| 474 host->WorkerDestroyed(); | 475 host->WorkerDestroyed(); |
| 475 } | 476 } |
| 476 | 477 |
| 477 // static | 478 // static |
| 478 void WorkerDevToolsManager::SendResumeToWorker(const WorkerId& id) { | 479 void WorkerDevToolsManager::SendResumeToWorker(const WorkerId& id) { |
| 479 if (WorkerProcessHost* process = FindWorkerProcess(id.first)) | 480 if (WorkerProcessHost* process = FindWorkerProcess(id.first)) |
| 480 process->Send(new DevToolsAgentMsg_ResumeWorkerContext(id.second)); | 481 process->Send(new DevToolsAgentMsg_ResumeWorkerContext(id.second)); |
| 481 } | 482 } |
| OLD | NEW |