Chromium Code Reviews| 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 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 54 #include "chrome/browser/prefs/chrome_pref_service_factory.h" | 54 #include "chrome/browser/prefs/chrome_pref_service_factory.h" |
| 55 #include "chrome/browser/prerender/prerender_tracker.h" | 55 #include "chrome/browser/prerender/prerender_tracker.h" |
| 56 #include "chrome/browser/printing/background_printing_manager.h" | 56 #include "chrome/browser/printing/background_printing_manager.h" |
| 57 #include "chrome/browser/printing/print_job_manager.h" | 57 #include "chrome/browser/printing/print_job_manager.h" |
| 58 #include "chrome/browser/printing/print_preview_dialog_controller.h" | 58 #include "chrome/browser/printing/print_preview_dialog_controller.h" |
| 59 #include "chrome/browser/profiles/profile_manager.h" | 59 #include "chrome/browser/profiles/profile_manager.h" |
| 60 #include "chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate. h" | 60 #include "chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate. h" |
| 61 #include "chrome/browser/safe_browsing/safe_browsing_service.h" | 61 #include "chrome/browser/safe_browsing/safe_browsing_service.h" |
| 62 #include "chrome/browser/shell_integration.h" | 62 #include "chrome/browser/shell_integration.h" |
| 63 #include "chrome/browser/status_icons/status_tray.h" | 63 #include "chrome/browser/status_icons/status_tray.h" |
| 64 #include "chrome/browser/storage_monitor/storage_monitor.h" | |
| 64 #include "chrome/browser/thumbnails/render_widget_snapshot_taker.h" | 65 #include "chrome/browser/thumbnails/render_widget_snapshot_taker.h" |
| 65 #include "chrome/browser/ui/bookmarks/bookmark_prompt_controller.h" | 66 #include "chrome/browser/ui/bookmarks/bookmark_prompt_controller.h" |
| 66 #include "chrome/browser/ui/browser_finder.h" | 67 #include "chrome/browser/ui/browser_finder.h" |
| 67 #include "chrome/browser/web_resource/promo_resource_service.h" | 68 #include "chrome/browser/web_resource/promo_resource_service.h" |
| 68 #include "chrome/common/chrome_constants.h" | 69 #include "chrome/common/chrome_constants.h" |
| 69 #include "chrome/common/chrome_notification_types.h" | 70 #include "chrome/common/chrome_notification_types.h" |
| 70 #include "chrome/common/chrome_paths.h" | 71 #include "chrome/common/chrome_paths.h" |
| 71 #include "chrome/common/chrome_switches.h" | 72 #include "chrome/common/chrome_switches.h" |
| 72 #include "chrome/common/extensions/chrome_manifest_handlers.h" | 73 #include "chrome/common/extensions/chrome_manifest_handlers.h" |
| 73 #include "chrome/common/extensions/extension_l10n_util.h" | 74 #include "chrome/common/extensions/extension_l10n_util.h" |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 99 #include "base/win/windows_version.h" | 100 #include "base/win/windows_version.h" |
| 100 #include "ui/views/focus/view_storage.h" | 101 #include "ui/views/focus/view_storage.h" |
| 101 #elif defined(OS_MACOSX) | 102 #elif defined(OS_MACOSX) |
| 102 #include "chrome/browser/chrome_browser_main_mac.h" | 103 #include "chrome/browser/chrome_browser_main_mac.h" |
| 103 #endif | 104 #endif |
| 104 | 105 |
| 105 #if defined(USE_AURA) | 106 #if defined(USE_AURA) |
| 106 #include "ui/aura/env.h" | 107 #include "ui/aura/env.h" |
| 107 #endif | 108 #endif |
| 108 | 109 |
| 109 #if !defined(OS_ANDROID) | 110 #if !defined(OS_ANDROID) && !defined(OS_IOS) |
| 110 #include "chrome/browser/media_galleries/media_file_system_registry.h" | 111 #include "chrome/browser/media_galleries/media_file_system_registry.h" |
| 111 #endif | 112 #endif |
| 112 | 113 |
| 113 #if defined(ENABLE_PLUGIN_INSTALLATION) | 114 #if defined(ENABLE_PLUGIN_INSTALLATION) |
| 114 #include "chrome/browser/plugins/plugins_resource_service.h" | 115 #include "chrome/browser/plugins/plugins_resource_service.h" |
| 115 #endif | 116 #endif |
| 116 | 117 |
| 117 #if defined(OS_MACOSX) | 118 #if defined(OS_MACOSX) |
| 118 #include "apps/app_shim/app_shim_host_manager_mac.h" | 119 #include "apps/app_shim/app_shim_host_manager_mac.h" |
| 119 #include "chrome/browser/ui/app_list/app_list_service.h" | 120 #include "chrome/browser/ui/app_list/app_list_service.h" |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 267 // Delete aura after the metrics service has been deleted as it accesses | 268 // Delete aura after the metrics service has been deleted as it accesses |
| 268 // monitor information. | 269 // monitor information. |
| 269 aura::Env::DeleteInstance(); | 270 aura::Env::DeleteInstance(); |
| 270 #endif | 271 #endif |
| 271 | 272 |
| 272 #if defined(OS_MACOSX) | 273 #if defined(OS_MACOSX) |
| 273 app_shim_host_manager_.reset(); | 274 app_shim_host_manager_.reset(); |
| 274 #endif | 275 #endif |
| 275 | 276 |
| 276 platform_part()->StartTearDown(); | 277 platform_part()->StartTearDown(); |
| 278 | |
| 279 #if !defined(OS_ANDROID) && !defined(OS_IOS) | |
|
vandebo (ex-Chrome)
2013/07/09 15:38:12
Without any other context, I would guess this shou
Greg Billock
2013/07/09 17:35:21
Is it? OK, moved.
vandebo (ex-Chrome)
2013/07/09 21:14:11
content::NOTIFICATION_RENDERER_PROCESS_TERMINATED,
Greg Billock
2013/07/09 21:29:06
Those are through the NotificationService. Looks l
| |
| 280 media_file_system_registry_.reset(); | |
| 281 // Delete |storage_monitor_| now. Otherwise the FILE thread would be gone | |
| 282 // when we try to release it in the dtor and Valgrind would report a | |
| 283 // leak on almost every single browser_test. | |
| 284 // TODO(gbillock): Make this unnecessary. | |
| 285 storage_monitor_.reset(); | |
| 286 #endif | |
| 277 } | 287 } |
| 278 | 288 |
| 279 void BrowserProcessImpl::PostDestroyThreads() { | 289 void BrowserProcessImpl::PostDestroyThreads() { |
| 280 // With the file_thread_ flushed, we can release any icon resources. | 290 // With the file_thread_ flushed, we can release any icon resources. |
| 281 icon_manager_.reset(); | 291 icon_manager_.reset(); |
| 282 | 292 |
| 283 // Reset associated state right after actual thread is stopped, | 293 // Reset associated state right after actual thread is stopped, |
| 284 // as io_thread_.global_ cleanup happens in CleanUp on the IO | 294 // as io_thread_.global_ cleanup happens in CleanUp on the IO |
| 285 // thread, i.e. as the thread exits its message loop. | 295 // thread, i.e. as the thread exits its message loop. |
| 286 // | 296 // |
| (...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 612 } | 622 } |
| 613 | 623 |
| 614 BookmarkPromptController* BrowserProcessImpl::bookmark_prompt_controller() { | 624 BookmarkPromptController* BrowserProcessImpl::bookmark_prompt_controller() { |
| 615 #if defined(OS_ANDROID) | 625 #if defined(OS_ANDROID) |
| 616 return NULL; | 626 return NULL; |
| 617 #else | 627 #else |
| 618 return bookmark_prompt_controller_.get(); | 628 return bookmark_prompt_controller_.get(); |
| 619 #endif | 629 #endif |
| 620 } | 630 } |
| 621 | 631 |
| 632 chrome::StorageMonitor* BrowserProcessImpl::storage_monitor() { | |
| 633 #if defined(OS_ANDROID) || defined(OS_IOS) | |
| 634 return NULL; | |
| 635 #else | |
| 636 return storage_monitor_.get(); | |
| 637 #endif | |
| 638 } | |
| 639 | |
| 640 void BrowserProcessImpl::set_storage_monitor_for_test( | |
| 641 scoped_ptr<chrome::StorageMonitor> monitor) { | |
| 642 #if !defined(OS_ANDROID) && !defined(OS_IOS) | |
| 643 storage_monitor_ = monitor.Pass(); | |
| 644 #endif | |
| 645 } | |
| 646 | |
| 622 chrome::MediaFileSystemRegistry* | 647 chrome::MediaFileSystemRegistry* |
| 623 BrowserProcessImpl::media_file_system_registry() { | 648 BrowserProcessImpl::media_file_system_registry() { |
| 624 #if defined(OS_ANDROID) | 649 #if defined(OS_ANDROID) || defined(OS_IOS) |
| 625 return NULL; | 650 return NULL; |
| 626 #else | 651 #else |
| 627 if (!media_file_system_registry_) | 652 if (!media_file_system_registry_) |
| 628 media_file_system_registry_.reset(new chrome::MediaFileSystemRegistry()); | 653 media_file_system_registry_.reset(new chrome::MediaFileSystemRegistry()); |
| 629 return media_file_system_registry_.get(); | 654 return media_file_system_registry_.get(); |
| 630 #endif | 655 #endif |
| 631 } | 656 } |
| 632 | 657 |
| 633 bool BrowserProcessImpl::created_local_state() const { | 658 bool BrowserProcessImpl::created_local_state() const { |
| 634 return created_local_state_; | 659 return created_local_state_; |
| (...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 903 promo_resource_service_->StartAfterDelay(); | 928 promo_resource_service_->StartAfterDelay(); |
| 904 } | 929 } |
| 905 | 930 |
| 906 #if !defined(OS_ANDROID) | 931 #if !defined(OS_ANDROID) |
| 907 if (browser_defaults::bookmarks_enabled && | 932 if (browser_defaults::bookmarks_enabled && |
| 908 BookmarkPromptController::IsEnabled()) { | 933 BookmarkPromptController::IsEnabled()) { |
| 909 bookmark_prompt_controller_.reset(new BookmarkPromptController()); | 934 bookmark_prompt_controller_.reset(new BookmarkPromptController()); |
| 910 } | 935 } |
| 911 #endif | 936 #endif |
| 912 | 937 |
| 938 #if !defined(OS_ANDROID) && !defined(OS_IOS) | |
| 939 storage_monitor_.reset(chrome::StorageMonitor::Create()); | |
|
vandebo (ex-Chrome)
2013/07/09 15:38:12
Why not create this on first access like MediaFile
Greg Billock
2013/07/09 17:35:21
My aim here is to maintain exactly the same startu
| |
| 940 #endif | |
| 941 | |
| 913 #if defined(OS_MACOSX) | 942 #if defined(OS_MACOSX) |
| 914 app_shim_host_manager_.reset(new AppShimHostManager); | 943 app_shim_host_manager_.reset(new AppShimHostManager); |
| 915 AppListService::InitAll(NULL); | 944 AppListService::InitAll(NULL); |
| 916 #endif | 945 #endif |
| 917 } | 946 } |
| 918 | 947 |
| 919 void BrowserProcessImpl::CreateIconManager() { | 948 void BrowserProcessImpl::CreateIconManager() { |
| 920 DCHECK(!created_icon_manager_ && icon_manager_.get() == NULL); | 949 DCHECK(!created_icon_manager_ && icon_manager_.get() == NULL); |
| 921 created_icon_manager_ = true; | 950 created_icon_manager_ = true; |
| 922 icon_manager_.reset(new IconManager); | 951 icon_manager_.reset(new IconManager); |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1042 } | 1071 } |
| 1043 | 1072 |
| 1044 void BrowserProcessImpl::OnAutoupdateTimer() { | 1073 void BrowserProcessImpl::OnAutoupdateTimer() { |
| 1045 if (CanAutorestartForUpdate()) { | 1074 if (CanAutorestartForUpdate()) { |
| 1046 DLOG(WARNING) << "Detected update. Restarting browser."; | 1075 DLOG(WARNING) << "Detected update. Restarting browser."; |
| 1047 RestartBackgroundInstance(); | 1076 RestartBackgroundInstance(); |
| 1048 } | 1077 } |
| 1049 } | 1078 } |
| 1050 | 1079 |
| 1051 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) | 1080 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) |
| OLD | NEW |