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

Side by Side Diff: chrome/browser/profiles/profile_impl.cc

Issue 473723002: Update data reduction proxy statistics prefs less often on desktop (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@tooManyWritesPatch
Patch Set: Undo BUILD.gn and fix aw_browser_context 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
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/profiles/profile_impl.h" 5 #include "chrome/browser/profiles/profile_impl.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 #include "chrome/browser/ssl/chrome_ssl_host_state_delegate_factory.h" 74 #include "chrome/browser/ssl/chrome_ssl_host_state_delegate_factory.h"
75 #include "chrome/browser/ui/startup/startup_browser_creator.h" 75 #include "chrome/browser/ui/startup/startup_browser_creator.h"
76 #include "chrome/common/chrome_constants.h" 76 #include "chrome/common/chrome_constants.h"
77 #include "chrome/common/chrome_paths_internal.h" 77 #include "chrome/common/chrome_paths_internal.h"
78 #include "chrome/common/chrome_switches.h" 78 #include "chrome/common/chrome_switches.h"
79 #include "chrome/common/chrome_version_info.h" 79 #include "chrome/common/chrome_version_info.h"
80 #include "chrome/common/pref_names.h" 80 #include "chrome/common/pref_names.h"
81 #include "chrome/common/url_constants.h" 81 #include "chrome/common/url_constants.h"
82 #include "chrome/grit/chromium_strings.h" 82 #include "chrome/grit/chromium_strings.h"
83 #include "components/bookmarks/browser/bookmark_model.h" 83 #include "components/bookmarks/browser/bookmark_model.h"
84 #include "components/data_reduction_proxy/browser/data_reduction_proxy_statistic s_prefs.h"
84 #include "components/dom_distiller/content/dom_distiller_viewer_source.h" 85 #include "components/dom_distiller/content/dom_distiller_viewer_source.h"
85 #include "components/dom_distiller/core/url_constants.h" 86 #include "components/dom_distiller/core/url_constants.h"
86 #include "components/domain_reliability/monitor.h" 87 #include "components/domain_reliability/monitor.h"
87 #include "components/domain_reliability/service.h" 88 #include "components/domain_reliability/service.h"
88 #include "components/keyed_service/content/browser_context_dependency_manager.h" 89 #include "components/keyed_service/content/browser_context_dependency_manager.h"
89 #include "components/metrics/metrics_service.h" 90 #include "components/metrics/metrics_service.h"
90 #include "components/pref_registry/pref_registry_syncable.h" 91 #include "components/pref_registry/pref_registry_syncable.h"
91 #include "components/startup_metric_utils/startup_metric_utils.h" 92 #include "components/startup_metric_utils/startup_metric_utils.h"
92 #include "components/url_fixer/url_fixer.h" 93 #include "components/url_fixer/url_fixer.h"
93 #include "components/user_prefs/user_prefs.h" 94 #include "components/user_prefs/user_prefs.h"
(...skipping 18 matching lines...) Expand all
112 #include "chrome/browser/chromeos/locale_change_guard.h" 113 #include "chrome/browser/chromeos/locale_change_guard.h"
113 #include "chrome/browser/chromeos/preferences.h" 114 #include "chrome/browser/chromeos/preferences.h"
114 #include "chrome/browser/chromeos/profiles/profile_helper.h" 115 #include "chrome/browser/chromeos/profiles/profile_helper.h"
115 #include "components/user_manager/user_manager.h" 116 #include "components/user_manager/user_manager.h"
116 #endif 117 #endif
117 118
118 #if defined(SPDY_PROXY_AUTH_ORIGIN) 119 #if defined(SPDY_PROXY_AUTH_ORIGIN)
119 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings_fact ory.h" 120 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings_fact ory.h"
120 #include "components/data_reduction_proxy/browser/data_reduction_proxy_params.h" 121 #include "components/data_reduction_proxy/browser/data_reduction_proxy_params.h"
121 #include "components/data_reduction_proxy/browser/data_reduction_proxy_settings. h" 122 #include "components/data_reduction_proxy/browser/data_reduction_proxy_settings. h"
123 #include "components/data_reduction_proxy/browser/data_reduction_proxy_statistic s_prefs.h"
122 #endif 124 #endif
123 125
124 #if defined(ENABLE_CONFIGURATION_POLICY) 126 #if defined(ENABLE_CONFIGURATION_POLICY)
125 #include "chrome/browser/policy/schema_registry_service.h" 127 #include "chrome/browser/policy/schema_registry_service.h"
126 #include "chrome/browser/policy/schema_registry_service_factory.h" 128 #include "chrome/browser/policy/schema_registry_service_factory.h"
127 #include "components/policy/core/browser/browser_policy_connector.h" 129 #include "components/policy/core/browser/browser_policy_connector.h"
128 #if defined(OS_CHROMEOS) 130 #if defined(OS_CHROMEOS)
129 #include "chrome/browser/chromeos/login/login_utils.h" 131 #include "chrome/browser/chromeos/login/login_utils.h"
130 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.h" 132 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.h"
131 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_factory_chrom eos.h" 133 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_factory_chrom eos.h"
(...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after
654 startup_pref_type == SessionStartupPref::LAST) { 656 startup_pref_type == SessionStartupPref::LAST) {
655 session_cookie_mode = content::CookieStoreConfig::RESTORED_SESSION_COOKIES; 657 session_cookie_mode = content::CookieStoreConfig::RESTORED_SESSION_COOKIES;
656 } 658 }
657 659
658 InitHostZoomMap(); 660 InitHostZoomMap();
659 661
660 base::Callback<void(bool)> data_reduction_proxy_unavailable; 662 base::Callback<void(bool)> data_reduction_proxy_unavailable;
661 scoped_ptr<data_reduction_proxy::DataReductionProxyParams> 663 scoped_ptr<data_reduction_proxy::DataReductionProxyParams>
662 data_reduction_proxy_params; 664 data_reduction_proxy_params;
663 scoped_ptr<DataReductionProxyChromeConfigurator> chrome_configurator; 665 scoped_ptr<DataReductionProxyChromeConfigurator> chrome_configurator;
666 scoped_ptr<data_reduction_proxy::DataReductionProxyStatisticsPrefs>
667 data_reduction_proxy_statistics_prefs;
664 #if defined(SPDY_PROXY_AUTH_ORIGIN) 668 #if defined(SPDY_PROXY_AUTH_ORIGIN)
665 DataReductionProxyChromeSettings* data_reduction_proxy_chrome_settings = 669 DataReductionProxyChromeSettings* data_reduction_proxy_chrome_settings =
666 DataReductionProxyChromeSettingsFactory::GetForBrowserContext(this); 670 DataReductionProxyChromeSettingsFactory::GetForBrowserContext(this);
667 data_reduction_proxy_params = 671 data_reduction_proxy_params =
668 data_reduction_proxy_chrome_settings->params()->Clone(); 672 data_reduction_proxy_chrome_settings->params()->Clone();
669 data_reduction_proxy_unavailable = 673 data_reduction_proxy_unavailable =
670 base::Bind( 674 base::Bind(
671 &data_reduction_proxy::DataReductionProxySettings::SetUnreachable, 675 &data_reduction_proxy::DataReductionProxySettings::SetUnreachable,
672 base::Unretained(data_reduction_proxy_chrome_settings)); 676 base::Unretained(data_reduction_proxy_chrome_settings));
673 // The configurator is used by DataReductionProxyChromeSettings and 677 // The configurator is used by DataReductionProxyChromeSettings and
674 // ProfileIOData. Ownership is passed to the latter via ProfileIOData::Handle, 678 // ProfileIOData. Ownership is passed to the latter via ProfileIOData::Handle,
675 // which is only destroyed after BrowserContextKeyedServices, 679 // which is only destroyed after BrowserContextKeyedServices,
676 // including DataReductionProxyChromeSettings. 680 // including DataReductionProxyChromeSettings.
677 chrome_configurator.reset( 681 chrome_configurator.reset(
678 new DataReductionProxyChromeConfigurator( 682 new DataReductionProxyChromeConfigurator(
679 prefs_.get(), 683 prefs_.get(),
680 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO))); 684 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)));
681 // Retain a raw pointer to use for initialization of data reduction proxy 685 // Retain a raw pointer to use for initialization of data reduction proxy
682 // settings after ownership is passed. 686 // settings after ownership is passed.
683 DataReductionProxyChromeConfigurator* 687 DataReductionProxyChromeConfigurator*
684 data_reduction_proxy_chrome_configurator = chrome_configurator.get(); 688 data_reduction_proxy_chrome_configurator = chrome_configurator.get();
689 #if defined(OS_ANDROID) || defined(OS_IOS)
bengr 2014/08/27 04:53:24 Add a comment explaining the platform specializati
megjablon 2014/08/28 20:44:06 Done.
690 base::TimeDelta commit_delay = base::TimeDelta();
691 #else
692 base::TimeDelta commit_delay = base::TimeDelta::FromMinutes(60)
693 #endif
694 data_reduction_proxy_statistics_prefs =
695 scoped_ptr<data_reduction_proxy::DataReductionProxyStatisticsPrefs>(
696 new data_reduction_proxy::DataReductionProxyStatisticsPrefs(
697 g_browser_process->local_state(),
698 base::MessageLoopProxy::current(),
699 commit_delay));
700 data_reduction_proxy_statistics_prefs->Init();
701 data_reduction_proxy_chrome_settings->SetDataReductionProxyStatisticsPrefs(
702 data_reduction_proxy_statistics_prefs.get());
685 #endif 703 #endif
686 704
687 // Make sure we initialize the ProfileIOData after everything else has been 705 // Make sure we initialize the ProfileIOData after everything else has been
688 // initialized that we might be reading from the IO thread. 706 // initialized that we might be reading from the IO thread.
689 707
690 io_data_.Init(cookie_path, channel_id_path, cache_path, 708 io_data_.Init(cookie_path, channel_id_path, cache_path,
691 cache_max_size, media_cache_path, media_cache_max_size, 709 cache_max_size, media_cache_path, media_cache_max_size,
692 extensions_cookie_path, GetPath(), infinite_cache_path, 710 extensions_cookie_path, GetPath(), infinite_cache_path,
693 predictor_, session_cookie_mode, GetSpecialStoragePolicy(), 711 predictor_, session_cookie_mode, GetSpecialStoragePolicy(),
694 CreateDomainReliabilityMonitor(local_state), 712 CreateDomainReliabilityMonitor(local_state),
695 data_reduction_proxy_unavailable, 713 data_reduction_proxy_unavailable,
696 chrome_configurator.Pass(), 714 chrome_configurator.Pass(),
697 data_reduction_proxy_params.Pass()); 715 data_reduction_proxy_params.Pass(),
716 data_reduction_proxy_statistics_prefs.Pass());
698 717
699 #if defined(SPDY_PROXY_AUTH_ORIGIN) 718 #if defined(SPDY_PROXY_AUTH_ORIGIN)
700 data_reduction_proxy_chrome_settings->InitDataReductionProxySettings( 719 data_reduction_proxy_chrome_settings->InitDataReductionProxySettings(
701 data_reduction_proxy_chrome_configurator, 720 data_reduction_proxy_chrome_configurator,
702 prefs_.get(), 721 prefs_.get(),
703 g_browser_process->local_state(), 722 g_browser_process->local_state(),
704 GetRequestContext()); 723 GetRequestContext());
705 #endif 724 #endif
706 725
707 #if defined(ENABLE_PLUGINS) 726 #if defined(ENABLE_PLUGINS)
(...skipping 747 matching lines...) Expand 10 before | Expand all | Expand 10 after
1455 domain_reliability::DomainReliabilityServiceFactory::GetInstance()-> 1474 domain_reliability::DomainReliabilityServiceFactory::GetInstance()->
1456 GetForBrowserContext(this); 1475 GetForBrowserContext(this);
1457 if (!service) 1476 if (!service)
1458 return scoped_ptr<domain_reliability::DomainReliabilityMonitor>(); 1477 return scoped_ptr<domain_reliability::DomainReliabilityMonitor>();
1459 1478
1460 return service->CreateMonitor( 1479 return service->CreateMonitor(
1461 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO), 1480 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO),
1462 local_state, 1481 local_state,
1463 prefs::kMetricsReportingEnabled); 1482 prefs::kMetricsReportingEnabled);
1464 } 1483 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698