| 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/network/web_socket_impl.h" | 5 #include "mojo/services/network/web_socket_impl.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 net::WebSocketFrameHeader::OpCode type, | 175 net::WebSocketFrameHeader::OpCode type, |
| 176 uint32_t num_bytes, | 176 uint32_t num_bytes, |
| 177 const char* buffer) { | 177 const char* buffer) { |
| 178 client_->DidReceiveData( | 178 client_->DidReceiveData( |
| 179 fin, ConvertTo<WebSocket::MessageType>(type), num_bytes); | 179 fin, ConvertTo<WebSocket::MessageType>(type), num_bytes); |
| 180 } | 180 } |
| 181 | 181 |
| 182 } // namespace mojo | 182 } // namespace mojo |
| 183 | 183 |
| 184 WebSocketImpl::WebSocketImpl(NetworkContext* context, | 184 WebSocketImpl::WebSocketImpl(NetworkContext* context, |
| 185 scoped_ptr<mojo::AppRefCount> app_refcount, | 185 scoped_ptr<mojo::MessageLoopRef> app_refcount, |
| 186 InterfaceRequest<WebSocket> request) | 186 InterfaceRequest<WebSocket> request) |
| 187 : context_(context), | 187 : context_(context), |
| 188 app_refcount_(std::move(app_refcount)), | 188 app_refcount_(std::move(app_refcount)), |
| 189 binding_(this, std::move(request)) {} | 189 binding_(this, std::move(request)) {} |
| 190 | 190 |
| 191 WebSocketImpl::~WebSocketImpl() { | 191 WebSocketImpl::~WebSocketImpl() { |
| 192 } | 192 } |
| 193 | 193 |
| 194 void WebSocketImpl::Connect(const String& url, | 194 void WebSocketImpl::Connect(const String& url, |
| 195 Array<String> protocols, | 195 Array<String> protocols, |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 233 uint32_t num_bytes, | 233 uint32_t num_bytes, |
| 234 const char* data) { | 234 const char* data) { |
| 235 std::vector<char> buffer(num_bytes); | 235 std::vector<char> buffer(num_bytes); |
| 236 memcpy(&buffer[0], data, num_bytes); | 236 memcpy(&buffer[0], data, num_bytes); |
| 237 DCHECK(channel_); | 237 DCHECK(channel_); |
| 238 channel_->SendFrame( | 238 channel_->SendFrame( |
| 239 fin, ConvertTo<net::WebSocketFrameHeader::OpCode>(type), buffer); | 239 fin, ConvertTo<net::WebSocketFrameHeader::OpCode>(type), buffer); |
| 240 } | 240 } |
| 241 | 241 |
| 242 } // namespace mojo | 242 } // namespace mojo |
| OLD | NEW |