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

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: Created 6 years, 4 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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 #include "chrome/browser/ssl/chrome_ssl_host_state_delegate.h" 71 #include "chrome/browser/ssl/chrome_ssl_host_state_delegate.h"
72 #include "chrome/browser/ssl/chrome_ssl_host_state_delegate_factory.h" 72 #include "chrome/browser/ssl/chrome_ssl_host_state_delegate_factory.h"
73 #include "chrome/browser/ui/startup/startup_browser_creator.h" 73 #include "chrome/browser/ui/startup/startup_browser_creator.h"
74 #include "chrome/common/chrome_constants.h" 74 #include "chrome/common/chrome_constants.h"
75 #include "chrome/common/chrome_paths_internal.h" 75 #include "chrome/common/chrome_paths_internal.h"
76 #include "chrome/common/chrome_switches.h" 76 #include "chrome/common/chrome_switches.h"
77 #include "chrome/common/chrome_version_info.h" 77 #include "chrome/common/chrome_version_info.h"
78 #include "chrome/common/pref_names.h" 78 #include "chrome/common/pref_names.h"
79 #include "chrome/common/url_constants.h" 79 #include "chrome/common/url_constants.h"
80 #include "components/bookmarks/browser/bookmark_model.h" 80 #include "components/bookmarks/browser/bookmark_model.h"
81 #include "components/data_reduction_proxy/browser/data_reduction_proxy_delayed_p ref_service.h"
81 #include "components/dom_distiller/content/dom_distiller_viewer_source.h" 82 #include "components/dom_distiller/content/dom_distiller_viewer_source.h"
82 #include "components/dom_distiller/core/url_constants.h" 83 #include "components/dom_distiller/core/url_constants.h"
83 #include "components/domain_reliability/monitor.h" 84 #include "components/domain_reliability/monitor.h"
84 #include "components/domain_reliability/service.h" 85 #include "components/domain_reliability/service.h"
85 #include "components/keyed_service/content/browser_context_dependency_manager.h" 86 #include "components/keyed_service/content/browser_context_dependency_manager.h"
86 #include "components/metrics/metrics_service.h" 87 #include "components/metrics/metrics_service.h"
87 #include "components/pref_registry/pref_registry_syncable.h" 88 #include "components/pref_registry/pref_registry_syncable.h"
88 #include "components/startup_metric_utils/startup_metric_utils.h" 89 #include "components/startup_metric_utils/startup_metric_utils.h"
89 #include "components/url_fixer/url_fixer.h" 90 #include "components/url_fixer/url_fixer.h"
90 #include "components/user_prefs/user_prefs.h" 91 #include "components/user_prefs/user_prefs.h"
(...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after
625 if (GetLastSessionExitType() == Profile::EXIT_CRASHED || 626 if (GetLastSessionExitType() == Profile::EXIT_CRASHED ||
626 startup_pref_type == SessionStartupPref::LAST) { 627 startup_pref_type == SessionStartupPref::LAST) {
627 session_cookie_mode = content::CookieStoreConfig::RESTORED_SESSION_COOKIES; 628 session_cookie_mode = content::CookieStoreConfig::RESTORED_SESSION_COOKIES;
628 } 629 }
629 630
630 InitHostZoomMap(); 631 InitHostZoomMap();
631 632
632 base::Callback<void(bool)> data_reduction_proxy_unavailable; 633 base::Callback<void(bool)> data_reduction_proxy_unavailable;
633 scoped_ptr<data_reduction_proxy::DataReductionProxyParams> 634 scoped_ptr<data_reduction_proxy::DataReductionProxyParams>
634 data_reduction_proxy_params; 635 data_reduction_proxy_params;
636 scoped_ptr<data_reduction_proxy::DataReductionProxyDelayedPrefService>
637 data_reduction_proxy_delayed_pref_service;
635 #if defined(SPDY_PROXY_AUTH_ORIGIN) 638 #if defined(SPDY_PROXY_AUTH_ORIGIN)
636 DataReductionProxyChromeSettings* data_reduction_proxy_chrome_settings = 639 DataReductionProxyChromeSettings* data_reduction_proxy_chrome_settings =
637 DataReductionProxyChromeSettingsFactory::GetForBrowserContext(this); 640 DataReductionProxyChromeSettingsFactory::GetForBrowserContext(this);
638 data_reduction_proxy_params = 641 data_reduction_proxy_params =
639 data_reduction_proxy_chrome_settings->params()->Clone(); 642 data_reduction_proxy_chrome_settings->params()->Clone();
640 data_reduction_proxy_unavailable = 643 data_reduction_proxy_unavailable =
641 base::Bind( 644 base::Bind(
642 &data_reduction_proxy::DataReductionProxySettings::SetUnreachable, 645 &data_reduction_proxy::DataReductionProxySettings::SetUnreachable,
643 base::Unretained(data_reduction_proxy_chrome_settings)); 646 base::Unretained(data_reduction_proxy_chrome_settings));
647 #if defined(OS_ANDROID) || defined(OS_IOS)
bengr 2014/08/14 17:39:41 Rewrite as: #if defined(OS_ANDROID) || defined(OS_
megjablon 2014/08/26 19:28:40 Done.
648 data_reduction_proxy_delayed_pref_service =
649 scoped_ptr<data_reduction_proxy::DataReductionProxyDelayedPrefService>(
650 new data_reduction_proxy::DataReductionProxyDelayedPrefService(
651 g_browser_process->local_state(),
652 base::MessageLoopProxy::current(),
653 base::TimeDelta()));
654 #else
655 data_reduction_proxy_delayed_pref_service =
656 scoped_ptr<data_reduction_proxy::DataReductionProxyDelayedPrefService>(
657 new data_reduction_proxy::DataReductionProxyDelayedPrefService(
658 g_browser_process->local_state(),
659 base::MessageLoopProxy::current(),
660 base::TimeDelta::FromMinutes(60)));
661 #endif
662 data_reduction_proxy_chrome_settings->SetDataReductionProxyDelayedPrefService(
663 data_reduction_proxy_delayed_pref_service->AsWeakPtr());
644 #endif 664 #endif
645 665
646 // Make sure we initialize the ProfileIOData after everything else has been 666 // Make sure we initialize the ProfileIOData after everything else has been
647 // initialized that we might be reading from the IO thread. 667 // initialized that we might be reading from the IO thread.
648 668
649 io_data_.Init(cookie_path, channel_id_path, cache_path, 669 io_data_.Init(cookie_path, channel_id_path, cache_path,
650 cache_max_size, media_cache_path, media_cache_max_size, 670 cache_max_size, media_cache_path, media_cache_max_size,
651 extensions_cookie_path, GetPath(), infinite_cache_path, 671 extensions_cookie_path, GetPath(), infinite_cache_path,
652 predictor_, session_cookie_mode, GetSpecialStoragePolicy(), 672 predictor_, session_cookie_mode, GetSpecialStoragePolicy(),
653 CreateDomainReliabilityMonitor(), 673 CreateDomainReliabilityMonitor(),
654 data_reduction_proxy_unavailable, 674 data_reduction_proxy_unavailable,
655 data_reduction_proxy_params.Pass()); 675 data_reduction_proxy_params.Pass(),
676 data_reduction_proxy_delayed_pref_service.Pass());
656 677
657 #if defined(SPDY_PROXY_AUTH_ORIGIN) 678 #if defined(SPDY_PROXY_AUTH_ORIGIN)
658 scoped_ptr<data_reduction_proxy::DataReductionProxyConfigurator> 679 scoped_ptr<data_reduction_proxy::DataReductionProxyConfigurator>
659 configurator(new DataReductionProxyChromeConfigurator(prefs_.get())); 680 configurator(new DataReductionProxyChromeConfigurator(prefs_.get()));
660 data_reduction_proxy_chrome_settings->InitDataReductionProxySettings( 681 data_reduction_proxy_chrome_settings->InitDataReductionProxySettings(
661 configurator.Pass(), 682 configurator.Pass(),
662 prefs_.get(), 683 prefs_.get(),
663 g_browser_process->local_state(), 684 g_browser_process->local_state(),
664 GetRequestContext()); 685 GetRequestContext());
665 #endif 686 #endif
(...skipping 735 matching lines...) Expand 10 before | Expand all | Expand 10 after
1401 ProfileImpl::CreateDomainReliabilityMonitor() { 1422 ProfileImpl::CreateDomainReliabilityMonitor() {
1402 domain_reliability::DomainReliabilityService* service = 1423 domain_reliability::DomainReliabilityService* service =
1403 domain_reliability::DomainReliabilityServiceFactory::GetInstance()-> 1424 domain_reliability::DomainReliabilityServiceFactory::GetInstance()->
1404 GetForBrowserContext(this); 1425 GetForBrowserContext(this);
1405 if (!service) 1426 if (!service)
1406 return scoped_ptr<domain_reliability::DomainReliabilityMonitor>(); 1427 return scoped_ptr<domain_reliability::DomainReliabilityMonitor>();
1407 1428
1408 return service->CreateMonitor( 1429 return service->CreateMonitor(
1409 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)); 1430 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO));
1410 } 1431 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698