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

Side by Side Diff: net/proxy/proxy_service.cc

Issue 962423002: Update instrumentation for many different bugs based on new UMA data. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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 | « net/proxy/proxy_script_decider.cc ('k') | net/spdy/spdy_session.cc » ('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 "net/proxy/proxy_service.h" 5 #include "net/proxy/proxy_service.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after
450 default: 450 default:
451 NOTREACHED() << "bad state: " << state; 451 NOTREACHED() << "bad state: " << state;
452 rv = ERR_UNEXPECTED; 452 rv = ERR_UNEXPECTED;
453 break; 453 break;
454 } 454 }
455 } while (rv != ERR_IO_PENDING && next_state_ != STATE_NONE); 455 } while (rv != ERR_IO_PENDING && next_state_ != STATE_NONE);
456 return rv; 456 return rv;
457 } 457 }
458 458
459 int DoDecideProxyScript() { 459 int DoDecideProxyScript() {
460 // TODO(pkasting): Remove ScopedTracker below once crbug.com/455942 is
461 // fixed.
462 tracked_objects::ScopedTracker tracking_profile(
463 FROM_HERE_WITH_EXPLICIT_FUNCTION(
464 "455942 ProxyService::InitProxyResolver::DoDecideProxyScript"));
460 next_state_ = STATE_DECIDE_PROXY_SCRIPT_COMPLETE; 465 next_state_ = STATE_DECIDE_PROXY_SCRIPT_COMPLETE;
461 466
462 return decider_->Start( 467 return decider_->Start(
463 config_, wait_delay_, proxy_resolver_->expects_pac_bytes(), 468 config_, wait_delay_, proxy_resolver_->expects_pac_bytes(),
464 base::Bind(&InitProxyResolver::OnIOCompletion, base::Unretained(this))); 469 base::Bind(&InitProxyResolver::OnIOCompletion, base::Unretained(this)));
465 } 470 }
466 471
467 int DoDecideProxyScriptComplete(int result) { 472 int DoDecideProxyScriptComplete(int result) {
473 // TODO(pkasting): Remove ScopedTracker below once crbug.com/455942 is
474 // fixed.
475 tracked_objects::ScopedTracker tracking_profile(
476 FROM_HERE_WITH_EXPLICIT_FUNCTION(
477 "455942 "
478 "ProxyService::InitProxyResolver::DoDecideProxyScriptComplete"));
468 if (result != OK) 479 if (result != OK)
469 return result; 480 return result;
470 481
471 effective_config_ = decider_->effective_config(); 482 effective_config_ = decider_->effective_config();
472 script_data_ = decider_->script_data(); 483 script_data_ = decider_->script_data();
473 484
474 next_state_ = STATE_SET_PAC_SCRIPT; 485 next_state_ = STATE_SET_PAC_SCRIPT;
475 return OK; 486 return OK;
476 } 487 }
477 488
478 int DoSetPacScript() { 489 int DoSetPacScript() {
490 // TODO(pkasting): Remove ScopedTracker below once crbug.com/455942 is
491 // fixed.
492 tracked_objects::ScopedTracker tracking_profile(
493 FROM_HERE_WITH_EXPLICIT_FUNCTION(
494 "455942 ProxyService::InitProxyResolver::DoSetPacScript"));
479 DCHECK(script_data_.get()); 495 DCHECK(script_data_.get());
480 // TODO(eroman): Should log this latency to the NetLog. 496 // TODO(eroman): Should log this latency to the NetLog.
481 next_state_ = STATE_SET_PAC_SCRIPT_COMPLETE; 497 next_state_ = STATE_SET_PAC_SCRIPT_COMPLETE;
482 return proxy_resolver_->SetPacScript( 498 return proxy_resolver_->SetPacScript(
483 script_data_, 499 script_data_,
484 base::Bind(&InitProxyResolver::OnIOCompletion, base::Unretained(this))); 500 base::Bind(&InitProxyResolver::OnIOCompletion, base::Unretained(this)));
485 } 501 }
486 502
487 int DoSetPacScriptComplete(int result) { 503 int DoSetPacScriptComplete(int result) {
488 return result; 504 return result;
(...skipping 664 matching lines...) Expand 10 before | Expand all | Expand 10 after
1153 // If a configuration is not available yet, we will get called back later 1169 // If a configuration is not available yet, we will get called back later
1154 // by our ProxyConfigService::Observer once it changes. 1170 // by our ProxyConfigService::Observer once it changes.
1155 ProxyConfig config; 1171 ProxyConfig config;
1156 ProxyConfigService::ConfigAvailability availability = 1172 ProxyConfigService::ConfigAvailability availability =
1157 config_service_->GetLatestProxyConfig(&config); 1173 config_service_->GetLatestProxyConfig(&config);
1158 if (availability != ProxyConfigService::CONFIG_PENDING) 1174 if (availability != ProxyConfigService::CONFIG_PENDING)
1159 OnProxyConfigChanged(config, availability); 1175 OnProxyConfigChanged(config, availability);
1160 } 1176 }
1161 1177
1162 void ProxyService::OnInitProxyResolverComplete(int result) { 1178 void ProxyService::OnInitProxyResolverComplete(int result) {
1163 // TODO(pkasting): Remove ScopedTracker below once crbug.com/455942 is fixed.
1164 tracked_objects::ScopedTracker tracking_profile(
1165 FROM_HERE_WITH_EXPLICIT_FUNCTION(
1166 "455942 ProxyService::OnInitProxyResolverComplete"));
1167 DCHECK_EQ(STATE_WAITING_FOR_INIT_PROXY_RESOLVER, current_state_); 1179 DCHECK_EQ(STATE_WAITING_FOR_INIT_PROXY_RESOLVER, current_state_);
1168 DCHECK(init_proxy_resolver_.get()); 1180 DCHECK(init_proxy_resolver_.get());
1169 DCHECK(fetched_config_.HasAutomaticSettings()); 1181 DCHECK(fetched_config_.HasAutomaticSettings());
1170 config_ = init_proxy_resolver_->effective_config(); 1182 config_ = init_proxy_resolver_->effective_config();
1171 1183
1172 // At this point we have decided which proxy settings to use (i.e. which PAC 1184 // At this point we have decided which proxy settings to use (i.e. which PAC
1173 // script if any). We start up a background poller to periodically revisit 1185 // script if any). We start up a background poller to periodically revisit
1174 // this decision. If the contents of the PAC script change, or if the 1186 // this decision. If the contents of the PAC script change, or if the
1175 // result of proxy auto-discovery changes, this poller will notice it and 1187 // result of proxy auto-discovery changes, this poller will notice it and
1176 // will trigger a re-initialization using the newly discovered PAC. 1188 // will trigger a re-initialization using the newly discovered PAC.
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
1384 if (previous_state != STATE_NONE) 1396 if (previous_state != STATE_NONE)
1385 ApplyProxyConfigIfAvailable(); 1397 ApplyProxyConfigIfAvailable();
1386 } 1398 }
1387 1399
1388 ProxyScriptFetcher* ProxyService::GetProxyScriptFetcher() const { 1400 ProxyScriptFetcher* ProxyService::GetProxyScriptFetcher() const {
1389 DCHECK(CalledOnValidThread()); 1401 DCHECK(CalledOnValidThread());
1390 return proxy_script_fetcher_.get(); 1402 return proxy_script_fetcher_.get();
1391 } 1403 }
1392 1404
1393 ProxyService::State ProxyService::ResetProxyConfig(bool reset_fetched_config) { 1405 ProxyService::State ProxyService::ResetProxyConfig(bool reset_fetched_config) {
1394 // TODO(pkasting): Remove ScopedTracker below once crbug.com/455942 is fixed.
1395 tracked_objects::ScopedTracker tracking_profile(
1396 FROM_HERE_WITH_EXPLICIT_FUNCTION(
1397 "455942 ProxyService::ResetProxyConfig"));
1398 DCHECK(CalledOnValidThread()); 1406 DCHECK(CalledOnValidThread());
1399 State previous_state = current_state_; 1407 State previous_state = current_state_;
1400 1408
1401 permanent_error_ = OK; 1409 permanent_error_ = OK;
1402 proxy_retry_info_.clear(); 1410 proxy_retry_info_.clear();
1403 script_poller_.reset(); 1411 script_poller_.reset();
1404 init_proxy_resolver_.reset(); 1412 init_proxy_resolver_.reset();
1405 SuspendAllPendingRequests(); 1413 SuspendAllPendingRequests();
1406 config_ = ProxyConfig(); 1414 config_ = ProxyConfig();
1407 if (reset_fetched_config) 1415 if (reset_fetched_config)
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
1485 1493
1486 // static 1494 // static
1487 scoped_ptr<ProxyService::PacPollPolicy> 1495 scoped_ptr<ProxyService::PacPollPolicy>
1488 ProxyService::CreateDefaultPacPollPolicy() { 1496 ProxyService::CreateDefaultPacPollPolicy() {
1489 return scoped_ptr<PacPollPolicy>(new DefaultPollPolicy()); 1497 return scoped_ptr<PacPollPolicy>(new DefaultPollPolicy());
1490 } 1498 }
1491 1499
1492 void ProxyService::OnProxyConfigChanged( 1500 void ProxyService::OnProxyConfigChanged(
1493 const ProxyConfig& config, 1501 const ProxyConfig& config,
1494 ProxyConfigService::ConfigAvailability availability) { 1502 ProxyConfigService::ConfigAvailability availability) {
1495 // TODO(pkasting): Remove ScopedTracker below once crbug.com/455942 is fixed.
1496 tracked_objects::ScopedTracker tracking_profile(
1497 FROM_HERE_WITH_EXPLICIT_FUNCTION(
1498 "455942 ProxyService::OnProxyConfigChanged"));
1499 // Retrieve the current proxy configuration from the ProxyConfigService. 1503 // Retrieve the current proxy configuration from the ProxyConfigService.
1500 // If a configuration is not available yet, we will get called back later 1504 // If a configuration is not available yet, we will get called back later
1501 // by our ProxyConfigService::Observer once it changes. 1505 // by our ProxyConfigService::Observer once it changes.
1502 ProxyConfig effective_config; 1506 ProxyConfig effective_config;
1503 switch (availability) { 1507 switch (availability) {
1504 case ProxyConfigService::CONFIG_PENDING: 1508 case ProxyConfigService::CONFIG_PENDING:
1505 // ProxyConfigService implementors should never pass CONFIG_PENDING. 1509 // ProxyConfigService implementors should never pass CONFIG_PENDING.
1506 NOTREACHED() << "Proxy config change with CONFIG_PENDING availability!"; 1510 NOTREACHED() << "Proxy config change with CONFIG_PENDING availability!";
1507 return; 1511 return;
1508 case ProxyConfigService::CONFIG_VALID: 1512 case ProxyConfigService::CONFIG_VALID:
(...skipping 13 matching lines...) Expand all
1522 } 1526 }
1523 1527
1524 // Set the new configuration as the most recently fetched one. 1528 // Set the new configuration as the most recently fetched one.
1525 fetched_config_ = effective_config; 1529 fetched_config_ = effective_config;
1526 fetched_config_.set_id(1); // Needed for a later DCHECK of is_valid(). 1530 fetched_config_.set_id(1); // Needed for a later DCHECK of is_valid().
1527 1531
1528 InitializeUsingLastFetchedConfig(); 1532 InitializeUsingLastFetchedConfig();
1529 } 1533 }
1530 1534
1531 void ProxyService::InitializeUsingLastFetchedConfig() { 1535 void ProxyService::InitializeUsingLastFetchedConfig() {
1532 // TODO(pkasting): Remove ScopedTracker below once crbug.com/455942 is fixed.
1533 tracked_objects::ScopedTracker tracking_profile(
1534 FROM_HERE_WITH_EXPLICIT_FUNCTION(
1535 "455942 ProxyService::InitializeUsingLastFetchedConfig"));
1536 ResetProxyConfig(false); 1536 ResetProxyConfig(false);
1537 1537
1538 DCHECK(fetched_config_.is_valid()); 1538 DCHECK(fetched_config_.is_valid());
1539 1539
1540 // Increment the ID to reflect that the config has changed. 1540 // Increment the ID to reflect that the config has changed.
1541 fetched_config_.set_id(next_config_id_++); 1541 fetched_config_.set_id(next_config_id_++);
1542 1542
1543 if (!fetched_config_.HasAutomaticSettings()) { 1543 if (!fetched_config_.HasAutomaticSettings()) {
1544 config_ = fetched_config_; 1544 config_ = fetched_config_;
1545 SetReady(); 1545 SetReady();
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
1601 State previous_state = ResetProxyConfig(false); 1601 State previous_state = ResetProxyConfig(false);
1602 if (previous_state != STATE_NONE) 1602 if (previous_state != STATE_NONE)
1603 ApplyProxyConfigIfAvailable(); 1603 ApplyProxyConfigIfAvailable();
1604 } 1604 }
1605 1605
1606 void ProxyService::OnDNSChanged() { 1606 void ProxyService::OnDNSChanged() {
1607 OnIPAddressChanged(); 1607 OnIPAddressChanged();
1608 } 1608 }
1609 1609
1610 } // namespace net 1610 } // namespace net
OLDNEW
« no previous file with comments | « net/proxy/proxy_script_decider.cc ('k') | net/spdy/spdy_session.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698