OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/render_frame_devtools_agent_host.h" | 5 #include "content/browser/devtools/render_frame_devtools_agent_host.h" |
6 | 6 |
7 #include <tuple> | 7 #include <tuple> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/guid.h" | 10 #include "base/guid.h" |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 bool | 235 bool |
236 RenderFrameDevToolsAgentHost::FrameHostHolder::ProcessChunkedMessageFromAgent( | 236 RenderFrameDevToolsAgentHost::FrameHostHolder::ProcessChunkedMessageFromAgent( |
237 const DevToolsMessageChunk& chunk) { | 237 const DevToolsMessageChunk& chunk) { |
238 return chunk_processor_.ProcessChunkedMessageFromAgent(chunk); | 238 return chunk_processor_.ProcessChunkedMessageFromAgent(chunk); |
239 } | 239 } |
240 | 240 |
241 void RenderFrameDevToolsAgentHost::FrameHostHolder::SendMessageToClient( | 241 void RenderFrameDevToolsAgentHost::FrameHostHolder::SendMessageToClient( |
242 int session_id, | 242 int session_id, |
243 const std::string& message) { | 243 const std::string& message) { |
244 int id = chunk_processor_.last_call_id(); | 244 int id = chunk_processor_.last_call_id(); |
| 245 PendingMessage sent_message = sent_messages_[id]; |
| 246 sent_messages_.erase(id); |
245 if (suspended_) { | 247 if (suspended_) { |
246 sent_messages_whose_reply_came_while_suspended_[id] = sent_messages_[id]; | 248 sent_messages_whose_reply_came_while_suspended_[id] = sent_message; |
247 pending_messages_.push_back(std::make_pair(session_id, message)); | 249 pending_messages_.push_back(std::make_pair(session_id, message)); |
248 } else { | 250 } else { |
249 agent_->SendMessageToClient(session_id, message); | 251 agent_->SendMessageToClient(session_id, message); |
| 252 // |this| may be deleted at this point. |
250 } | 253 } |
251 sent_messages_.erase(id); | |
252 } | 254 } |
253 | 255 |
254 void RenderFrameDevToolsAgentHost::FrameHostHolder::Suspend() { | 256 void RenderFrameDevToolsAgentHost::FrameHostHolder::Suspend() { |
255 suspended_ = true; | 257 suspended_ = true; |
256 } | 258 } |
257 | 259 |
258 void RenderFrameDevToolsAgentHost::FrameHostHolder::Resume() { | 260 void RenderFrameDevToolsAgentHost::FrameHostHolder::Resume() { |
259 suspended_ = false; | 261 suspended_ = false; |
260 for (const auto& pair : pending_messages_) | 262 for (const auto& pair : pending_messages_) |
261 agent_->SendMessageToClient(pair.first, pair.second); | 263 agent_->SendMessageToClient(pair.first, pair.second); |
(...skipping 947 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1209 RenderFrameHost* host) { | 1211 RenderFrameHost* host) { |
1210 return (current_ && current_->host() == host) || | 1212 return (current_ && current_->host() == host) || |
1211 (pending_ && pending_->host() == host); | 1213 (pending_ && pending_->host() == host); |
1212 } | 1214 } |
1213 | 1215 |
1214 bool RenderFrameDevToolsAgentHost::IsChildFrame() { | 1216 bool RenderFrameDevToolsAgentHost::IsChildFrame() { |
1215 return current_ && current_->host()->GetParent(); | 1217 return current_ && current_->host()->GetParent(); |
1216 } | 1218 } |
1217 | 1219 |
1218 } // namespace content | 1220 } // namespace content |
OLD | NEW |