OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "net/socket/web_socket_server_socket.h" | 5 #include "net/socket/web_socket_server_socket.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <deque> | 8 #include <deque> |
9 #include <limits> | 9 #include <limits> |
10 #include <map> | 10 #include <map> |
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
314 return transport_socket_->SetSendBufferSize(size); | 314 return transport_socket_->SetSendBufferSize(size); |
315 } | 315 } |
316 | 316 |
317 // WebSocketServerSocket implementation. | 317 // WebSocketServerSocket implementation. |
318 virtual int Accept(net::OldCompletionCallback* callback) { | 318 virtual int Accept(net::OldCompletionCallback* callback) { |
319 if (phase_ != PHASE_NYMPH) | 319 if (phase_ != PHASE_NYMPH) |
320 return net::ERR_UNEXPECTED; | 320 return net::ERR_UNEXPECTED; |
321 phase_ = PHASE_HANDSHAKE; | 321 phase_ = PHASE_HANDSHAKE; |
322 net::CompletionCallback cb; | 322 net::CompletionCallback cb; |
323 if (callback) { | 323 if (callback) { |
324 cb = base::Bind(&net::OldCompletionCallbackAdapter, callback); | 324 cb = base::Bind(&net::OldCompletionCallback::Run<int>, |
| 325 base::Unretained(callback)); |
325 } | 326 } |
326 pending_reqs_.push_front(PendingReq( | 327 pending_reqs_.push_front(PendingReq( |
327 PendingReq::TYPE_READ_METADATA, fill_handshake_buf_.get(), | 328 PendingReq::TYPE_READ_METADATA, fill_handshake_buf_.get(), |
328 cb)); | 329 cb)); |
329 ConsiderTransportRead(); | 330 ConsiderTransportRead(); |
330 return net::ERR_IO_PENDING; | 331 return net::ERR_IO_PENDING; |
331 } | 332 } |
332 | 333 |
333 std::deque<PendingReq>::iterator GetPendingReq(PendingReq::Type type) { | 334 std::deque<PendingReq>::iterator GetPendingReq(PendingReq::Type type) { |
334 for (std::deque<PendingReq>::iterator it = pending_reqs_.begin(); | 335 for (std::deque<PendingReq>::iterator it = pending_reqs_.begin(); |
(...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
895 | 896 |
896 WebSocketServerSocket* CreateWebSocketServerSocket( | 897 WebSocketServerSocket* CreateWebSocketServerSocket( |
897 Socket* transport_socket, WebSocketServerSocket::Delegate* delegate) { | 898 Socket* transport_socket, WebSocketServerSocket::Delegate* delegate) { |
898 return new WebSocketServerSocketImpl(transport_socket, delegate); | 899 return new WebSocketServerSocketImpl(transport_socket, delegate); |
899 } | 900 } |
900 | 901 |
901 WebSocketServerSocket::~WebSocketServerSocket() { | 902 WebSocketServerSocket::~WebSocketServerSocket() { |
902 } | 903 } |
903 | 904 |
904 } // namespace net; | 905 } // namespace net; |
OLD | NEW |