Chromium Code Reviews| 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/worker_devtools_agent_host.h" | 5 #include "content/browser/devtools/worker_devtools_agent_host.h" |
| 6 | 6 |
| 7 #include "content/browser/devtools/ipc_devtools_agent_host.h" | 7 #include "content/browser/devtools/ipc_devtools_agent_host.h" |
| 8 #include "content/browser/devtools/protocol/devtools_protocol_handler.h" | 8 #include "content/browser/devtools/protocol/devtools_protocol_handler.h" |
| 9 #include "content/public/browser/browser_thread.h" | 9 #include "content/public/browser/browser_thread.h" |
| 10 #include "content/public/browser/render_process_host.h" | 10 #include "content/public/browser/render_process_host.h" |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 58 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 58 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 59 bool handled = true; | 59 bool handled = true; |
| 60 IPC_BEGIN_MESSAGE_MAP(WorkerDevToolsAgentHost, msg) | 60 IPC_BEGIN_MESSAGE_MAP(WorkerDevToolsAgentHost, msg) |
| 61 IPC_MESSAGE_HANDLER(DevToolsClientMsg_DispatchOnInspectorFrontend, | 61 IPC_MESSAGE_HANDLER(DevToolsClientMsg_DispatchOnInspectorFrontend, |
| 62 OnDispatchOnInspectorFrontend) | 62 OnDispatchOnInspectorFrontend) |
| 63 IPC_MESSAGE_UNHANDLED(handled = false) | 63 IPC_MESSAGE_UNHANDLED(handled = false) |
| 64 IPC_END_MESSAGE_MAP() | 64 IPC_END_MESSAGE_MAP() |
| 65 return handled; | 65 return handled; |
| 66 } | 66 } |
| 67 | 67 |
| 68 void WorkerDevToolsAgentHost::PauseForDebugOnStart() { | |
| 69 state_ = WORKER_PAUSED_FOR_DEBUG_ON_START; | |
|
dgozman
2015/03/08 07:49:56
DCHECK that state is WORKER_TERMINATED or WORKER_U
pfeldman
2015/03/08 08:30:57
In fact, only UNINSPECTED.
| |
| 70 } | |
| 71 | |
| 72 bool WorkerDevToolsAgentHost::IsPausedForDebugOnStart() { | |
| 73 return state_ == WORKER_PAUSED_FOR_DEBUG_ON_START; | |
| 74 } | |
| 75 | |
| 68 void WorkerDevToolsAgentHost::WorkerReadyForInspection() { | 76 void WorkerDevToolsAgentHost::WorkerReadyForInspection() { |
| 69 if (state_ == WORKER_PAUSED_FOR_DEBUG_ON_START) { | 77 if (state_ == WORKER_PAUSED_FOR_REATTACH) { |
| 70 RenderProcessHost* rph = RenderProcessHost::FromID(worker_id_.first); | |
| 71 Inspect(rph->GetBrowserContext()); | |
|
dgozman
2015/03/08 07:49:56
This seems to regress shared workers.
pfeldman
2015/03/08 08:30:57
This code only works for ServiceWorkers.
| |
| 72 } else if (state_ == WORKER_PAUSED_FOR_REATTACH) { | |
| 73 DCHECK(IsAttached()); | 78 DCHECK(IsAttached()); |
|
pfeldman
2015/03/08 08:30:57
This code only works for SharedWorkers.
We only "
| |
| 74 state_ = WORKER_INSPECTED; | 79 state_ = WORKER_INSPECTED; |
| 75 AttachToWorker(); | 80 AttachToWorker(); |
| 76 Reattach(); | 81 Reattach(); |
| 77 } | 82 } |
| 78 } | 83 } |
| 79 | 84 |
| 80 void WorkerDevToolsAgentHost::WorkerRestarted(WorkerId worker_id) { | 85 void WorkerDevToolsAgentHost::WorkerRestarted(WorkerId worker_id) { |
| 81 DCHECK_EQ(WORKER_TERMINATED, state_); | 86 DCHECK_EQ(WORKER_TERMINATED, state_); |
| 82 state_ = IsAttached() ? WORKER_PAUSED_FOR_REATTACH : WORKER_UNINSPECTED; | 87 state_ = IsAttached() ? WORKER_PAUSED_FOR_REATTACH : WORKER_UNINSPECTED; |
| 83 worker_id_ = worker_id; | 88 worker_id_ = worker_id; |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 132 | 137 |
| 133 void WorkerDevToolsAgentHost::OnDispatchOnInspectorFrontend( | 138 void WorkerDevToolsAgentHost::OnDispatchOnInspectorFrontend( |
| 134 const DevToolsMessageChunk& message) { | 139 const DevToolsMessageChunk& message) { |
| 135 if (!IsAttached()) | 140 if (!IsAttached()) |
| 136 return; | 141 return; |
| 137 | 142 |
| 138 ProcessChunkedMessageFromAgent(message); | 143 ProcessChunkedMessageFromAgent(message); |
| 139 } | 144 } |
| 140 | 145 |
| 141 } // namespace content | 146 } // namespace content |
| OLD | NEW |