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_protocol.h" | 8 #include "content/browser/devtools/protocol/devtools_protocol_handler_impl.h" |
9 #include "content/browser/devtools/devtools_protocol_constants.h" | |
10 #include "content/browser/service_worker/service_worker_context_core.h" | 9 #include "content/browser/service_worker/service_worker_context_core.h" |
11 #include "content/browser/service_worker/service_worker_version.h" | 10 #include "content/browser/service_worker/service_worker_version.h" |
12 #include "content/browser/shared_worker/shared_worker_service_impl.h" | 11 #include "content/browser/shared_worker/shared_worker_service_impl.h" |
13 #include "content/common/devtools_messages.h" | 12 #include "content/common/devtools_messages.h" |
14 #include "content/public/browser/browser_thread.h" | 13 #include "content/public/browser/browser_thread.h" |
15 #include "content/public/browser/render_process_host.h" | 14 #include "content/public/browser/render_process_host.h" |
16 | 15 |
17 namespace content { | 16 namespace content { |
18 | 17 |
19 namespace { | 18 namespace { |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 state_ = IsAttached() ? WORKER_PAUSED_FOR_REATTACH : WORKER_UNINSPECTED; | 163 state_ = IsAttached() ? WORKER_PAUSED_FOR_REATTACH : WORKER_UNINSPECTED; |
165 worker_id_ = worker_id; | 164 worker_id_ = worker_id; |
166 WorkerCreated(); | 165 WorkerCreated(); |
167 } | 166 } |
168 | 167 |
169 void EmbeddedWorkerDevToolsAgentHost::WorkerDestroyed() { | 168 void EmbeddedWorkerDevToolsAgentHost::WorkerDestroyed() { |
170 DCHECK_NE(WORKER_TERMINATED, state_); | 169 DCHECK_NE(WORKER_TERMINATED, state_); |
171 if (state_ == WORKER_INSPECTED) { | 170 if (state_ == WORKER_INSPECTED) { |
172 DCHECK(IsAttached()); | 171 DCHECK(IsAttached()); |
173 // Client host is debugging this worker agent host. | 172 // Client host is debugging this worker agent host. |
174 std::string notification = | 173 base::Callback<void(const std::string&)> raw_message_callback( |
175 DevToolsProtocol::CreateNotification( | 174 base::Bind(&EmbeddedWorkerDevToolsAgentHost::SendMessageToClient, |
176 devtools::Worker::disconnectedFromWorker::kName, NULL)->Serialize(); | 175 base::Unretained(this))); |
177 SendMessageToClient(notification); | 176 devtools::worker::Client worker(raw_message_callback); |
| 177 worker.DisconnectedFromWorker( |
| 178 devtools::worker::DisconnectedFromWorkerParams::Create()); |
178 DetachFromWorker(); | 179 DetachFromWorker(); |
179 } | 180 } |
180 state_ = WORKER_TERMINATED; | 181 state_ = WORKER_TERMINATED; |
181 Release(); // Balanced in WorkerCreated() | 182 Release(); // Balanced in WorkerCreated() |
182 } | 183 } |
183 | 184 |
184 bool EmbeddedWorkerDevToolsAgentHost::Matches( | 185 bool EmbeddedWorkerDevToolsAgentHost::Matches( |
185 const SharedWorkerInstance& other) { | 186 const SharedWorkerInstance& other) { |
186 return shared_worker_ && shared_worker_->Matches(other); | 187 return shared_worker_ && shared_worker_->Matches(other); |
187 } | 188 } |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 | 224 |
224 ProcessChunkedMessageFromAgent(message, total_size); | 225 ProcessChunkedMessageFromAgent(message, total_size); |
225 } | 226 } |
226 | 227 |
227 void EmbeddedWorkerDevToolsAgentHost::OnSaveAgentRuntimeState( | 228 void EmbeddedWorkerDevToolsAgentHost::OnSaveAgentRuntimeState( |
228 const std::string& state) { | 229 const std::string& state) { |
229 saved_agent_state_ = state; | 230 saved_agent_state_ = state; |
230 } | 231 } |
231 | 232 |
232 } // namespace content | 233 } // namespace content |
OLD | NEW |