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

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

Issue 1320683003: Move logic to figure out if a socket can be reused into HttpStream. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years, 3 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 444 matching lines...) Expand 10 before | Expand all | Expand 10 after
455 // This class ignores the value of |not_reusable| and never lets the socket be 455 // This class ignores the value of |not_reusable| and never lets the socket be
456 // re-used. 456 // re-used.
457 if (parser()) 457 if (parser())
458 parser()->Close(true); 458 parser()->Close(true);
459 } 459 }
460 460
461 bool WebSocketBasicHandshakeStream::IsResponseBodyComplete() const { 461 bool WebSocketBasicHandshakeStream::IsResponseBodyComplete() const {
462 return parser()->IsResponseBodyComplete(); 462 return parser()->IsResponseBodyComplete();
463 } 463 }
464 464
465 bool WebSocketBasicHandshakeStream::CanFindEndOfResponse() const {
466 return parser() && parser()->CanFindEndOfResponse();
467 }
468
469 bool WebSocketBasicHandshakeStream::IsConnectionReused() const { 465 bool WebSocketBasicHandshakeStream::IsConnectionReused() const {
470 return parser()->IsConnectionReused(); 466 return parser()->IsConnectionReused();
471 } 467 }
472 468
473 void WebSocketBasicHandshakeStream::SetConnectionReused() { 469 void WebSocketBasicHandshakeStream::SetConnectionReused() {
474 parser()->SetConnectionReused(); 470 parser()->SetConnectionReused();
475 } 471 }
476 472
477 bool WebSocketBasicHandshakeStream::IsConnectionReusable() const { 473 bool WebSocketBasicHandshakeStream::CanReuseConnection() const {
478 return false; 474 return false;
479 } 475 }
480 476
481 int64 WebSocketBasicHandshakeStream::GetTotalReceivedBytes() const { 477 int64 WebSocketBasicHandshakeStream::GetTotalReceivedBytes() const {
482 return 0; 478 return 0;
483 } 479 }
484 480
485 bool WebSocketBasicHandshakeStream::GetLoadTimingInfo( 481 bool WebSocketBasicHandshakeStream::GetLoadTimingInfo(
486 LoadTimingInfo* load_timing_info) const { 482 LoadTimingInfo* load_timing_info) const {
487 return state_.connection()->GetLoadTimingInfo(IsConnectionReused(), 483 return state_.connection()->GetLoadTimingInfo(IsConnectionReused(),
488 load_timing_info); 484 load_timing_info);
489 } 485 }
490 486
491 void WebSocketBasicHandshakeStream::GetSSLInfo(SSLInfo* ssl_info) { 487 void WebSocketBasicHandshakeStream::GetSSLInfo(SSLInfo* ssl_info) {
492 parser()->GetSSLInfo(ssl_info); 488 parser()->GetSSLInfo(ssl_info);
493 } 489 }
494 490
495 void WebSocketBasicHandshakeStream::GetSSLCertRequestInfo( 491 void WebSocketBasicHandshakeStream::GetSSLCertRequestInfo(
496 SSLCertRequestInfo* cert_request_info) { 492 SSLCertRequestInfo* cert_request_info) {
497 parser()->GetSSLCertRequestInfo(cert_request_info); 493 parser()->GetSSLCertRequestInfo(cert_request_info);
498 } 494 }
499 495
500 bool WebSocketBasicHandshakeStream::IsSpdyHttpStream() const { return false; }
501
502 void WebSocketBasicHandshakeStream::Drain(HttpNetworkSession* session) { 496 void WebSocketBasicHandshakeStream::Drain(HttpNetworkSession* session) {
503 HttpResponseBodyDrainer* drainer = new HttpResponseBodyDrainer(this); 497 HttpResponseBodyDrainer* drainer = new HttpResponseBodyDrainer(this);
504 drainer->Start(session); 498 drainer->Start(session);
505 // |drainer| will delete itself. 499 // |drainer| will delete itself.
506 } 500 }
507 501
508 void WebSocketBasicHandshakeStream::SetPriority(RequestPriority priority) { 502 void WebSocketBasicHandshakeStream::SetPriority(RequestPriority priority) {
509 // TODO(ricea): See TODO comment in HttpBasicStream::SetPriority(). If it is 503 // TODO(ricea): See TODO comment in HttpBasicStream::SetPriority(). If it is
510 // gone, then copy whatever has happened there over here. 504 // gone, then copy whatever has happened there over here.
511 } 505 }
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
647 set_failure_message("Error during WebSocket handshake: " + failure_message); 641 set_failure_message("Error during WebSocket handshake: " + failure_message);
648 return ERR_INVALID_RESPONSE; 642 return ERR_INVALID_RESPONSE;
649 } 643 }
650 644
651 void WebSocketBasicHandshakeStream::set_failure_message( 645 void WebSocketBasicHandshakeStream::set_failure_message(
652 const std::string& failure_message) { 646 const std::string& failure_message) {
653 *failure_message_ = failure_message; 647 *failure_message_ = failure_message;
654 } 648 }
655 649
656 } // namespace net 650 } // namespace net
OLDNEW
« net/http/http_stream.h ('K') | « net/websockets/websocket_basic_handshake_stream.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698