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::OldCompletionCallback::Run<int>, | 324 cb = base::Bind(&net::OldCompletionCallbackAdapter, callback); |
325 base::Unretained(callback)); | |
326 } | 325 } |
327 pending_reqs_.push_front(PendingReq( | 326 pending_reqs_.push_front(PendingReq( |
328 PendingReq::TYPE_READ_METADATA, fill_handshake_buf_.get(), | 327 PendingReq::TYPE_READ_METADATA, fill_handshake_buf_.get(), |
329 cb)); | 328 cb)); |
330 ConsiderTransportRead(); | 329 ConsiderTransportRead(); |
331 return net::ERR_IO_PENDING; | 330 return net::ERR_IO_PENDING; |
332 } | 331 } |
333 | 332 |
334 std::deque<PendingReq>::iterator GetPendingReq(PendingReq::Type type) { | 333 std::deque<PendingReq>::iterator GetPendingReq(PendingReq::Type type) { |
335 for (std::deque<PendingReq>::iterator it = pending_reqs_.begin(); | 334 for (std::deque<PendingReq>::iterator it = pending_reqs_.begin(); |
(...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
896 | 895 |
897 WebSocketServerSocket* CreateWebSocketServerSocket( | 896 WebSocketServerSocket* CreateWebSocketServerSocket( |
898 Socket* transport_socket, WebSocketServerSocket::Delegate* delegate) { | 897 Socket* transport_socket, WebSocketServerSocket::Delegate* delegate) { |
899 return new WebSocketServerSocketImpl(transport_socket, delegate); | 898 return new WebSocketServerSocketImpl(transport_socket, delegate); |
900 } | 899 } |
901 | 900 |
902 WebSocketServerSocket::~WebSocketServerSocket() { | 901 WebSocketServerSocket::~WebSocketServerSocket() { |
903 } | 902 } |
904 | 903 |
905 } // namespace net; | 904 } // namespace net; |
OLD | NEW |