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_agent_host.h" | 5 #include "content/browser/devtools/embedded_worker_devtools_agent_host.h" |
6 | 6 |
7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
8 #include "content/browser/devtools/devtools_manager_impl.h" | 8 #include "content/browser/devtools/devtools_manager_impl.h" |
9 #include "content/browser/devtools/devtools_protocol.h" | 9 #include "content/browser/devtools/devtools_protocol.h" |
10 #include "content/browser/devtools/devtools_protocol_constants.h" | 10 #include "content/browser/devtools/devtools_protocol_constants.h" |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 IPC_MESSAGE_HANDLER(DevToolsClientMsg_DispatchOnInspectorFrontend, | 136 IPC_MESSAGE_HANDLER(DevToolsClientMsg_DispatchOnInspectorFrontend, |
137 OnDispatchOnInspectorFrontend) | 137 OnDispatchOnInspectorFrontend) |
138 IPC_MESSAGE_HANDLER(DevToolsHostMsg_SaveAgentRuntimeState, | 138 IPC_MESSAGE_HANDLER(DevToolsHostMsg_SaveAgentRuntimeState, |
139 OnSaveAgentRuntimeState) | 139 OnSaveAgentRuntimeState) |
140 IPC_MESSAGE_UNHANDLED(handled = false) | 140 IPC_MESSAGE_UNHANDLED(handled = false) |
141 IPC_END_MESSAGE_MAP() | 141 IPC_END_MESSAGE_MAP() |
142 return handled; | 142 return handled; |
143 } | 143 } |
144 | 144 |
145 void EmbeddedWorkerDevToolsAgentHost::WorkerReadyForInspection() { | 145 void EmbeddedWorkerDevToolsAgentHost::WorkerReadyForInspection() { |
146 // TODO(vsevik): This method will be implemented once we support connecting | |
147 // devtools to the main thread of embedded worker. | |
148 } | |
149 | |
150 void EmbeddedWorkerDevToolsAgentHost::WorkerContextStarted() { | |
151 // TODO(vsevik): This code should be moved to WorkerReadyForInspection() | |
152 // once we support connecting devtools to the main thread of embedded worker. | |
153 if (state_ == WORKER_PAUSED_FOR_DEBUG_ON_START) { | 146 if (state_ == WORKER_PAUSED_FOR_DEBUG_ON_START) { |
154 RenderProcessHost* rph = RenderProcessHost::FromID(worker_id_.first); | 147 RenderProcessHost* rph = RenderProcessHost::FromID(worker_id_.first); |
155 Inspect(rph->GetBrowserContext()); | 148 Inspect(rph->GetBrowserContext()); |
156 } else if (state_ == WORKER_PAUSED_FOR_REATTACH) { | 149 } else if (state_ == WORKER_PAUSED_FOR_REATTACH) { |
157 DCHECK(IsAttached()); | 150 DCHECK(IsAttached()); |
158 state_ = WORKER_INSPECTED; | 151 state_ = WORKER_INSPECTED; |
159 AttachToWorker(); | 152 AttachToWorker(); |
160 Reattach(saved_agent_state_); | 153 Reattach(saved_agent_state_); |
161 } | 154 } |
162 } | 155 } |
163 | 156 |
| 157 void EmbeddedWorkerDevToolsAgentHost::WorkerContextStarted() { |
| 158 } |
| 159 |
164 void EmbeddedWorkerDevToolsAgentHost::WorkerRestarted(WorkerId worker_id) { | 160 void EmbeddedWorkerDevToolsAgentHost::WorkerRestarted(WorkerId worker_id) { |
165 DCHECK_EQ(WORKER_TERMINATED, state_); | 161 DCHECK_EQ(WORKER_TERMINATED, state_); |
166 state_ = IsAttached() ? WORKER_PAUSED_FOR_REATTACH : WORKER_UNINSPECTED; | 162 state_ = IsAttached() ? WORKER_PAUSED_FOR_REATTACH : WORKER_UNINSPECTED; |
167 worker_id_ = worker_id; | 163 worker_id_ = worker_id; |
168 WorkerCreated(); | 164 WorkerCreated(); |
169 } | 165 } |
170 | 166 |
171 void EmbeddedWorkerDevToolsAgentHost::WorkerDestroyed() { | 167 void EmbeddedWorkerDevToolsAgentHost::WorkerDestroyed() { |
172 DCHECK_NE(WORKER_TERMINATED, state_); | 168 DCHECK_NE(WORKER_TERMINATED, state_); |
173 if (state_ == WORKER_INSPECTED) { | 169 if (state_ == WORKER_INSPECTED) { |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 const std::string& message) { | 217 const std::string& message) { |
222 SendMessageToClient(message); | 218 SendMessageToClient(message); |
223 } | 219 } |
224 | 220 |
225 void EmbeddedWorkerDevToolsAgentHost::OnSaveAgentRuntimeState( | 221 void EmbeddedWorkerDevToolsAgentHost::OnSaveAgentRuntimeState( |
226 const std::string& state) { | 222 const std::string& state) { |
227 saved_agent_state_ = state; | 223 saved_agent_state_ = state; |
228 } | 224 } |
229 | 225 |
230 } // namespace content | 226 } // namespace content |
OLD | NEW |