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/devtools_protocol_handler.h" | 7 #include "content/browser/devtools/devtools_protocol_handler.h" |
| 8 #include "content/browser/devtools/protocol/schema_handler.h" |
8 #include "content/public/browser/browser_thread.h" | 9 #include "content/public/browser/browser_thread.h" |
9 #include "content/public/browser/render_process_host.h" | 10 #include "content/public/browser/render_process_host.h" |
10 | 11 |
11 namespace content { | 12 namespace content { |
12 | 13 |
13 BrowserContext* WorkerDevToolsAgentHost::GetBrowserContext() { | 14 BrowserContext* WorkerDevToolsAgentHost::GetBrowserContext() { |
14 RenderProcessHost* rph = RenderProcessHost::FromID(worker_id_.first); | 15 RenderProcessHost* rph = RenderProcessHost::FromID(worker_id_.first); |
15 return rph ? rph->GetBrowserContext() : nullptr; | 16 return rph ? rph->GetBrowserContext() : nullptr; |
16 } | 17 } |
17 | 18 |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 } | 113 } |
113 state_ = WORKER_TERMINATED; | 114 state_ = WORKER_TERMINATED; |
114 Release(); // Balanced in WorkerCreated(). | 115 Release(); // Balanced in WorkerCreated(). |
115 } | 116 } |
116 | 117 |
117 bool WorkerDevToolsAgentHost::IsTerminated() { | 118 bool WorkerDevToolsAgentHost::IsTerminated() { |
118 return state_ == WORKER_TERMINATED; | 119 return state_ == WORKER_TERMINATED; |
119 } | 120 } |
120 | 121 |
121 WorkerDevToolsAgentHost::WorkerDevToolsAgentHost(WorkerId worker_id) | 122 WorkerDevToolsAgentHost::WorkerDevToolsAgentHost(WorkerId worker_id) |
122 : protocol_handler_(new DevToolsProtocolHandler(this)), | 123 : schema_handler_(new devtools::schema::SchemaHandler()), |
| 124 protocol_handler_(new DevToolsProtocolHandler(this)), |
123 chunk_processor_(base::Bind(&WorkerDevToolsAgentHost::SendMessageToClient, | 125 chunk_processor_(base::Bind(&WorkerDevToolsAgentHost::SendMessageToClient, |
124 base::Unretained(this))), | 126 base::Unretained(this))), |
125 state_(WORKER_UNINSPECTED), | 127 state_(WORKER_UNINSPECTED), |
126 worker_id_(worker_id) { | 128 worker_id_(worker_id) { |
| 129 protocol_handler_->dispatcher()->SetSchemaHandler(schema_handler_.get()); |
127 WorkerCreated(); | 130 WorkerCreated(); |
128 } | 131 } |
129 | 132 |
130 WorkerDevToolsAgentHost::~WorkerDevToolsAgentHost() { | 133 WorkerDevToolsAgentHost::~WorkerDevToolsAgentHost() { |
131 DCHECK_EQ(WORKER_TERMINATED, state_); | 134 DCHECK_EQ(WORKER_TERMINATED, state_); |
132 } | 135 } |
133 | 136 |
134 void WorkerDevToolsAgentHost::OnAttachedStateChanged(bool attached) { | 137 void WorkerDevToolsAgentHost::OnAttachedStateChanged(bool attached) { |
135 } | 138 } |
136 | 139 |
(...skipping 13 matching lines...) Expand all Loading... |
150 | 153 |
151 void WorkerDevToolsAgentHost::OnDispatchOnInspectorFrontend( | 154 void WorkerDevToolsAgentHost::OnDispatchOnInspectorFrontend( |
152 const DevToolsMessageChunk& message) { | 155 const DevToolsMessageChunk& message) { |
153 if (!IsAttached()) | 156 if (!IsAttached()) |
154 return; | 157 return; |
155 | 158 |
156 chunk_processor_.ProcessChunkedMessageFromAgent(message); | 159 chunk_processor_.ProcessChunkedMessageFromAgent(message); |
157 } | 160 } |
158 | 161 |
159 } // namespace content | 162 } // namespace content |
OLD | NEW |