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 // An implementation of WebSocketStreamHandle. | 5 // An implementation of WebSocketStreamHandle. |
6 | 6 |
7 #include "webkit/child/websocketstreamhandle_impl.h" | 7 #include "webkit/child/websocketstreamhandle_impl.h" |
8 | 8 |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 WebSocketStreamHandleImpl::Context::Context(WebSocketStreamHandleImpl* handle) | 79 WebSocketStreamHandleImpl::Context::Context(WebSocketStreamHandleImpl* handle) |
80 : handle_(handle), | 80 : handle_(handle), |
81 client_(NULL) { | 81 client_(NULL) { |
82 } | 82 } |
83 | 83 |
84 void WebSocketStreamHandleImpl::Context::Connect( | 84 void WebSocketStreamHandleImpl::Context::Connect( |
85 const WebURL& url, | 85 const WebURL& url, |
86 WebKitPlatformSupportImpl* platform) { | 86 WebKitPlatformSupportImpl* platform) { |
87 VLOG(1) << "Connect url=" << url; | 87 VLOG(1) << "Connect url=" << url; |
88 DCHECK(!bridge_.get()); | 88 DCHECK(!bridge_.get()); |
89 bridge_ = platform->CreateWebSocketBridge(handle_, this); | 89 bridge_ = platform->CreateWebSocketStreamBridge(handle_, this); |
90 AddRef(); // Will be released by DidClose(). | 90 AddRef(); // Will be released by DidClose(). |
91 bridge_->Connect(url); | 91 bridge_->Connect(url); |
92 } | 92 } |
93 | 93 |
94 bool WebSocketStreamHandleImpl::Context::Send(const WebData& data) { | 94 bool WebSocketStreamHandleImpl::Context::Send(const WebData& data) { |
95 VLOG(1) << "Send data.size=" << data.size(); | 95 VLOG(1) << "Send data.size=" << data.size(); |
96 DCHECK(bridge_.get()); | 96 DCHECK(bridge_.get()); |
97 return bridge_->Send( | 97 return bridge_->Send( |
98 std::vector<char>(data.data(), data.data() + data.size())); | 98 std::vector<char>(data.data(), data.data() + data.size())); |
99 } | 99 } |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 | 186 |
187 bool WebSocketStreamHandleImpl::send(const WebData& data) { | 187 bool WebSocketStreamHandleImpl::send(const WebData& data) { |
188 return context_->Send(data); | 188 return context_->Send(data); |
189 } | 189 } |
190 | 190 |
191 void WebSocketStreamHandleImpl::close() { | 191 void WebSocketStreamHandleImpl::close() { |
192 context_->Close(); | 192 context_->Close(); |
193 } | 193 } |
194 | 194 |
195 } // namespace webkit_glue | 195 } // namespace webkit_glue |
OLD | NEW |