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

Side by Side Diff: chrome/browser/browser_process_impl.cc

Issue 10916235: Record policy usage statistics every 24 hours. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Updated comment Created 8 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/browser_process_impl.h" 5 #include "chrome/browser/browser_process_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <map> 8 #include <map>
9 #include <set> 9 #include <set>
10 #include <vector> 10 #include <vector>
(...skipping 26 matching lines...) Expand all
37 #include "chrome/browser/lifetime/application_lifetime.h" 37 #include "chrome/browser/lifetime/application_lifetime.h"
38 #include "chrome/browser/metrics/metrics_service.h" 38 #include "chrome/browser/metrics/metrics_service.h"
39 #include "chrome/browser/metrics/thread_watcher.h" 39 #include "chrome/browser/metrics/thread_watcher.h"
40 #include "chrome/browser/metrics/variations/variations_service.h" 40 #include "chrome/browser/metrics/variations/variations_service.h"
41 #include "chrome/browser/net/chrome_net_log.h" 41 #include "chrome/browser/net/chrome_net_log.h"
42 #include "chrome/browser/net/crl_set_fetcher.h" 42 #include "chrome/browser/net/crl_set_fetcher.h"
43 #include "chrome/browser/net/sdch_dictionary_fetcher.h" 43 #include "chrome/browser/net/sdch_dictionary_fetcher.h"
44 #include "chrome/browser/notifications/notification_ui_manager.h" 44 #include "chrome/browser/notifications/notification_ui_manager.h"
45 #include "chrome/browser/policy/browser_policy_connector.h" 45 #include "chrome/browser/policy/browser_policy_connector.h"
46 #include "chrome/browser/policy/policy_service.h" 46 #include "chrome/browser/policy/policy_service.h"
47 #include "chrome/browser/policy/policy_statistics_collector.h"
47 #include "chrome/browser/prefs/browser_prefs.h" 48 #include "chrome/browser/prefs/browser_prefs.h"
48 #include "chrome/browser/prefs/pref_service.h" 49 #include "chrome/browser/prefs/pref_service.h"
49 #include "chrome/browser/prerender/prerender_tracker.h" 50 #include "chrome/browser/prerender/prerender_tracker.h"
50 #include "chrome/browser/printing/background_printing_manager.h" 51 #include "chrome/browser/printing/background_printing_manager.h"
51 #include "chrome/browser/printing/print_job_manager.h" 52 #include "chrome/browser/printing/print_job_manager.h"
52 #include "chrome/browser/printing/print_preview_tab_controller.h" 53 #include "chrome/browser/printing/print_preview_tab_controller.h"
53 #include "chrome/browser/profiles/profile_manager.h" 54 #include "chrome/browser/profiles/profile_manager.h"
54 #include "chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate. h" 55 #include "chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate. h"
55 #include "chrome/browser/safe_browsing/safe_browsing_service.h" 56 #include "chrome/browser/safe_browsing/safe_browsing_service.h"
56 #include "chrome/browser/shell_integration.h" 57 #include "chrome/browser/shell_integration.h"
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 automation_provider_list_.reset(); 178 automation_provider_list_.reset();
178 #endif 179 #endif
179 180
180 // We need to shutdown the SdchDictionaryFetcher as it regularly holds 181 // We need to shutdown the SdchDictionaryFetcher as it regularly holds
181 // a pointer to a URLFetcher, and that URLFetcher (upon destruction) will do 182 // a pointer to a URLFetcher, and that URLFetcher (upon destruction) will do
182 // a PostDelayedTask onto the IO thread. This shutdown call will both discard 183 // a PostDelayedTask onto the IO thread. This shutdown call will both discard
183 // any pending URLFetchers, and avoid creating any more. 184 // any pending URLFetchers, and avoid creating any more.
184 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, 185 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE,
185 base::Bind(&SdchDictionaryFetcher::Shutdown)); 186 base::Bind(&SdchDictionaryFetcher::Shutdown));
186 187
188 // Destroy PolicyStatisticsCollector before metrics, policy service and local
189 // state are down.
190 policy_statistics_collector_.reset();
191
187 // We need to destroy the MetricsService, VariationsService, 192 // We need to destroy the MetricsService, VariationsService,
188 // IntranetRedirectDetector, and SafeBrowsing ClientSideDetectionService 193 // IntranetRedirectDetector, and SafeBrowsing ClientSideDetectionService
189 // (owned by the SafeBrowsingService) before the io_thread_ gets destroyed, 194 // (owned by the SafeBrowsingService) before the io_thread_ gets destroyed,
190 // since their destructors can call the URLFetcher destructor, which does a 195 // since their destructors can call the URLFetcher destructor, which does a
191 // PostDelayedTask operation on the IO thread. (The IO thread will handle that 196 // PostDelayedTask operation on the IO thread. (The IO thread will handle that
192 // URLFetcher operation before going away.) 197 // URLFetcher operation before going away.)
193 metrics_service_.reset(); 198 metrics_service_.reset();
194 variations_service_.reset(); 199 variations_service_.reset();
195 intranet_redirect_detector_.reset(); 200 intranet_redirect_detector_.reset();
196 #if defined(ENABLE_SAFE_BROWSING) 201 #if defined(ENABLE_SAFE_BROWSING)
(...skipping 550 matching lines...) Expand 10 before | Expand all | Expand 10 after
747 752
748 #if defined(OS_WIN) 753 #if defined(OS_WIN)
749 if (base::win::GetVersion() >= base::win::VERSION_WIN8) 754 if (base::win::GetVersion() >= base::win::VERSION_WIN8)
750 local_state_->RegisterBooleanPref(prefs::kRestartSwitchMode, false); 755 local_state_->RegisterBooleanPref(prefs::kRestartSwitchMode, false);
751 #endif 756 #endif
752 } 757 }
753 758
754 void BrowserProcessImpl::PreCreateThreads() { 759 void BrowserProcessImpl::PreCreateThreads() {
755 io_thread_.reset(new IOThread( 760 io_thread_.reset(new IOThread(
756 local_state(), net_log_.get(), extension_event_router_forwarder_.get())); 761 local_state(), net_log_.get(), extension_event_router_forwarder_.get()));
762 policy_statistics_collector_.reset(new policy::PolicyStatisticsCollector(
763 policy_service_.get(),
764 local_state_.get(),
765 MessageLoop::current()->message_loop_proxy()));
757 } 766 }
758 767
759 void BrowserProcessImpl::PreMainMessageLoopRun() { 768 void BrowserProcessImpl::PreMainMessageLoopRun() {
760 PluginService* plugin_service = PluginService::GetInstance(); 769 PluginService* plugin_service = PluginService::GetInstance();
761 plugin_service->SetFilter(ChromePluginServiceFilter::GetInstance()); 770 plugin_service->SetFilter(ChromePluginServiceFilter::GetInstance());
762 plugin_service->StartWatchingPlugins(); 771 plugin_service->StartWatchingPlugins();
763 772
764 // Register the internal Flash if available. 773 // Register the internal Flash if available.
765 FilePath path; 774 FilePath path;
766 if (!CommandLine::ForCurrentProcess()->HasSwitch( 775 if (!CommandLine::ForCurrentProcess()->HasSwitch(
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
930 } 939 }
931 940
932 void BrowserProcessImpl::OnAutoupdateTimer() { 941 void BrowserProcessImpl::OnAutoupdateTimer() {
933 if (CanAutorestartForUpdate()) { 942 if (CanAutorestartForUpdate()) {
934 DLOG(WARNING) << "Detected update. Restarting browser."; 943 DLOG(WARNING) << "Detected update. Restarting browser.";
935 RestartBackgroundInstance(); 944 RestartBackgroundInstance();
936 } 945 }
937 } 946 }
938 947
939 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) 948 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698