From 60c83971fb19dea49beab3a02c8913f75f62ad09 Mon Sep 17 00:00:00 2001 From: wolfbeast Date: Fri, 8 Nov 2019 10:49:03 +0100 Subject: Issue #1263 - Part 1: Remove DiskSpaceWatcher --- dom/indexedDB/IndexedDatabaseManager.cpp | 75 +------------------------------- 1 file changed, 1 insertion(+), 74 deletions(-) (limited to 'dom/indexedDB/IndexedDatabaseManager.cpp') diff --git a/dom/indexedDB/IndexedDatabaseManager.cpp b/dom/indexedDB/IndexedDatabaseManager.cpp index 62ba51c08..213de5cc9 100644 --- a/dom/indexedDB/IndexedDatabaseManager.cpp +++ b/dom/indexedDB/IndexedDatabaseManager.cpp @@ -8,11 +8,9 @@ #include "chrome/common/ipc_channel.h" // for IPC::Channel::kMaximumMessageSize #include "nsIConsoleService.h" -#include "nsIDiskSpaceWatcher.h" #include "nsIDOMWindow.h" #include "nsIEventTarget.h" #include "nsIFile.h" -#include "nsIObserverService.h" #include "nsIScriptError.h" #include "nsIScriptGlobalObject.h" @@ -64,11 +62,6 @@ #define IDB_STR "indexedDB" -// The two possible values for the data argument when receiving the disk space -// observer notification. -#define LOW_DISK_SPACE_DATA_FULL "full" -#define LOW_DISK_SPACE_DATA_FREE "free" - namespace mozilla { namespace dom { namespace indexedDB { @@ -313,8 +306,6 @@ Atomic IndexedDatabaseManager::sLoggingMode( IndexedDatabaseManager::Logging_Disabled); -mozilla::Atomic IndexedDatabaseManager::sLowDiskSpaceMode(false); - // static IndexedDatabaseManager* IndexedDatabaseManager::GetOrCreate() @@ -329,24 +320,6 @@ IndexedDatabaseManager::GetOrCreate() if (!gDBManager) { sIsMainProcess = XRE_IsParentProcess(); - if (sIsMainProcess && Preferences::GetBool("disk_space_watcher.enabled", false)) { - // See if we're starting up in low disk space conditions. - nsCOMPtr watcher = - do_GetService(DISKSPACEWATCHER_CONTRACTID); - if (watcher) { - bool isDiskFull; - if (NS_SUCCEEDED(watcher->GetIsDiskFull(&isDiskFull))) { - sLowDiskSpaceMode = isDiskFull; - } - else { - NS_WARNING("GetIsDiskFull failed!"); - } - } - else { - NS_WARNING("No disk space watcher component available!"); - } - } - RefPtr instance(new IndexedDatabaseManager()); nsresult rv = instance->Init(); @@ -380,13 +353,6 @@ IndexedDatabaseManager::Init() // During Init() we can't yet call IsMainProcess(), just check sIsMainProcess // directly. if (sIsMainProcess) { - nsCOMPtr obs = mozilla::services::GetObserverService(); - NS_ENSURE_STATE(obs); - - nsresult rv = - obs->AddObserver(this, DISKSPACEWATCHER_OBSERVER_TOPIC, false); - NS_ENSURE_SUCCESS(rv, rv); - mDeleteTimer = do_CreateInstance(NS_TIMER_CONTRACTID); NS_ENSURE_STATE(mDeleteTimer); @@ -680,16 +646,6 @@ IndexedDatabaseManager::IsMainProcess() return sIsMainProcess; } -//static -bool -IndexedDatabaseManager::InLowDiskSpaceMode() -{ - NS_ASSERTION(gDBManager, - "InLowDiskSpaceMode() called before indexedDB has been " - "initialized!"); - return sLowDiskSpaceMode; -} - // static IndexedDatabaseManager::LoggingMode IndexedDatabaseManager::GetLoggingMode() @@ -1087,36 +1043,7 @@ IndexedDatabaseManager::GetLocale() NS_IMPL_ADDREF(IndexedDatabaseManager) NS_IMPL_RELEASE_WITH_DESTROY(IndexedDatabaseManager, Destroy()) -NS_IMPL_QUERY_INTERFACE(IndexedDatabaseManager, nsIObserver, nsITimerCallback) - -NS_IMETHODIMP -IndexedDatabaseManager::Observe(nsISupports* aSubject, const char* aTopic, - const char16_t* aData) -{ - NS_ASSERTION(IsMainProcess(), "Wrong process!"); - NS_ASSERTION(NS_IsMainThread(), "Wrong thread!"); - - if (!strcmp(aTopic, DISKSPACEWATCHER_OBSERVER_TOPIC)) { - NS_ASSERTION(aData, "No data?!"); - - const nsDependentString data(aData); - - if (data.EqualsLiteral(LOW_DISK_SPACE_DATA_FULL)) { - sLowDiskSpaceMode = true; - } - else if (data.EqualsLiteral(LOW_DISK_SPACE_DATA_FREE)) { - sLowDiskSpaceMode = false; - } - else { - NS_NOTREACHED("Unknown data value!"); - } - - return NS_OK; - } - - NS_NOTREACHED("Unknown topic!"); - return NS_ERROR_UNEXPECTED; -} +NS_IMPL_QUERY_INTERFACE(IndexedDatabaseManager, nsITimerCallback) NS_IMETHODIMP IndexedDatabaseManager::Notify(nsITimer* aTimer) -- cgit v1.2.3