| 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 DCHECK(state_ == WORKER_UNINSPECTED); |
| 70 state_ = WORKER_PAUSED_FOR_DEBUG_ON_START; |
| 71 } |
| 72 |
| 73 bool WorkerDevToolsAgentHost::IsPausedForDebugOnStart() { |
| 74 return state_ == WORKER_PAUSED_FOR_DEBUG_ON_START; |
| 75 } |
| 76 |
| 68 void WorkerDevToolsAgentHost::WorkerReadyForInspection() { | 77 void WorkerDevToolsAgentHost::WorkerReadyForInspection() { |
| 69 if (state_ == WORKER_PAUSED_FOR_DEBUG_ON_START) { | 78 if (state_ == WORKER_PAUSED_FOR_REATTACH) { |
| 70 RenderProcessHost* rph = RenderProcessHost::FromID(worker_id_.first); | |
| 71 Inspect(rph->GetBrowserContext()); | |
| 72 } else if (state_ == WORKER_PAUSED_FOR_REATTACH) { | |
| 73 DCHECK(IsAttached()); | 79 DCHECK(IsAttached()); |
| 74 state_ = WORKER_INSPECTED; | 80 state_ = WORKER_INSPECTED; |
| 75 AttachToWorker(); | 81 AttachToWorker(); |
| 76 Reattach(); | 82 Reattach(); |
| 77 } | 83 } |
| 78 } | 84 } |
| 79 | 85 |
| 80 void WorkerDevToolsAgentHost::WorkerRestarted(WorkerId worker_id) { | 86 void WorkerDevToolsAgentHost::WorkerRestarted(WorkerId worker_id) { |
| 81 DCHECK_EQ(WORKER_TERMINATED, state_); | 87 DCHECK_EQ(WORKER_TERMINATED, state_); |
| 82 state_ = IsAttached() ? WORKER_PAUSED_FOR_REATTACH : WORKER_UNINSPECTED; | 88 state_ = IsAttached() ? WORKER_PAUSED_FOR_REATTACH : WORKER_UNINSPECTED; |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 | 138 |
| 133 void WorkerDevToolsAgentHost::OnDispatchOnInspectorFrontend( | 139 void WorkerDevToolsAgentHost::OnDispatchOnInspectorFrontend( |
| 134 const DevToolsMessageChunk& message) { | 140 const DevToolsMessageChunk& message) { |
| 135 if (!IsAttached()) | 141 if (!IsAttached()) |
| 136 return; | 142 return; |
| 137 | 143 |
| 138 ProcessChunkedMessageFromAgent(message); | 144 ProcessChunkedMessageFromAgent(message); |
| 139 } | 145 } |
| 140 | 146 |
| 141 } // namespace content | 147 } // namespace content |
| OLD | NEW |