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

Side by Side Diff: google_apis/gcm/engine/connection_factory_impl.cc

Issue 332313003: Add Finch experiment for selectively bypassing proxies. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: make LOAD_NORMAL consistent Created 6 years, 5 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 (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 "google_apis/gcm/engine/connection_factory_impl.h" 5 #include "google_apis/gcm/engine/connection_factory_impl.h"
6 6
7 #include "base/message_loop/message_loop.h" 7 #include "base/message_loop/message_loop.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #include "base/metrics/sparse_histogram.h" 9 #include "base/metrics/sparse_histogram.h"
10 #include "google_apis/gcm/engine/connection_handler_impl.h" 10 #include "google_apis/gcm/engine/connection_handler_impl.h"
11 #include "google_apis/gcm/monitoring/gcm_stats_recorder.h" 11 #include "google_apis/gcm/monitoring/gcm_stats_recorder.h"
12 #include "google_apis/gcm/protocol/mcs.pb.h" 12 #include "google_apis/gcm/protocol/mcs.pb.h"
13 #include "net/base/load_flags.h"
13 #include "net/base/net_errors.h" 14 #include "net/base/net_errors.h"
14 #include "net/http/http_network_session.h" 15 #include "net/http/http_network_session.h"
15 #include "net/http/http_request_headers.h" 16 #include "net/http/http_request_headers.h"
16 #include "net/proxy/proxy_info.h" 17 #include "net/proxy/proxy_info.h"
17 #include "net/socket/client_socket_handle.h" 18 #include "net/socket/client_socket_handle.h"
18 #include "net/socket/client_socket_pool_manager.h" 19 #include "net/socket/client_socket_pool_manager.h"
19 #include "net/ssl/ssl_config_service.h" 20 #include "net/ssl/ssl_config_service.h"
20 21
21 namespace gcm { 22 namespace gcm {
22 23
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 DCHECK(!socket_handle_.socket()); 274 DCHECK(!socket_handle_.socket());
274 275
275 if (waiting_for_network_online_) 276 if (waiting_for_network_online_)
276 return; 277 return;
277 278
278 connecting_ = true; 279 connecting_ = true;
279 GURL current_endpoint = GetCurrentEndpoint(); 280 GURL current_endpoint = GetCurrentEndpoint();
280 recorder_->RecordConnectionInitiated(current_endpoint.host()); 281 recorder_->RecordConnectionInitiated(current_endpoint.host());
281 int status = network_session_->proxy_service()->ResolveProxy( 282 int status = network_session_->proxy_service()->ResolveProxy(
282 current_endpoint, 283 current_endpoint,
284 net::LOAD_NORMAL,
283 &proxy_info_, 285 &proxy_info_,
284 base::Bind(&ConnectionFactoryImpl::OnProxyResolveDone, 286 base::Bind(&ConnectionFactoryImpl::OnProxyResolveDone,
285 weak_ptr_factory_.GetWeakPtr()), 287 weak_ptr_factory_.GetWeakPtr()),
286 &pac_request_, 288 &pac_request_,
289 NULL,
287 bound_net_log_); 290 bound_net_log_);
288 if (status != net::ERR_IO_PENDING) 291 if (status != net::ERR_IO_PENDING)
289 OnProxyResolveDone(status); 292 OnProxyResolveDone(status);
290 } 293 }
291 294
292 void ConnectionFactoryImpl::InitHandler() { 295 void ConnectionFactoryImpl::InitHandler() {
293 // May be null in tests. 296 // May be null in tests.
294 mcs_proto::LoginRequest login_request; 297 mcs_proto::LoginRequest login_request;
295 if (!request_builder_.is_null()) { 298 if (!request_builder_.is_null()) {
296 request_builder_.Run(&login_request); 299 request_builder_.Run(&login_request);
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
490 } 493 }
491 494
492 net::SSLConfig ssl_config; 495 net::SSLConfig ssl_config;
493 network_session_->ssl_config_service()->GetSSLConfig(&ssl_config); 496 network_session_->ssl_config_service()->GetSSLConfig(&ssl_config);
494 if (proxy_info_.is_https() && ssl_config.send_client_cert) { 497 if (proxy_info_.is_https() && ssl_config.send_client_cert) {
495 network_session_->ssl_client_auth_cache()->Remove( 498 network_session_->ssl_client_auth_cache()->Remove(
496 proxy_info_.proxy_server().host_port_pair()); 499 proxy_info_.proxy_server().host_port_pair());
497 } 500 }
498 501
499 int status = network_session_->proxy_service()->ReconsiderProxyAfterError( 502 int status = network_session_->proxy_service()->ReconsiderProxyAfterError(
500 GetCurrentEndpoint(), error, &proxy_info_, 503 GetCurrentEndpoint(), net::LOAD_NORMAL, error, &proxy_info_,
501 base::Bind(&ConnectionFactoryImpl::OnProxyResolveDone, 504 base::Bind(&ConnectionFactoryImpl::OnProxyResolveDone,
502 weak_ptr_factory_.GetWeakPtr()), 505 weak_ptr_factory_.GetWeakPtr()),
503 &pac_request_, 506 &pac_request_,
507 NULL,
504 bound_net_log_); 508 bound_net_log_);
505 if (status == net::OK || status == net::ERR_IO_PENDING) { 509 if (status == net::OK || status == net::ERR_IO_PENDING) {
506 CloseSocket(); 510 CloseSocket();
507 } else { 511 } else {
508 // If ReconsiderProxyAfterError() failed synchronously, it means 512 // If ReconsiderProxyAfterError() failed synchronously, it means
509 // there was nothing left to fall-back to, so fail the transaction 513 // there was nothing left to fall-back to, so fail the transaction
510 // with the last connection error we got. 514 // with the last connection error we got.
511 status = error; 515 status = error;
512 } 516 }
513 517
(...skipping 19 matching lines...) Expand all
533 // the destroyed socket. 537 // the destroyed socket.
534 if (connection_handler_) 538 if (connection_handler_)
535 connection_handler_->Reset(); 539 connection_handler_->Reset();
536 540
537 if (socket_handle_.socket() && socket_handle_.socket()->IsConnected()) 541 if (socket_handle_.socket() && socket_handle_.socket()->IsConnected())
538 socket_handle_.socket()->Disconnect(); 542 socket_handle_.socket()->Disconnect();
539 socket_handle_.Reset(); 543 socket_handle_.Reset();
540 } 544 }
541 545
542 } // namespace gcm 546 } // namespace gcm
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698