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

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

Issue 16703025: [StorageMonitor] Move StorageMonitor ownership to BrowserProcessImpl (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 7 years, 6 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 <vector> 9 #include <vector>
10 10
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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
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)
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
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
622 chrome::MediaFileSystemRegistry* 640 chrome::MediaFileSystemRegistry*
623 BrowserProcessImpl::media_file_system_registry() { 641 BrowserProcessImpl::media_file_system_registry() {
624 #if defined(OS_ANDROID) 642 #if defined(OS_ANDROID) || defined(OS_IOS)
625 return NULL; 643 return NULL;
626 #else 644 #else
627 if (!media_file_system_registry_) 645 if (!media_file_system_registry_)
628 media_file_system_registry_.reset(new chrome::MediaFileSystemRegistry()); 646 media_file_system_registry_.reset(new chrome::MediaFileSystemRegistry());
629 return media_file_system_registry_.get(); 647 return media_file_system_registry_.get();
630 #endif 648 #endif
631 } 649 }
632 650
633 bool BrowserProcessImpl::created_local_state() const { 651 bool BrowserProcessImpl::created_local_state() const {
634 return created_local_state_; 652 return created_local_state_;
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
896 DCHECK(!promo_resource_service_.get()); 914 DCHECK(!promo_resource_service_.get());
897 promo_resource_service_ = new PromoResourceService; 915 promo_resource_service_ = new PromoResourceService;
898 promo_resource_service_->StartAfterDelay(); 916 promo_resource_service_->StartAfterDelay();
899 } 917 }
900 918
901 #if !defined(OS_ANDROID) 919 #if !defined(OS_ANDROID)
902 if (browser_defaults::bookmarks_enabled && 920 if (browser_defaults::bookmarks_enabled &&
903 BookmarkPromptController::IsEnabled()) { 921 BookmarkPromptController::IsEnabled()) {
904 bookmark_prompt_controller_.reset(new BookmarkPromptController()); 922 bookmark_prompt_controller_.reset(new BookmarkPromptController());
905 } 923 }
924
925 storage_monitor_.reset(chrome::StorageMonitor::Create());
Lei Zhang 2013/06/27 00:09:38 Should this also be !OS_IOS, or are we already in
Greg Billock 2013/06/27 18:25:43 Not sure. I'll make this explicit.
906 #endif 926 #endif
907 927
908 #if defined(OS_MACOSX) 928 #if defined(OS_MACOSX)
909 app_shim_host_manager_.reset(new AppShimHostManager); 929 app_shim_host_manager_.reset(new AppShimHostManager);
910 AppListService::InitAll(NULL); 930 AppListService::InitAll(NULL);
911 #endif 931 #endif
912 } 932 }
913 933
914 void BrowserProcessImpl::CreateIconManager() { 934 void BrowserProcessImpl::CreateIconManager() {
915 DCHECK(!created_icon_manager_ && icon_manager_.get() == NULL); 935 DCHECK(!created_icon_manager_ && icon_manager_.get() == NULL);
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
1037 } 1057 }
1038 1058
1039 void BrowserProcessImpl::OnAutoupdateTimer() { 1059 void BrowserProcessImpl::OnAutoupdateTimer() {
1040 if (CanAutorestartForUpdate()) { 1060 if (CanAutorestartForUpdate()) {
1041 DLOG(WARNING) << "Detected update. Restarting browser."; 1061 DLOG(WARNING) << "Detected update. Restarting browser.";
1042 RestartBackgroundInstance(); 1062 RestartBackgroundInstance();
1043 } 1063 }
1044 } 1064 }
1045 1065
1046 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) 1066 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698