| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/devtools/embedded_worker_devtools_manager.h" | 5 #include "content/browser/devtools/embedded_worker_devtools_manager.h" |
| 6 | 6 |
| 7 #include "content/browser/devtools/devtools_manager_impl.h" | 7 #include "content/browser/devtools/devtools_manager_impl.h" |
| 8 #include "content/browser/devtools/devtools_protocol.h" | 8 #include "content/browser/devtools/devtools_protocol.h" |
| 9 #include "content/browser/devtools/devtools_protocol_constants.h" | 9 #include "content/browser/devtools/devtools_protocol_constants.h" |
| 10 #include "content/browser/devtools/ipc_devtools_agent_host.h" | 10 #include "content/browser/devtools/ipc_devtools_agent_host.h" |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 : public IPCDevToolsAgentHost, | 73 : public IPCDevToolsAgentHost, |
| 74 public IPC::Listener { | 74 public IPC::Listener { |
| 75 public: | 75 public: |
| 76 explicit EmbeddedWorkerDevToolsAgentHost(WorkerId worker_id) | 76 explicit EmbeddedWorkerDevToolsAgentHost(WorkerId worker_id) |
| 77 : worker_id_(worker_id), worker_attached_(true) { | 77 : worker_id_(worker_id), worker_attached_(true) { |
| 78 AddRef(); | 78 AddRef(); |
| 79 if (RenderProcessHost* host = RenderProcessHost::FromID(worker_id_.first)) | 79 if (RenderProcessHost* host = RenderProcessHost::FromID(worker_id_.first)) |
| 80 host->AddRoute(worker_id_.second, this); | 80 host->AddRoute(worker_id_.second, this); |
| 81 } | 81 } |
| 82 | 82 |
| 83 // DevToolsAgentHost override. |
| 84 virtual bool IsWorker() OVERRIDE { |
| 85 return true; |
| 86 } |
| 87 |
| 83 // IPCDevToolsAgentHost implementation. | 88 // IPCDevToolsAgentHost implementation. |
| 84 virtual void SendMessageToAgent(IPC::Message* message) OVERRIDE { | 89 virtual void SendMessageToAgent(IPC::Message* message) OVERRIDE { |
| 85 if (worker_attached_) | 90 if (worker_attached_) |
| 86 SendMessageToWorker(worker_id_, message); | 91 SendMessageToWorker(worker_id_, message); |
| 87 else | 92 else |
| 88 delete message; | 93 delete message; |
| 89 } | 94 } |
| 90 virtual void OnClientAttached() OVERRIDE {} | 95 virtual void OnClientAttached() OVERRIDE {} |
| 91 virtual void OnClientDetached() OVERRIDE {} | 96 virtual void OnClientDetached() OVERRIDE {} |
| 92 | 97 |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 330 scoped_ptr<WorkerInfo> info = workers_.take_and_erase(it); | 335 scoped_ptr<WorkerInfo> info = workers_.take_and_erase(it); |
| 331 info->set_state(WORKER_PAUSED); | 336 info->set_state(WORKER_PAUSED); |
| 332 workers_.set(id, info.Pass()); | 337 workers_.set(id, info.Pass()); |
| 333 } | 338 } |
| 334 | 339 |
| 335 void EmbeddedWorkerDevToolsManager::ResetForTesting() { | 340 void EmbeddedWorkerDevToolsManager::ResetForTesting() { |
| 336 workers_.clear(); | 341 workers_.clear(); |
| 337 } | 342 } |
| 338 | 343 |
| 339 } // namespace content | 344 } // namespace content |
| OLD | NEW |