Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(136)

Side by Side Diff: net/websockets/websocket_basic_handshake_stream.cc

Issue 240873003: Create WebSocketTransportClientSocketPool (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Minor fixes and comment tidying. Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/websockets/websocket_basic_handshake_stream.h" 5 #include "net/websockets/websocket_basic_handshake_stream.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <iterator> 8 #include <iterator>
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
(...skipping 10 matching lines...) Expand all
21 #include "base/strings/stringprintf.h" 21 #include "base/strings/stringprintf.h"
22 #include "base/time/time.h" 22 #include "base/time/time.h"
23 #include "crypto/random.h" 23 #include "crypto/random.h"
24 #include "net/http/http_request_headers.h" 24 #include "net/http/http_request_headers.h"
25 #include "net/http/http_request_info.h" 25 #include "net/http/http_request_info.h"
26 #include "net/http/http_response_body_drainer.h" 26 #include "net/http/http_response_body_drainer.h"
27 #include "net/http/http_response_headers.h" 27 #include "net/http/http_response_headers.h"
28 #include "net/http/http_status_code.h" 28 #include "net/http/http_status_code.h"
29 #include "net/http/http_stream_parser.h" 29 #include "net/http/http_stream_parser.h"
30 #include "net/socket/client_socket_handle.h" 30 #include "net/socket/client_socket_handle.h"
31 #include "net/socket/websocket_transport_client_socket_pool.h"
31 #include "net/websockets/websocket_basic_stream.h" 32 #include "net/websockets/websocket_basic_stream.h"
32 #include "net/websockets/websocket_deflate_predictor.h" 33 #include "net/websockets/websocket_deflate_predictor.h"
33 #include "net/websockets/websocket_deflate_predictor_impl.h" 34 #include "net/websockets/websocket_deflate_predictor_impl.h"
34 #include "net/websockets/websocket_deflate_stream.h" 35 #include "net/websockets/websocket_deflate_stream.h"
35 #include "net/websockets/websocket_deflater.h" 36 #include "net/websockets/websocket_deflater.h"
36 #include "net/websockets/websocket_extension_parser.h" 37 #include "net/websockets/websocket_extension_parser.h"
37 #include "net/websockets/websocket_handshake_constants.h" 38 #include "net/websockets/websocket_handshake_constants.h"
38 #include "net/websockets/websocket_handshake_handler.h" 39 #include "net/websockets/websocket_handshake_handler.h"
39 #include "net/websockets/websocket_handshake_request_info.h" 40 #include "net/websockets/websocket_handshake_request_info.h"
40 #include "net/websockets/websocket_handshake_response_info.h" 41 #include "net/websockets/websocket_handshake_response_info.h"
(...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after
491 492
492 void WebSocketBasicHandshakeStream::SetPriority(RequestPriority priority) { 493 void WebSocketBasicHandshakeStream::SetPriority(RequestPriority priority) {
493 // TODO(ricea): See TODO comment in HttpBasicStream::SetPriority(). If it is 494 // TODO(ricea): See TODO comment in HttpBasicStream::SetPriority(). If it is
494 // gone, then copy whatever has happened there over here. 495 // gone, then copy whatever has happened there over here.
495 } 496 }
496 497
497 scoped_ptr<WebSocketStream> WebSocketBasicHandshakeStream::Upgrade() { 498 scoped_ptr<WebSocketStream> WebSocketBasicHandshakeStream::Upgrade() {
498 // The HttpStreamParser object has a pointer to our ClientSocketHandle. Make 499 // The HttpStreamParser object has a pointer to our ClientSocketHandle. Make
499 // sure it does not touch it again before it is destroyed. 500 // sure it does not touch it again before it is destroyed.
500 state_.DeleteParser(); 501 state_.DeleteParser();
502 WebSocketTransportClientSocketPool::UnlockEndpoint(state_.connection());
501 scoped_ptr<WebSocketStream> basic_stream( 503 scoped_ptr<WebSocketStream> basic_stream(
502 new WebSocketBasicStream(state_.ReleaseConnection(), 504 new WebSocketBasicStream(state_.ReleaseConnection(),
503 state_.read_buf(), 505 state_.read_buf(),
504 sub_protocol_, 506 sub_protocol_,
505 extensions_)); 507 extensions_));
506 DCHECK(extension_params_.get()); 508 DCHECK(extension_params_.get());
507 if (extension_params_->deflate_enabled) { 509 if (extension_params_->deflate_enabled) {
508 return scoped_ptr<WebSocketStream>( 510 return scoped_ptr<WebSocketStream>(
509 new WebSocketDeflateStream(basic_stream.Pass(), 511 new WebSocketDeflateStream(basic_stream.Pass(),
510 extension_params_->deflate_mode, 512 extension_params_->deflate_mode,
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
610 &extensions_, 612 &extensions_,
611 &failure_message_, 613 &failure_message_,
612 extension_params_.get())) { 614 extension_params_.get())) {
613 return OK; 615 return OK;
614 } 616 }
615 failure_message_ = "Error during WebSocket handshake: " + failure_message_; 617 failure_message_ = "Error during WebSocket handshake: " + failure_message_;
616 return ERR_INVALID_RESPONSE; 618 return ERR_INVALID_RESPONSE;
617 } 619 }
618 620
619 } // namespace net 621 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698