OLD | NEW |
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 <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/atomic_ref_count.h" | 11 #include "base/atomic_ref_count.h" |
12 #include "base/bind.h" | 12 #include "base/bind.h" |
13 #include "base/bind_helpers.h" | 13 #include "base/bind_helpers.h" |
14 #include "base/command_line.h" | 14 #include "base/command_line.h" |
15 #include "base/debug/alias.h" | 15 #include "base/debug/alias.h" |
16 #include "base/debug/leak_annotations.h" | 16 #include "base/debug/leak_annotations.h" |
17 #include "base/files/file_path.h" | 17 #include "base/files/file_path.h" |
18 #include "base/metrics/field_trial.h" | 18 #include "base/metrics/field_trial.h" |
| 19 #include "base/metrics/histogram_macros.h" |
19 #include "base/path_service.h" | 20 #include "base/path_service.h" |
20 #include "base/prefs/json_pref_store.h" | 21 #include "base/prefs/json_pref_store.h" |
21 #include "base/prefs/pref_registry_simple.h" | 22 #include "base/prefs/pref_registry_simple.h" |
22 #include "base/prefs/pref_service.h" | 23 #include "base/prefs/pref_service.h" |
23 #include "base/synchronization/waitable_event.h" | 24 #include "base/synchronization/waitable_event.h" |
24 #include "base/threading/thread.h" | 25 #include "base/threading/thread.h" |
25 #include "base/threading/thread_restrictions.h" | 26 #include "base/threading/thread_restrictions.h" |
26 #include "base/time/default_tick_clock.h" | 27 #include "base/time/default_tick_clock.h" |
| 28 #include "base/trace_event/trace_event.h" |
27 #include "chrome/browser/chrome_browser_main.h" | 29 #include "chrome/browser/chrome_browser_main.h" |
28 #include "chrome/browser/chrome_content_browser_client.h" | 30 #include "chrome/browser/chrome_content_browser_client.h" |
29 #include "chrome/browser/chrome_notification_types.h" | 31 #include "chrome/browser/chrome_notification_types.h" |
30 #include "chrome/browser/component_updater/chrome_component_updater_configurator
.h" | 32 #include "chrome/browser/component_updater/chrome_component_updater_configurator
.h" |
31 #include "chrome/browser/component_updater/supervised_user_whitelist_installer.h
" | 33 #include "chrome/browser/component_updater/supervised_user_whitelist_installer.h
" |
32 #include "chrome/browser/defaults.h" | 34 #include "chrome/browser/defaults.h" |
33 #include "chrome/browser/devtools/remote_debugging_server.h" | 35 #include "chrome/browser/devtools/remote_debugging_server.h" |
34 #include "chrome/browser/download/download_request_limiter.h" | 36 #include "chrome/browser/download/download_request_limiter.h" |
35 #include "chrome/browser/download/download_status_updater.h" | 37 #include "chrome/browser/download/download_status_updater.h" |
36 #include "chrome/browser/first_run/upgrade_util.h" | 38 #include "chrome/browser/first_run/upgrade_util.h" |
(...skipping 952 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
989 net::HttpNetworkSession::NORMAL_SOCKET_POOL))); | 991 net::HttpNetworkSession::NORMAL_SOCKET_POOL))); |
990 } | 992 } |
991 | 993 |
992 void BrowserProcessImpl::PreCreateThreads() { | 994 void BrowserProcessImpl::PreCreateThreads() { |
993 io_thread_.reset( | 995 io_thread_.reset( |
994 new IOThread(local_state(), policy_service(), net_log_.get(), | 996 new IOThread(local_state(), policy_service(), net_log_.get(), |
995 extension_event_router_forwarder())); | 997 extension_event_router_forwarder())); |
996 } | 998 } |
997 | 999 |
998 void BrowserProcessImpl::PreMainMessageLoopRun() { | 1000 void BrowserProcessImpl::PreMainMessageLoopRun() { |
| 1001 TRACE_EVENT0("startup", "BrowserProcessImpl::PreMainMessageLoopRun"); |
| 1002 SCOPED_UMA_HISTOGRAM_TIMER( |
| 1003 "Startup.BrowserProcessImpl_PreMainMessageLoopRunTime"); |
| 1004 |
999 #if defined(ENABLE_CONFIGURATION_POLICY) | 1005 #if defined(ENABLE_CONFIGURATION_POLICY) |
1000 // browser_policy_connector() is created very early because local_state() | 1006 // browser_policy_connector() is created very early because local_state() |
1001 // needs policy to be initialized with the managed preference values. | 1007 // needs policy to be initialized with the managed preference values. |
1002 // However, policy fetches from the network and loading of disk caches | 1008 // However, policy fetches from the network and loading of disk caches |
1003 // requires that threads are running; this Init() call lets the connector | 1009 // requires that threads are running; this Init() call lets the connector |
1004 // resume its initialization now that the loops are spinning and the | 1010 // resume its initialization now that the loops are spinning and the |
1005 // system request context is available for the fetchers. | 1011 // system request context is available for the fetchers. |
1006 browser_policy_connector()->Init(local_state(), system_request_context()); | 1012 browser_policy_connector()->Init(local_state(), system_request_context()); |
1007 #endif | 1013 #endif |
1008 | 1014 |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1214 } | 1220 } |
1215 | 1221 |
1216 void BrowserProcessImpl::OnAutoupdateTimer() { | 1222 void BrowserProcessImpl::OnAutoupdateTimer() { |
1217 if (CanAutorestartForUpdate()) { | 1223 if (CanAutorestartForUpdate()) { |
1218 DLOG(WARNING) << "Detected update. Restarting browser."; | 1224 DLOG(WARNING) << "Detected update. Restarting browser."; |
1219 RestartBackgroundInstance(); | 1225 RestartBackgroundInstance(); |
1220 } | 1226 } |
1221 } | 1227 } |
1222 | 1228 |
1223 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) | 1229 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) |
OLD | NEW |