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/metrics/histogram_macros.h" |
20 #include "base/path_service.h" | 20 #include "base/path_service.h" |
21 #include "base/prefs/json_pref_store.h" | 21 #include "base/prefs/json_pref_store.h" |
22 #include "base/prefs/pref_registry_simple.h" | 22 #include "base/prefs/pref_registry_simple.h" |
23 #include "base/prefs/pref_service.h" | 23 #include "base/prefs/pref_service.h" |
24 #include "base/synchronization/waitable_event.h" | 24 #include "base/synchronization/waitable_event.h" |
25 #include "base/threading/thread.h" | 25 #include "base/threading/thread.h" |
26 #include "base/threading/thread_restrictions.h" | 26 #include "base/threading/thread_restrictions.h" |
27 #include "base/time/default_tick_clock.h" | 27 #include "base/time/default_tick_clock.h" |
28 #include "base/trace_event/trace_event.h" | 28 #include "base/trace_event/trace_event.h" |
29 #include "chrome/browser/chrome_browser_main.h" | 29 #include "chrome/browser/chrome_browser_main.h" |
| 30 #include "chrome/browser/chrome_child_process_watcher.h" |
30 #include "chrome/browser/chrome_content_browser_client.h" | 31 #include "chrome/browser/chrome_content_browser_client.h" |
31 #include "chrome/browser/chrome_notification_types.h" | 32 #include "chrome/browser/chrome_notification_types.h" |
32 #include "chrome/browser/component_updater/chrome_component_updater_configurator
.h" | 33 #include "chrome/browser/component_updater/chrome_component_updater_configurator
.h" |
33 #include "chrome/browser/component_updater/supervised_user_whitelist_installer.h
" | 34 #include "chrome/browser/component_updater/supervised_user_whitelist_installer.h
" |
34 #include "chrome/browser/defaults.h" | 35 #include "chrome/browser/defaults.h" |
35 #include "chrome/browser/devtools/remote_debugging_server.h" | 36 #include "chrome/browser/devtools/remote_debugging_server.h" |
36 #include "chrome/browser/download/download_request_limiter.h" | 37 #include "chrome/browser/download/download_request_limiter.h" |
37 #include "chrome/browser/download/download_status_updater.h" | 38 #include "chrome/browser/download/download_status_updater.h" |
38 #include "chrome/browser/first_run/upgrade_util.h" | 39 #include "chrome/browser/first_run/upgrade_util.h" |
39 #include "chrome/browser/gpu/gl_string_manager.h" | 40 #include "chrome/browser/gpu/gl_string_manager.h" |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 // can be destroyed. | 267 // can be destroyed. |
267 if (switches::IsNewAvatarMenu()) | 268 if (switches::IsNewAvatarMenu()) |
268 UserManager::Hide(); | 269 UserManager::Hide(); |
269 profile_manager_.reset(); | 270 profile_manager_.reset(); |
270 } | 271 } |
271 | 272 |
272 // PromoResourceService must be destroyed after the keyed services and before | 273 // PromoResourceService must be destroyed after the keyed services and before |
273 // the IO thread. | 274 // the IO thread. |
274 promo_resource_service_.reset(); | 275 promo_resource_service_.reset(); |
275 | 276 |
| 277 child_process_watcher_.reset(); |
| 278 |
276 #if !defined(OS_ANDROID) | 279 #if !defined(OS_ANDROID) |
277 // Debugger must be cleaned up before IO thread and NotificationService. | 280 // Debugger must be cleaned up before IO thread and NotificationService. |
278 remote_debugging_server_.reset(); | 281 remote_debugging_server_.reset(); |
279 #endif | 282 #endif |
280 | 283 |
281 #if defined(ENABLE_EXTENSIONS) | 284 #if defined(ENABLE_EXTENSIONS) |
282 ExtensionRendererState::GetInstance()->Shutdown(); | 285 ExtensionRendererState::GetInstance()->Shutdown(); |
283 | 286 |
284 media_file_system_registry_.reset(); | 287 media_file_system_registry_.reset(); |
285 // Remove the global instance of the Storage Monitor now. Otherwise the | 288 // Remove the global instance of the Storage Monitor now. Otherwise the |
(...skipping 768 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1054 if (!command_line.HasSwitch(switches::kDisableWebResources)) { | 1057 if (!command_line.HasSwitch(switches::kDisableWebResources)) { |
1055 DCHECK(!promo_resource_service_.get()); | 1058 DCHECK(!promo_resource_service_.get()); |
1056 promo_resource_service_.reset(new PromoResourceService); | 1059 promo_resource_service_.reset(new PromoResourceService); |
1057 promo_resource_service_->StartAfterDelay(); | 1060 promo_resource_service_->StartAfterDelay(); |
1058 } | 1061 } |
1059 | 1062 |
1060 #if !defined(OS_ANDROID) && !defined(OS_IOS) | 1063 #if !defined(OS_ANDROID) && !defined(OS_IOS) |
1061 storage_monitor::StorageMonitor::Create(); | 1064 storage_monitor::StorageMonitor::Create(); |
1062 #endif | 1065 #endif |
1063 | 1066 |
| 1067 child_process_watcher_.reset(new ChromeChildProcessWatcher()); |
| 1068 |
1064 platform_part_->PreMainMessageLoopRun(); | 1069 platform_part_->PreMainMessageLoopRun(); |
1065 } | 1070 } |
1066 | 1071 |
1067 void BrowserProcessImpl::CreateIconManager() { | 1072 void BrowserProcessImpl::CreateIconManager() { |
1068 DCHECK(!created_icon_manager_ && icon_manager_.get() == NULL); | 1073 DCHECK(!created_icon_manager_ && icon_manager_.get() == NULL); |
1069 created_icon_manager_ = true; | 1074 created_icon_manager_ = true; |
1070 icon_manager_.reset(new IconManager); | 1075 icon_manager_.reset(new IconManager); |
1071 } | 1076 } |
1072 | 1077 |
1073 void BrowserProcessImpl::CreateIntranetRedirectDetector() { | 1078 void BrowserProcessImpl::CreateIntranetRedirectDetector() { |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1224 } | 1229 } |
1225 | 1230 |
1226 void BrowserProcessImpl::OnAutoupdateTimer() { | 1231 void BrowserProcessImpl::OnAutoupdateTimer() { |
1227 if (CanAutorestartForUpdate()) { | 1232 if (CanAutorestartForUpdate()) { |
1228 DLOG(WARNING) << "Detected update. Restarting browser."; | 1233 DLOG(WARNING) << "Detected update. Restarting browser."; |
1229 RestartBackgroundInstance(); | 1234 RestartBackgroundInstance(); |
1230 } | 1235 } |
1231 } | 1236 } |
1232 | 1237 |
1233 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) | 1238 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) |
OLD | NEW |