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

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

Issue 595913003: Declaring the weak_ptr_factory in proper order in src/net. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added entry in AUTHORS file. Created 6 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
« no previous file with comments | « AUTHORS ('k') | no next file » | 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 539 matching lines...) Expand 10 before | Expand all | Expand 10 after
550 // script's contents have changed. 550 // script's contents have changed.
551 // |net_log| the NetLog to log progress into. 551 // |net_log| the NetLog to log progress into.
552 ProxyScriptDeciderPoller(ChangeCallback callback, 552 ProxyScriptDeciderPoller(ChangeCallback callback,
553 const ProxyConfig& config, 553 const ProxyConfig& config,
554 bool proxy_resolver_expects_pac_bytes, 554 bool proxy_resolver_expects_pac_bytes,
555 ProxyScriptFetcher* proxy_script_fetcher, 555 ProxyScriptFetcher* proxy_script_fetcher,
556 DhcpProxyScriptFetcher* dhcp_proxy_script_fetcher, 556 DhcpProxyScriptFetcher* dhcp_proxy_script_fetcher,
557 int init_net_error, 557 int init_net_error,
558 ProxyResolverScriptData* init_script_data, 558 ProxyResolverScriptData* init_script_data,
559 NetLog* net_log) 559 NetLog* net_log)
560 : weak_factory_(this), 560 : change_callback_(callback),
561 change_callback_(callback),
562 config_(config), 561 config_(config),
563 proxy_resolver_expects_pac_bytes_(proxy_resolver_expects_pac_bytes), 562 proxy_resolver_expects_pac_bytes_(proxy_resolver_expects_pac_bytes),
564 proxy_script_fetcher_(proxy_script_fetcher), 563 proxy_script_fetcher_(proxy_script_fetcher),
565 dhcp_proxy_script_fetcher_(dhcp_proxy_script_fetcher), 564 dhcp_proxy_script_fetcher_(dhcp_proxy_script_fetcher),
566 last_error_(init_net_error), 565 last_error_(init_net_error),
567 last_script_data_(init_script_data), 566 last_script_data_(init_script_data),
568 last_poll_time_(TimeTicks::Now()) { 567 last_poll_time_(TimeTicks::Now()),
568 weak_factory_(this) {
569 // Set the initial poll delay. 569 // Set the initial poll delay.
570 next_poll_mode_ = poll_policy()->GetNextDelay( 570 next_poll_mode_ = poll_policy()->GetNextDelay(
571 last_error_, TimeDelta::FromSeconds(-1), &next_poll_delay_); 571 last_error_, TimeDelta::FromSeconds(-1), &next_poll_delay_);
572 TryToStartNextPoll(false); 572 TryToStartNextPoll(false);
573 } 573 }
574 574
575 void OnLazyPoll() { 575 void OnLazyPoll() {
576 // We have just been notified of network activity. Use this opportunity to 576 // We have just been notified of network activity. Use this opportunity to
577 // see if we can start our next poll. 577 // see if we can start our next poll.
578 TryToStartNextPoll(true); 578 TryToStartNextPoll(true);
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
687 } 687 }
688 688
689 void NotifyProxyServiceOfChange( 689 void NotifyProxyServiceOfChange(
690 int result, 690 int result,
691 const scoped_refptr<ProxyResolverScriptData>& script_data, 691 const scoped_refptr<ProxyResolverScriptData>& script_data,
692 const ProxyConfig& effective_config) { 692 const ProxyConfig& effective_config) {
693 // Note that |this| may be deleted after calling into the ProxyService. 693 // Note that |this| may be deleted after calling into the ProxyService.
694 change_callback_.Run(result, script_data.get(), effective_config); 694 change_callback_.Run(result, script_data.get(), effective_config);
695 } 695 }
696 696
697 base::WeakPtrFactory<ProxyScriptDeciderPoller> weak_factory_;
698
699 ChangeCallback change_callback_; 697 ChangeCallback change_callback_;
700 ProxyConfig config_; 698 ProxyConfig config_;
701 bool proxy_resolver_expects_pac_bytes_; 699 bool proxy_resolver_expects_pac_bytes_;
702 ProxyScriptFetcher* proxy_script_fetcher_; 700 ProxyScriptFetcher* proxy_script_fetcher_;
703 DhcpProxyScriptFetcher* dhcp_proxy_script_fetcher_; 701 DhcpProxyScriptFetcher* dhcp_proxy_script_fetcher_;
704 702
705 int last_error_; 703 int last_error_;
706 scoped_refptr<ProxyResolverScriptData> last_script_data_; 704 scoped_refptr<ProxyResolverScriptData> last_script_data_;
707 705
708 scoped_ptr<ProxyScriptDecider> decider_; 706 scoped_ptr<ProxyScriptDecider> decider_;
709 TimeDelta next_poll_delay_; 707 TimeDelta next_poll_delay_;
710 PacPollPolicy::Mode next_poll_mode_; 708 PacPollPolicy::Mode next_poll_mode_;
711 709
712 TimeTicks last_poll_time_; 710 TimeTicks last_poll_time_;
713 711
714 // Polling policy injected by unit-tests. Otherwise this is NULL and the 712 // Polling policy injected by unit-tests. Otherwise this is NULL and the
715 // default policy will be used. 713 // default policy will be used.
716 static const PacPollPolicy* poll_policy_; 714 static const PacPollPolicy* poll_policy_;
717 715
718 const DefaultPollPolicy default_poll_policy_; 716 const DefaultPollPolicy default_poll_policy_;
719 717
720 bool quick_check_enabled_; 718 bool quick_check_enabled_;
721 719
720 base::WeakPtrFactory<ProxyScriptDeciderPoller> weak_factory_;
721
722 DISALLOW_COPY_AND_ASSIGN(ProxyScriptDeciderPoller); 722 DISALLOW_COPY_AND_ASSIGN(ProxyScriptDeciderPoller);
723 }; 723 };
724 724
725 // static 725 // static
726 const ProxyService::PacPollPolicy* 726 const ProxyService::PacPollPolicy*
727 ProxyService::ProxyScriptDeciderPoller::poll_policy_ = NULL; 727 ProxyService::ProxyScriptDeciderPoller::poll_policy_ = NULL;
728 728
729 // ProxyService::PacRequest --------------------------------------------------- 729 // ProxyService::PacRequest ---------------------------------------------------
730 730
731 class ProxyService::PacRequest 731 class ProxyService::PacRequest
(...skipping 824 matching lines...) Expand 10 before | Expand all | Expand 10 after
1556 State previous_state = ResetProxyConfig(false); 1556 State previous_state = ResetProxyConfig(false);
1557 if (previous_state != STATE_NONE) 1557 if (previous_state != STATE_NONE)
1558 ApplyProxyConfigIfAvailable(); 1558 ApplyProxyConfigIfAvailable();
1559 } 1559 }
1560 1560
1561 void ProxyService::OnDNSChanged() { 1561 void ProxyService::OnDNSChanged() {
1562 OnIPAddressChanged(); 1562 OnIPAddressChanged();
1563 } 1563 }
1564 1564
1565 } // namespace net 1565 } // namespace net
OLDNEW
« no previous file with comments | « AUTHORS ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698