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

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

Issue 936953004: Add more targets to GN check. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: move net function Created 5 years, 10 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_stream.h" 5 #include "net/websockets/websocket_stream.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "base/metrics/sparse_histogram.h" 10 #include "base/metrics/sparse_histogram.h"
11 #include "base/profiler/scoped_tracker.h" 11 #include "base/profiler/scoped_tracker.h"
12 #include "base/strings/stringprintf.h" 12 #include "base/strings/stringprintf.h"
13 #include "base/time/time.h" 13 #include "base/time/time.h"
14 #include "base/timer/timer.h" 14 #include "base/timer/timer.h"
15 #include "net/base/load_flags.h" 15 #include "net/base/load_flags.h"
16 #include "net/http/http_request_headers.h" 16 #include "net/http/http_request_headers.h"
17 #include "net/http/http_response_headers.h" 17 #include "net/http/http_response_headers.h"
18 #include "net/http/http_status_code.h" 18 #include "net/http/http_status_code.h"
19 #include "net/url_request/redirect_info.h" 19 #include "net/url_request/redirect_info.h"
20 #include "net/url_request/url_request.h" 20 #include "net/url_request/url_request.h"
21 #include "net/url_request/url_request_context.h" 21 #include "net/url_request/url_request_context.h"
22 #include "net/websockets/websocket_errors.h" 22 #include "net/websockets/websocket_errors.h"
23 #include "net/websockets/websocket_event_interface.h" 23 #include "net/websockets/websocket_event_interface.h"
24 #include "net/websockets/websocket_handshake_constants.h" 24 #include "net/websockets/websocket_handshake_constants.h"
25 #include "net/websockets/websocket_handshake_stream_base.h" 25 #include "net/websockets/websocket_handshake_stream_base.h"
26 #include "net/websockets/websocket_handshake_stream_create_helper.h" 26 #include "net/websockets/websocket_handshake_stream_create_helper.h"
27 #include "net/websockets/websocket_test_util.h"
28 #include "url/gurl.h" 27 #include "url/gurl.h"
29 #include "url/origin.h" 28 #include "url/origin.h"
30 29
31 namespace net { 30 namespace net {
32 namespace { 31 namespace {
33 32
34 // The timeout duration of WebSocket handshake. 33 // The timeout duration of WebSocket handshake.
35 // It is defined as the same value as the TCP connection timeout value in 34 // It is defined as the same value as the TCP connection timeout value in
36 // net/socket/websocket_transport_client_socket_pool.cc to make it hard for 35 // net/socket/websocket_transport_client_socket_pool.cc to make it hard for
37 // JavaScript programs to recognize the timeout cause. 36 // JavaScript programs to recognize the timeout cause.
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 create_helper_); 113 create_helper_);
115 url_request_->SetLoadFlags(LOAD_DISABLE_CACHE | LOAD_BYPASS_CACHE); 114 url_request_->SetLoadFlags(LOAD_DISABLE_CACHE | LOAD_BYPASS_CACHE);
116 } 115 }
117 116
118 // Destroying this object destroys the URLRequest, which cancels the request 117 // Destroying this object destroys the URLRequest, which cancels the request
119 // and so terminates the handshake if it is incomplete. 118 // and so terminates the handshake if it is incomplete.
120 ~StreamRequestImpl() override {} 119 ~StreamRequestImpl() override {}
121 120
122 void Start(scoped_ptr<base::Timer> timer) { 121 void Start(scoped_ptr<base::Timer> timer) {
123 DCHECK(timer); 122 DCHECK(timer);
124 TimeDelta timeout(TimeDelta::FromSeconds( 123 base::TimeDelta timeout(base::TimeDelta::FromSeconds(
125 kHandshakeTimeoutIntervalInSeconds)); 124 kHandshakeTimeoutIntervalInSeconds));
126 timer_ = timer.Pass(); 125 timer_ = timer.Pass();
127 timer_->Start(FROM_HERE, timeout, 126 timer_->Start(FROM_HERE, timeout,
128 base::Bind(&StreamRequestImpl::OnTimeout, 127 base::Bind(&StreamRequestImpl::OnTimeout,
129 base::Unretained(this))); 128 base::Unretained(this)));
130 url_request_->Start(); 129 url_request_->Start();
131 } 130 }
132 131
133 void PerformUpgrade() { 132 void PerformUpgrade() {
134 DCHECK(timer_); 133 DCHECK(timer_);
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
363 connect_delegate->OnFinishOpeningHandshake(make_scoped_ptr( 362 connect_delegate->OnFinishOpeningHandshake(make_scoped_ptr(
364 new WebSocketHandshakeResponseInfo(url, 363 new WebSocketHandshakeResponseInfo(url,
365 headers->response_code(), 364 headers->response_code(),
366 headers->GetStatusText(), 365 headers->GetStatusText(),
367 headers, 366 headers,
368 response_time))); 367 response_time)));
369 } 368 }
370 } 369 }
371 370
372 } // namespace net 371 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698