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 "mojo/services/html_viewer/websockethandle_impl.h" | 5 #include "mojo/services/html_viewer/websockethandle_impl.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 WebSocketHandleImpl* handle_; | 138 WebSocketHandleImpl* handle_; |
139 blink::WebSocketHandleClient* client_; | 139 blink::WebSocketHandleClient* client_; |
140 ScopedDataPipeConsumerHandle receive_stream_; | 140 ScopedDataPipeConsumerHandle receive_stream_; |
141 scoped_ptr<WebSocketReadQueue> read_queue_; | 141 scoped_ptr<WebSocketReadQueue> read_queue_; |
142 | 142 |
143 DISALLOW_COPY_AND_ASSIGN(WebSocketClientImpl); | 143 DISALLOW_COPY_AND_ASSIGN(WebSocketClientImpl); |
144 }; | 144 }; |
145 | 145 |
146 WebSocketHandleImpl::WebSocketHandleImpl(NetworkService* network_service) | 146 WebSocketHandleImpl::WebSocketHandleImpl(NetworkService* network_service) |
147 : did_close_(false) { | 147 : did_close_(false) { |
148 network_service->CreateWebSocket(Get(&web_socket_)); | 148 network_service->CreateWebSocket(GetProxy(&web_socket_)); |
149 } | 149 } |
150 | 150 |
151 WebSocketHandleImpl::~WebSocketHandleImpl() { | 151 WebSocketHandleImpl::~WebSocketHandleImpl() { |
152 if (!did_close_) { | 152 if (!did_close_) { |
153 // The connection is abruptly disconnected by the renderer without | 153 // The connection is abruptly disconnected by the renderer without |
154 // closing handshake. | 154 // closing handshake. |
155 web_socket_->Close(WebSocket::kAbnormalCloseCode, String()); | 155 web_socket_->Close(WebSocket::kAbnormalCloseCode, String()); |
156 } | 156 } |
157 } | 157 } |
158 | 158 |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 const char* data) { | 209 const char* data) { |
210 web_socket_->Send(fin, ConvertTo<WebSocket::MessageType>(type), num_bytes); | 210 web_socket_->Send(fin, ConvertTo<WebSocket::MessageType>(type), num_bytes); |
211 } | 211 } |
212 | 212 |
213 void WebSocketHandleImpl::Disconnect() { | 213 void WebSocketHandleImpl::Disconnect() { |
214 did_close_ = true; | 214 did_close_ = true; |
215 client_.reset(); | 215 client_.reset(); |
216 } | 216 } |
217 | 217 |
218 } // namespace mojo | 218 } // namespace mojo |
OLD | NEW |