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

Unified 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: Set storage monitor in browser process for unit tests. etc. Created 7 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/browser_process_impl.cc
diff --git a/chrome/browser/browser_process_impl.cc b/chrome/browser/browser_process_impl.cc
index 6673807f1b4a8ba24337e87802d4c40513f2125a..c6d099ac5750f27c8af0b565fd4337814a2e4e8e 100644
--- a/chrome/browser/browser_process_impl.cc
+++ b/chrome/browser/browser_process_impl.cc
@@ -61,6 +61,7 @@
#include "chrome/browser/safe_browsing/safe_browsing_service.h"
#include "chrome/browser/shell_integration.h"
#include "chrome/browser/status_icons/status_tray.h"
+#include "chrome/browser/storage_monitor/storage_monitor.h"
#include "chrome/browser/thumbnails/render_widget_snapshot_taker.h"
#include "chrome/browser/ui/bookmarks/bookmark_prompt_controller.h"
#include "chrome/browser/ui/browser_finder.h"
@@ -106,7 +107,7 @@
#include "ui/aura/env.h"
#endif
-#if !defined(OS_ANDROID)
+#if !defined(OS_ANDROID) && !defined(OS_IOS)
#include "chrome/browser/media_galleries/media_file_system_registry.h"
#endif
@@ -274,6 +275,15 @@ void BrowserProcessImpl::StartTearDown() {
#endif
platform_part()->StartTearDown();
+
+#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
+ media_file_system_registry_.reset();
+ // Delete |storage_monitor_| now. Otherwise the FILE thread would be gone
+ // when we try to release it in the dtor and Valgrind would report a
+ // leak on almost every single browser_test.
+ // TODO(gbillock): Make this unnecessary.
+ storage_monitor_.reset();
+#endif
}
void BrowserProcessImpl::PostDestroyThreads() {
@@ -619,9 +629,24 @@ BookmarkPromptController* BrowserProcessImpl::bookmark_prompt_controller() {
#endif
}
+chrome::StorageMonitor* BrowserProcessImpl::storage_monitor() {
+#if defined(OS_ANDROID) || defined(OS_IOS)
+ return NULL;
+#else
+ return storage_monitor_.get();
+#endif
+}
+
+void BrowserProcessImpl::set_storage_monitor_for_test(
+ scoped_ptr<chrome::StorageMonitor> monitor) {
+#if !defined(OS_ANDROID) && !defined(OS_IOS)
+ storage_monitor_ = monitor.Pass();
+#endif
+}
+
chrome::MediaFileSystemRegistry*
BrowserProcessImpl::media_file_system_registry() {
-#if defined(OS_ANDROID)
+#if defined(OS_ANDROID) || defined(OS_IOS)
return NULL;
#else
if (!media_file_system_registry_)
@@ -910,6 +935,10 @@ void BrowserProcessImpl::PreMainMessageLoopRun() {
}
#endif
+#if !defined(OS_ANDROID) && !defined(OS_IOS)
+ 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
+#endif
+
#if defined(OS_MACOSX)
app_shim_host_manager_.reset(new AppShimHostManager);
AppListService::InitAll(NULL);

Powered by Google App Engine
This is Rietveld 408576698