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/devtools_agent_host_impl.h" | 5 #include "content/browser/devtools/devtools_agent_host_impl.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
102 scoped_refptr<DevToolsAgentHost> DevToolsAgentHost::Create( | 102 scoped_refptr<DevToolsAgentHost> DevToolsAgentHost::Create( |
103 DevToolsExternalAgentProxyDelegate* delegate) { | 103 DevToolsExternalAgentProxyDelegate* delegate) { |
104 return new ForwardingAgentHost(delegate); | 104 return new ForwardingAgentHost(delegate); |
105 } | 105 } |
106 | 106 |
107 void DevToolsAgentHostImpl::AttachClient(DevToolsAgentHostClient* client) { | 107 void DevToolsAgentHostImpl::AttachClient(DevToolsAgentHostClient* client) { |
108 scoped_refptr<DevToolsAgentHostImpl> protect(this); | 108 scoped_refptr<DevToolsAgentHostImpl> protect(this); |
109 if (client_) { | 109 if (client_) { |
110 client_->AgentHostClosed(this, true); | 110 client_->AgentHostClosed(this, true); |
111 Detach(); | 111 Detach(); |
112 io_context_.DiscardAllStreams(); | |
pfeldman
2015/08/24 18:17:55
You are calling it from 2(3) places. Introduce Inn
| |
112 } | 113 } |
113 client_ = client; | 114 client_ = client; |
114 Attach(); | 115 Attach(); |
115 } | 116 } |
116 | 117 |
117 void DevToolsAgentHostImpl::DetachClient() { | 118 void DevToolsAgentHostImpl::DetachClient() { |
118 if (!client_) | 119 if (!client_) |
119 return; | 120 return; |
120 | 121 |
121 scoped_refptr<DevToolsAgentHostImpl> protect(this); | 122 scoped_refptr<DevToolsAgentHostImpl> protect(this); |
122 client_ = NULL; | 123 client_ = NULL; |
123 Detach(); | 124 Detach(); |
125 io_context_.DiscardAllStreams(); | |
124 } | 126 } |
125 | 127 |
126 bool DevToolsAgentHostImpl::IsAttached() { | 128 bool DevToolsAgentHostImpl::IsAttached() { |
127 return !!client_; | 129 return !!client_; |
128 } | 130 } |
129 | 131 |
130 void DevToolsAgentHostImpl::InspectElement(int x, int y) { | 132 void DevToolsAgentHostImpl::InspectElement(int x, int y) { |
131 } | 133 } |
132 | 134 |
133 std::string DevToolsAgentHostImpl::GetId() { | 135 std::string DevToolsAgentHostImpl::GetId() { |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
260 | 262 |
261 if (chunk.is_last) { | 263 if (chunk.is_last) { |
262 CHECK(message_buffer_.size() == message_buffer_size_); | 264 CHECK(message_buffer_.size() == message_buffer_size_); |
263 callback_.Run(message_buffer_); | 265 callback_.Run(message_buffer_); |
264 message_buffer_ = std::string(); | 266 message_buffer_ = std::string(); |
265 message_buffer_size_ = 0; | 267 message_buffer_size_ = 0; |
266 } | 268 } |
267 } | 269 } |
268 | 270 |
269 } // namespace content | 271 } // namespace content |
OLD | NEW |