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() const OVERRIDE { return true; } |
| 85 |
83 // IPCDevToolsAgentHost implementation. | 86 // IPCDevToolsAgentHost implementation. |
84 virtual void SendMessageToAgent(IPC::Message* message) OVERRIDE { | 87 virtual void SendMessageToAgent(IPC::Message* message) OVERRIDE { |
85 if (worker_attached_) | 88 if (worker_attached_) |
86 SendMessageToWorker(worker_id_, message); | 89 SendMessageToWorker(worker_id_, message); |
87 else | 90 else |
88 delete message; | 91 delete message; |
89 } | 92 } |
90 virtual void OnClientAttached() OVERRIDE {} | 93 virtual void OnClientAttached() OVERRIDE {} |
91 virtual void OnClientDetached() OVERRIDE {} | 94 virtual void OnClientDetached() OVERRIDE {} |
92 | 95 |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
330 scoped_ptr<WorkerInfo> info = workers_.take_and_erase(it); | 333 scoped_ptr<WorkerInfo> info = workers_.take_and_erase(it); |
331 info->set_state(WORKER_PAUSED); | 334 info->set_state(WORKER_PAUSED); |
332 workers_.set(id, info.Pass()); | 335 workers_.set(id, info.Pass()); |
333 } | 336 } |
334 | 337 |
335 void EmbeddedWorkerDevToolsManager::ResetForTesting() { | 338 void EmbeddedWorkerDevToolsManager::ResetForTesting() { |
336 workers_.clear(); | 339 workers_.clear(); |
337 } | 340 } |
338 | 341 |
339 } // namespace content | 342 } // namespace content |
OLD | NEW |