Backed out changeset 1b9344ef3810. r=revert.

--HG--
extra : rebase_source : 7a6648696d8d3f806d1770820f9d9a2058c56d66
This commit is contained in:
Rafael Ávila de Espíndola 2011-11-30 20:17:07 -05:00
Родитель bf34feea89
Коммит df5ac81312
6 изменённых файлов: 4 добавлений и 54 удалений

Просмотреть файл

@ -304,6 +304,8 @@ nsDOMStorageManager::Initialize()
// Used for temporary table flushing
rv = os->AddObserver(gStorageManager, "profile-before-change", true);
NS_ENSURE_SUCCESS(rv, rv);
rv = os->AddObserver(gStorageManager, NS_XPCOM_SHUTDOWN_OBSERVER_ID, true);
NS_ENSURE_SUCCESS(rv, rv);
rv = os->AddObserver(gStorageManager, NS_DOMSTORAGE_FLUSH_TIMER_TOPIC, true);
NS_ENSURE_SUCCESS(rv, rv);
@ -327,14 +329,6 @@ nsDOMStorageManager::Shutdown()
NS_IF_RELEASE(gStorageManager);
gStorageManager = nsnull;
ShutdownDB();
}
//static
void
nsDOMStorageManager::ShutdownDB()
{
DOMStorageImpl::gStorageDB->Close();
delete DOMStorageImpl::gStorageDB;
DOMStorageImpl::gStorageDB = nsnull;
}
@ -490,13 +484,13 @@ nsDOMStorageManager::Observe(nsISupports *aSubject,
NS_ENSURE_SUCCESS(rv, rv);
DOMStorageImpl::gStorageDB->RemoveOwner(aceDomain, true);
} else if (!strcmp(aTopic, "profile-before-change")) {
} else if (!strcmp(aTopic, "profile-before-change") ||
!strcmp(aTopic, NS_XPCOM_SHUTDOWN_OBSERVER_ID)) {
if (DOMStorageImpl::gStorageDB) {
DebugOnly<nsresult> rv =
DOMStorageImpl::gStorageDB->FlushAndDeleteTemporaryTables(true);
NS_WARN_IF_FALSE(NS_SUCCEEDED(rv),
"DOMStorage: temporary table commit failed");
nsDOMStorageManager::ShutdownDB();
}
} else if (!strcmp(aTopic, NS_DOMSTORAGE_FLUSH_TIMER_TOPIC)) {
if (DOMStorageImpl::gStorageDB) {

Просмотреть файл

@ -129,7 +129,6 @@ public:
static nsresult Initialize();
static nsDOMStorageManager* GetInstance();
static void Shutdown();
static void ShutdownDB();
/**
* Checks whether there is any data waiting to be flushed from a temp table.

Просмотреть файл

@ -78,13 +78,6 @@ nsDOMStorageDBWrapper::~nsDOMStorageDBWrapper()
{
}
void
nsDOMStorageDBWrapper::Close()
{
mPersistentDB.Close();
mChromePersistentDB.Close();
}
nsresult
nsDOMStorageDBWrapper::Init()
{

Просмотреть файл

@ -89,11 +89,6 @@ public:
nsDOMStorageDBWrapper();
~nsDOMStorageDBWrapper();
/**
* Close the connections, finalizing all the cached statements.
*/
void Close();
nsresult
Init();

Просмотреть файл

@ -54,8 +54,6 @@
#include "mozIStorageFunction.h"
#include "nsNetUtil.h"
using namespace mozilla;
// Temporary tables for a storage scope will be flushed if found older
// then this time in seconds since the load
#define TEMP_TABLE_MAX_AGE (10) // seconds
@ -449,28 +447,6 @@ nsDOMStoragePersistentDB::Init(const nsString& aDatabaseName)
return NS_OK;
}
void
nsDOMStoragePersistentDB::Close()
{
// Null the statements, this will finalize them.
mCopyToTempTableStatement = nsnull;
mCopyBackToDiskStatement = nsnull;
mDeleteTemporaryTableStatement = nsnull;
mGetAllKeysStatement = nsnull;
mGetKeyValueStatement = nsnull;
mInsertKeyStatement = nsnull;
mSetSecureStatement = nsnull;
mRemoveKeyStatement = nsnull;
mRemoveOwnerStatement = nsnull;
mRemoveStorageStatement = nsnull;
mRemoveAllStatement = nsnull;
mGetOfflineExcludedUsageStatement = nsnull;
mGetFullUsageStatement = nsnull;
DebugOnly<nsresult> rv = mConnection->Close();
MOZ_ASSERT(NS_SUCCEEDED(rv));
}
nsresult
nsDOMStoragePersistentDB::EnsureLoadTemporaryTableForStorage(DOMStorageImpl* aStorage)
{

Просмотреть файл

@ -62,12 +62,6 @@ public:
nsresult
Init(const nsString& aDatabaseName);
/**
* Close the connection, finalizing all the cached statements.
*/
void
Close();
/**
* Retrieve a list of all the keys associated with a particular domain.
*/
@ -205,7 +199,6 @@ protected:
nsCOMPtr<mozIStorageStatement> mRemoveAllStatement;
nsCOMPtr<mozIStorageStatement> mGetOfflineExcludedUsageStatement;
nsCOMPtr<mozIStorageStatement> mGetFullUsageStatement;
// If you add an statement, remember to null in in Close.
nsCString mCachedOwner;
PRInt32 mCachedUsage;