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/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/service_worker/service_worker_context_core.h" | 10 #include "content/browser/service_worker/service_worker_context_core.h" |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 | 61 |
62 bool EmbeddedWorkerDevToolsAgentHost::IsWorker() const { | 62 bool EmbeddedWorkerDevToolsAgentHost::IsWorker() const { |
63 return true; | 63 return true; |
64 } | 64 } |
65 | 65 |
66 DevToolsAgentHost::Type EmbeddedWorkerDevToolsAgentHost::GetType() { | 66 DevToolsAgentHost::Type EmbeddedWorkerDevToolsAgentHost::GetType() { |
67 return shared_worker_ ? TYPE_SHARED_WORKER : TYPE_SERVICE_WORKER; | 67 return shared_worker_ ? TYPE_SHARED_WORKER : TYPE_SERVICE_WORKER; |
68 } | 68 } |
69 | 69 |
70 std::string EmbeddedWorkerDevToolsAgentHost::GetTitle() { | 70 std::string EmbeddedWorkerDevToolsAgentHost::GetTitle() { |
71 return shared_worker_ ? base::UTF16ToUTF8(shared_worker_->name()) : ""; | 71 if (shared_worker_ && shared_worker_->name().length()) |
| 72 return base::UTF16ToUTF8(shared_worker_->name()); |
| 73 if (RenderProcessHost* host = RenderProcessHost::FromID(worker_id_.first)) { |
| 74 return base::StringPrintf("Worker pid:%d", |
| 75 base::GetProcId(host->GetHandle())); |
| 76 } |
| 77 return ""; |
72 } | 78 } |
73 | 79 |
74 GURL EmbeddedWorkerDevToolsAgentHost::GetURL() { | 80 GURL EmbeddedWorkerDevToolsAgentHost::GetURL() { |
75 if (shared_worker_) | 81 if (shared_worker_) |
76 return shared_worker_->url(); | 82 return shared_worker_->url(); |
77 if (service_worker_) | 83 if (service_worker_) |
78 return service_worker_->url(); | 84 return service_worker_->url(); |
79 return GURL(); | 85 return GURL(); |
80 } | 86 } |
81 | 87 |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 const std::string& message) { | 222 const std::string& message) { |
217 SendMessageToClient(message); | 223 SendMessageToClient(message); |
218 } | 224 } |
219 | 225 |
220 void EmbeddedWorkerDevToolsAgentHost::OnSaveAgentRuntimeState( | 226 void EmbeddedWorkerDevToolsAgentHost::OnSaveAgentRuntimeState( |
221 const std::string& state) { | 227 const std::string& state) { |
222 saved_agent_state_ = state; | 228 saved_agent_state_ = state; |
223 } | 229 } |
224 | 230 |
225 } // namespace content | 231 } // namespace content |
OLD | NEW |