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

Side by Side Diff: chrome/browser/io_thread.cc

Issue 1041763002: Remove stale-while-revalidate experimental implementation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 5 years, 6 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
« no previous file with comments | « chrome/browser/io_thread.h ('k') | chrome/browser/resources/net_internals/source_entry.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chrome/browser/io_thread.h" 5 #include "chrome/browser/io_thread.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/base64.h" 9 #include "base/base64.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 // operators to do feature detection rather than UA-sniffing. As such, this 132 // operators to do feature detection rather than UA-sniffing. As such, this
133 // trial runs continuously. 133 // trial runs continuously.
134 // * A SPDY/4 experiment, for SPDY/4 (aka HTTP/2) vs SPDY/3.1 comparisons and 134 // * A SPDY/4 experiment, for SPDY/4 (aka HTTP/2) vs SPDY/3.1 comparisons and
135 // eventual SPDY/4 deployment. 135 // eventual SPDY/4 deployment.
136 const char kSpdyFieldTrialName[] = "SPDY"; 136 const char kSpdyFieldTrialName[] = "SPDY";
137 const char kSpdyFieldTrialHoldbackGroupNamePrefix[] = "SpdyDisabled"; 137 const char kSpdyFieldTrialHoldbackGroupNamePrefix[] = "SpdyDisabled";
138 const char kSpdyFieldTrialSpdy31GroupNamePrefix[] = "Spdy31Enabled"; 138 const char kSpdyFieldTrialSpdy31GroupNamePrefix[] = "Spdy31Enabled";
139 const char kSpdyFieldTrialSpdy4GroupNamePrefix[] = "Spdy4Enabled"; 139 const char kSpdyFieldTrialSpdy4GroupNamePrefix[] = "Spdy4Enabled";
140 const char kSpdyFieldTrialParametrizedPrefix[] = "Parametrized"; 140 const char kSpdyFieldTrialParametrizedPrefix[] = "Parametrized";
141 141
142 // Field trial for Cache-Control: stale-while-revalidate directive.
143 const char kStaleWhileRevalidateFieldTrialName[] = "StaleWhileRevalidate";
144
145 #if defined(OS_MACOSX) && !defined(OS_IOS) 142 #if defined(OS_MACOSX) && !defined(OS_IOS)
146 void ObserveKeychainEvents() { 143 void ObserveKeychainEvents() {
147 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 144 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
148 net::CertDatabase::GetInstance()->SetMessageLoopForKeychainEvents(); 145 net::CertDatabase::GetInstance()->SetMessageLoopForKeychainEvents();
149 } 146 }
150 #endif 147 #endif
151 148
152 // Used for the "system" URLRequestContext. 149 // Used for the "system" URLRequestContext.
153 class SystemURLRequestContext : public net::URLRequestContext { 150 class SystemURLRequestContext : public net::URLRequestContext {
154 public: 151 public:
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 const std::string& GetVariationParam( 284 const std::string& GetVariationParam(
288 const std::map<std::string, std::string>& params, 285 const std::map<std::string, std::string>& params,
289 const std::string& key) { 286 const std::string& key) {
290 std::map<std::string, std::string>::const_iterator it = params.find(key); 287 std::map<std::string, std::string>::const_iterator it = params.find(key);
291 if (it == params.end()) 288 if (it == params.end())
292 return base::EmptyString(); 289 return base::EmptyString();
293 290
294 return it->second; 291 return it->second;
295 } 292 }
296 293
297 // Return true if stale-while-revalidate support should be enabled.
298 bool IsStaleWhileRevalidateEnabled(const base::CommandLine& command_line) {
299 if (command_line.HasSwitch(switches::kEnableStaleWhileRevalidate))
300 return true;
301 const std::string group_name =
302 base::FieldTrialList::FindFullName(kStaleWhileRevalidateFieldTrialName);
303 return group_name == "Enabled";
304 }
305
306 // Parse kUseSpdy command line flag options, which may contain the following: 294 // Parse kUseSpdy command line flag options, which may contain the following:
307 // 295 //
308 // "off" : Disables SPDY support entirely. 296 // "off" : Disables SPDY support entirely.
309 // "no-ping" : Disables SPDY ping connection testing. 297 // "no-ping" : Disables SPDY ping connection testing.
310 // "exclude=<host>" : Disables SPDY support for the host <host>. 298 // "exclude=<host>" : Disables SPDY support for the host <host>.
311 // "no-compress" : Disables SPDY header compression. 299 // "no-compress" : Disables SPDY header compression.
312 // "no-alt-protocols : Disables alternate protocol support. 300 // "no-alt-protocols : Disables alternate protocol support.
313 // "init-max-streams=<limit>" : Specifies the maximum number of concurrent 301 // "init-max-streams=<limit>" : Specifies the maximum number of concurrent
314 // streams for a SPDY session, unless the 302 // streams for a SPDY session, unless the
315 // specifies a different value via SETTINGS. 303 // specifies a different value via SETTINGS.
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
474 462
475 IOThread::Globals:: 463 IOThread::Globals::
476 SystemRequestContextLeakChecker::~SystemRequestContextLeakChecker() { 464 SystemRequestContextLeakChecker::~SystemRequestContextLeakChecker() {
477 if (globals_->system_request_context.get()) 465 if (globals_->system_request_context.get())
478 globals_->system_request_context->AssertNoURLRequests(); 466 globals_->system_request_context->AssertNoURLRequests();
479 } 467 }
480 468
481 IOThread::Globals::Globals() 469 IOThread::Globals::Globals()
482 : system_request_context_leak_checker(this), 470 : system_request_context_leak_checker(this),
483 ignore_certificate_errors(false), 471 ignore_certificate_errors(false),
484 use_stale_while_revalidate(false),
485 testing_fixed_http_port(0), 472 testing_fixed_http_port(0),
486 testing_fixed_https_port(0), 473 testing_fixed_https_port(0),
487 enable_user_alternate_protocol_ports(false) { 474 enable_user_alternate_protocol_ports(false) {
488 } 475 }
489 476
490 IOThread::Globals::~Globals() {} 477 IOThread::Globals::~Globals() {}
491 478
492 // |local_state| is passed in explicitly in order to (1) reduce implicit 479 // |local_state| is passed in explicitly in order to (1) reduce implicit
493 // dependencies and (2) make IOThread more flexible for testing. 480 // dependencies and (2) make IOThread more flexible for testing.
494 IOThread::IOThread( 481 IOThread::IOThread(
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
792 FROM_HERE_WITH_EXPLICIT_FUNCTION( 779 FROM_HERE_WITH_EXPLICIT_FUNCTION(
793 "466432 IOThread::InitAsync::CommandLineConfiguration")); 780 "466432 IOThread::InitAsync::CommandLineConfiguration"));
794 if (command_line.HasSwitch(switches::kHostRules)) { 781 if (command_line.HasSwitch(switches::kHostRules)) {
795 TRACE_EVENT_BEGIN0("startup", "IOThread::InitAsync:SetRulesFromString"); 782 TRACE_EVENT_BEGIN0("startup", "IOThread::InitAsync:SetRulesFromString");
796 globals_->host_mapping_rules->SetRulesFromString( 783 globals_->host_mapping_rules->SetRulesFromString(
797 command_line.GetSwitchValueASCII(switches::kHostRules)); 784 command_line.GetSwitchValueASCII(switches::kHostRules));
798 TRACE_EVENT_END0("startup", "IOThread::InitAsync:SetRulesFromString"); 785 TRACE_EVENT_END0("startup", "IOThread::InitAsync:SetRulesFromString");
799 } 786 }
800 if (command_line.HasSwitch(switches::kIgnoreCertificateErrors)) 787 if (command_line.HasSwitch(switches::kIgnoreCertificateErrors))
801 globals_->ignore_certificate_errors = true; 788 globals_->ignore_certificate_errors = true;
802 globals_->use_stale_while_revalidate =
803 IsStaleWhileRevalidateEnabled(command_line);
804 if (command_line.HasSwitch(switches::kTestingFixedHttpPort)) { 789 if (command_line.HasSwitch(switches::kTestingFixedHttpPort)) {
805 globals_->testing_fixed_http_port = 790 globals_->testing_fixed_http_port =
806 GetSwitchValueAsInt(command_line, switches::kTestingFixedHttpPort); 791 GetSwitchValueAsInt(command_line, switches::kTestingFixedHttpPort);
807 } 792 }
808 if (command_line.HasSwitch(switches::kTestingFixedHttpsPort)) { 793 if (command_line.HasSwitch(switches::kTestingFixedHttpsPort)) {
809 globals_->testing_fixed_https_port = 794 globals_->testing_fixed_https_port =
810 GetSwitchValueAsInt(command_line, switches::kTestingFixedHttpsPort); 795 GetSwitchValueAsInt(command_line, switches::kTestingFixedHttpsPort);
811 } 796 }
812 // TODO(erikchen): Remove ScopedTracker below once http://crbug.com/466432 797 // TODO(erikchen): Remove ScopedTracker below once http://crbug.com/466432
813 // is fixed. 798 // is fixed.
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
1110 params->cert_policy_enforcer = globals.cert_policy_enforcer.get(); 1095 params->cert_policy_enforcer = globals.cert_policy_enforcer.get();
1111 params->channel_id_service = globals.system_channel_id_service.get(); 1096 params->channel_id_service = globals.system_channel_id_service.get();
1112 params->transport_security_state = globals.transport_security_state.get(); 1097 params->transport_security_state = globals.transport_security_state.get();
1113 params->ssl_config_service = globals.ssl_config_service.get(); 1098 params->ssl_config_service = globals.ssl_config_service.get();
1114 params->http_auth_handler_factory = globals.http_auth_handler_factory.get(); 1099 params->http_auth_handler_factory = globals.http_auth_handler_factory.get();
1115 params->http_server_properties = 1100 params->http_server_properties =
1116 globals.http_server_properties->GetWeakPtr(); 1101 globals.http_server_properties->GetWeakPtr();
1117 params->network_delegate = globals.system_network_delegate.get(); 1102 params->network_delegate = globals.system_network_delegate.get();
1118 params->host_mapping_rules = globals.host_mapping_rules.get(); 1103 params->host_mapping_rules = globals.host_mapping_rules.get();
1119 params->ignore_certificate_errors = globals.ignore_certificate_errors; 1104 params->ignore_certificate_errors = globals.ignore_certificate_errors;
1120 params->use_stale_while_revalidate = globals.use_stale_while_revalidate;
1121 params->testing_fixed_http_port = globals.testing_fixed_http_port; 1105 params->testing_fixed_http_port = globals.testing_fixed_http_port;
1122 params->testing_fixed_https_port = globals.testing_fixed_https_port; 1106 params->testing_fixed_https_port = globals.testing_fixed_https_port;
1123 globals.enable_tcp_fast_open_for_ssl.CopyToIfSet( 1107 globals.enable_tcp_fast_open_for_ssl.CopyToIfSet(
1124 &params->enable_tcp_fast_open_for_ssl); 1108 &params->enable_tcp_fast_open_for_ssl);
1125 1109
1126 globals.initial_max_spdy_concurrent_streams.CopyToIfSet( 1110 globals.initial_max_spdy_concurrent_streams.CopyToIfSet(
1127 &params->spdy_initial_max_concurrent_streams); 1111 &params->spdy_initial_max_concurrent_streams);
1128 globals.enable_spdy_compression.CopyToIfSet( 1112 globals.enable_spdy_compression.CopyToIfSet(
1129 &params->enable_spdy_compression); 1113 &params->enable_spdy_compression);
1130 globals.enable_spdy_ping_based_connection_checking.CopyToIfSet( 1114 globals.enable_spdy_ping_based_connection_checking.CopyToIfSet(
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after
1595 net::QuicVersionVector supported_versions = net::QuicSupportedVersions(); 1579 net::QuicVersionVector supported_versions = net::QuicSupportedVersions();
1596 for (size_t i = 0; i < supported_versions.size(); ++i) { 1580 for (size_t i = 0; i < supported_versions.size(); ++i) {
1597 net::QuicVersion version = supported_versions[i]; 1581 net::QuicVersion version = supported_versions[i];
1598 if (net::QuicVersionToString(version) == quic_version) { 1582 if (net::QuicVersionToString(version) == quic_version) {
1599 return version; 1583 return version;
1600 } 1584 }
1601 } 1585 }
1602 1586
1603 return net::QUIC_VERSION_UNSUPPORTED; 1587 return net::QUIC_VERSION_UNSUPPORTED;
1604 } 1588 }
OLDNEW
« no previous file with comments | « chrome/browser/io_thread.h ('k') | chrome/browser/resources/net_internals/source_entry.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698