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

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: Removing statistics prefs from Android WebView 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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 #include "chrome/browser/chromeos/locale_change_guard.h" 112 #include "chrome/browser/chromeos/locale_change_guard.h"
113 #include "chrome/browser/chromeos/preferences.h" 113 #include "chrome/browser/chromeos/preferences.h"
114 #include "chrome/browser/chromeos/profiles/profile_helper.h" 114 #include "chrome/browser/chromeos/profiles/profile_helper.h"
115 #include "components/user_manager/user_manager.h" 115 #include "components/user_manager/user_manager.h"
116 #endif 116 #endif
117 117
118 #if defined(SPDY_PROXY_AUTH_ORIGIN) 118 #if defined(SPDY_PROXY_AUTH_ORIGIN)
119 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings_fact ory.h" 119 #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" 120 #include "components/data_reduction_proxy/browser/data_reduction_proxy_params.h"
121 #include "components/data_reduction_proxy/browser/data_reduction_proxy_settings. h" 121 #include "components/data_reduction_proxy/browser/data_reduction_proxy_settings. h"
122 #include "components/data_reduction_proxy/browser/data_reduction_proxy_statistic s_prefs.h"
122 #endif 123 #endif
123 124
124 #if defined(ENABLE_CONFIGURATION_POLICY) 125 #if defined(ENABLE_CONFIGURATION_POLICY)
125 #include "chrome/browser/policy/schema_registry_service.h" 126 #include "chrome/browser/policy/schema_registry_service.h"
126 #include "chrome/browser/policy/schema_registry_service_factory.h" 127 #include "chrome/browser/policy/schema_registry_service_factory.h"
127 #include "components/policy/core/browser/browser_policy_connector.h" 128 #include "components/policy/core/browser/browser_policy_connector.h"
128 #if defined(OS_CHROMEOS) 129 #if defined(OS_CHROMEOS)
129 #include "chrome/browser/chromeos/login/login_utils.h" 130 #include "chrome/browser/chromeos/login/login_utils.h"
130 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.h" 131 #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" 132 #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) { 655 startup_pref_type == SessionStartupPref::LAST) {
655 session_cookie_mode = content::CookieStoreConfig::RESTORED_SESSION_COOKIES; 656 session_cookie_mode = content::CookieStoreConfig::RESTORED_SESSION_COOKIES;
656 } 657 }
657 658
658 InitHostZoomMap(); 659 InitHostZoomMap();
659 660
660 base::Callback<void(bool)> data_reduction_proxy_unavailable; 661 base::Callback<void(bool)> data_reduction_proxy_unavailable;
661 scoped_ptr<data_reduction_proxy::DataReductionProxyParams> 662 scoped_ptr<data_reduction_proxy::DataReductionProxyParams>
662 data_reduction_proxy_params; 663 data_reduction_proxy_params;
663 scoped_ptr<DataReductionProxyChromeConfigurator> chrome_configurator; 664 scoped_ptr<DataReductionProxyChromeConfigurator> chrome_configurator;
665 scoped_ptr<data_reduction_proxy::DataReductionProxyStatisticsPrefs>
666 data_reduction_proxy_statistics_prefs;
664 #if defined(SPDY_PROXY_AUTH_ORIGIN) 667 #if defined(SPDY_PROXY_AUTH_ORIGIN)
665 DataReductionProxyChromeSettings* data_reduction_proxy_chrome_settings = 668 DataReductionProxyChromeSettings* data_reduction_proxy_chrome_settings =
666 DataReductionProxyChromeSettingsFactory::GetForBrowserContext(this); 669 DataReductionProxyChromeSettingsFactory::GetForBrowserContext(this);
667 data_reduction_proxy_params = 670 data_reduction_proxy_params =
668 data_reduction_proxy_chrome_settings->params()->Clone(); 671 data_reduction_proxy_chrome_settings->params()->Clone();
669 data_reduction_proxy_unavailable = 672 data_reduction_proxy_unavailable =
670 base::Bind( 673 base::Bind(
671 &data_reduction_proxy::DataReductionProxySettings::SetUnreachable, 674 &data_reduction_proxy::DataReductionProxySettings::SetUnreachable,
672 base::Unretained(data_reduction_proxy_chrome_settings)); 675 base::Unretained(data_reduction_proxy_chrome_settings));
673 // The configurator is used by DataReductionProxyChromeSettings and 676 // The configurator is used by DataReductionProxyChromeSettings and
674 // ProfileIOData. Ownership is passed to the latter via ProfileIOData::Handle, 677 // ProfileIOData. Ownership is passed to the latter via ProfileIOData::Handle,
675 // which is only destroyed after BrowserContextKeyedServices, 678 // which is only destroyed after BrowserContextKeyedServices,
676 // including DataReductionProxyChromeSettings. 679 // including DataReductionProxyChromeSettings.
677 chrome_configurator.reset( 680 chrome_configurator.reset(
678 new DataReductionProxyChromeConfigurator( 681 new DataReductionProxyChromeConfigurator(
679 prefs_.get(), 682 prefs_.get(),
680 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO))); 683 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)));
681 // Retain a raw pointer to use for initialization of data reduction proxy 684 // Retain a raw pointer to use for initialization of data reduction proxy
682 // settings after ownership is passed. 685 // settings after ownership is passed.
683 DataReductionProxyChromeConfigurator* 686 DataReductionProxyChromeConfigurator*
684 data_reduction_proxy_chrome_configurator = chrome_configurator.get(); 687 data_reduction_proxy_chrome_configurator = chrome_configurator.get();
688 #if defined(OS_ANDROID) || defined(OS_IOS)
689 // On mobile we write data reduction proxy prefs directly to the pref service.
690 // On desktop we store data reduction proxy prefs in memory, writing to disk
691 // every 60 minutes and on termination. Shutdown hooks must be added for
692 // Android and iOS in order for non-zero delays to be supported.
693 // (http://crbug.com/408264)
694 base::TimeDelta commit_delay = base::TimeDelta();
695 #else
696 base::TimeDelta commit_delay = base::TimeDelta::FromMinutes(60)
685 #endif 697 #endif
mmenke 2014/09/05 15:23:09 Should the profile really know or care about this?
megjablon 2014/09/05 20:56:39 See comment below.
698 data_reduction_proxy_statistics_prefs =
699 scoped_ptr<data_reduction_proxy::DataReductionProxyStatisticsPrefs>(
700 new data_reduction_proxy::DataReductionProxyStatisticsPrefs(
701 g_browser_process->local_state(),
702 base::MessageLoopProxy::current(),
703 commit_delay));
704 data_reduction_proxy_statistics_prefs->Init();
mmenke 2014/09/05 15:23:09 Why can't the DataReductionProxyStatisticsPrefs do
megjablon 2014/09/05 20:56:39 Agreed. Changed.
705 data_reduction_proxy_chrome_settings->SetDataReductionProxyStatisticsPrefs(
706 data_reduction_proxy_statistics_prefs.get());
mmenke 2014/09/05 15:23:09 Why do we need both the settings and the prefs? C
megjablon 2014/09/05 20:56:39 I'm not sure how to plumb this because this is acc
mmenke 2014/09/08 16:29:15 Had been thinking the network delegate had access
707 #endif // defined(SPDY_PROXY_AUTH_ORIGIN)
686 708
687 // Make sure we initialize the ProfileIOData after everything else has been 709 // Make sure we initialize the ProfileIOData after everything else has been
688 // initialized that we might be reading from the IO thread. 710 // initialized that we might be reading from the IO thread.
689 711
690 io_data_.Init(cookie_path, channel_id_path, cache_path, 712 io_data_.Init(cookie_path, channel_id_path, cache_path,
691 cache_max_size, media_cache_path, media_cache_max_size, 713 cache_max_size, media_cache_path, media_cache_max_size,
692 extensions_cookie_path, GetPath(), infinite_cache_path, 714 extensions_cookie_path, GetPath(), infinite_cache_path,
693 predictor_, session_cookie_mode, GetSpecialStoragePolicy(), 715 predictor_, session_cookie_mode, GetSpecialStoragePolicy(),
694 CreateDomainReliabilityMonitor(local_state), 716 CreateDomainReliabilityMonitor(local_state),
695 data_reduction_proxy_unavailable, 717 data_reduction_proxy_unavailable,
696 chrome_configurator.Pass(), 718 chrome_configurator.Pass(),
697 data_reduction_proxy_params.Pass()); 719 data_reduction_proxy_params.Pass(),
720 data_reduction_proxy_statistics_prefs.Pass());
698 721
699 #if defined(SPDY_PROXY_AUTH_ORIGIN) 722 #if defined(SPDY_PROXY_AUTH_ORIGIN)
700 data_reduction_proxy_chrome_settings->InitDataReductionProxySettings( 723 data_reduction_proxy_chrome_settings->InitDataReductionProxySettings(
701 data_reduction_proxy_chrome_configurator, 724 data_reduction_proxy_chrome_configurator,
702 prefs_.get(), 725 prefs_.get(),
703 g_browser_process->local_state(), 726 g_browser_process->local_state(),
704 GetRequestContext()); 727 GetRequestContext());
705 #endif 728 #endif
706 729
707 #if defined(ENABLE_PLUGINS) 730 #if defined(ENABLE_PLUGINS)
(...skipping 747 matching lines...) Expand 10 before | Expand all | Expand 10 after
1455 domain_reliability::DomainReliabilityServiceFactory::GetInstance()-> 1478 domain_reliability::DomainReliabilityServiceFactory::GetInstance()->
1456 GetForBrowserContext(this); 1479 GetForBrowserContext(this);
1457 if (!service) 1480 if (!service)
1458 return scoped_ptr<domain_reliability::DomainReliabilityMonitor>(); 1481 return scoped_ptr<domain_reliability::DomainReliabilityMonitor>();
1459 1482
1460 return service->CreateMonitor( 1483 return service->CreateMonitor(
1461 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO), 1484 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO),
1462 local_state, 1485 local_state,
1463 prefs::kMetricsReportingEnabled); 1486 prefs::kMetricsReportingEnabled);
1464 } 1487 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698