mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-22 15:17:29 +09:00
Issue #2672 - Part 3: Ensure thread lifetimes are in tandem.
This commit is contained in:
parent
fe53a0bb1c
commit
032b0ae0d8
1 changed files with 7 additions and 7 deletions
|
|
@ -598,9 +598,6 @@ nsCookieService::Init()
|
||||||
mStorageService = do_GetService("@mozilla.org/storage/service;1", &rv);
|
mStorageService = do_GetService("@mozilla.org/storage/service;1", &rv);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
rv = NS_NewNamedThread("Cookie", getter_AddRefs(mThread));
|
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
|
||||||
|
|
||||||
// Init our default, and possibly private DBStates.
|
// Init our default, and possibly private DBStates.
|
||||||
InitDBStates();
|
InitDBStates();
|
||||||
|
|
||||||
|
|
@ -628,6 +625,7 @@ nsCookieService::InitDBStates()
|
||||||
NS_ASSERTION(!mDefaultDBState, "already have a default DBState");
|
NS_ASSERTION(!mDefaultDBState, "already have a default DBState");
|
||||||
NS_ASSERTION(!mPrivateDBState, "already have a private DBState");
|
NS_ASSERTION(!mPrivateDBState, "already have a private DBState");
|
||||||
NS_ASSERTION(!mInitializedDBStates, "already initialized");
|
NS_ASSERTION(!mInitializedDBStates, "already initialized");
|
||||||
|
NS_ASSERTION(!mThread, "already have a cookie service thread");
|
||||||
|
|
||||||
// Create a new default DBState and set our current one.
|
// Create a new default DBState and set our current one.
|
||||||
mDefaultDBState = new DBState();
|
mDefaultDBState = new DBState();
|
||||||
|
|
@ -649,6 +647,8 @@ nsCookieService::InitDBStates()
|
||||||
}
|
}
|
||||||
mDefaultDBState->cookieFile->AppendNative(NS_LITERAL_CSTRING(COOKIES_FILE));
|
mDefaultDBState->cookieFile->AppendNative(NS_LITERAL_CSTRING(COOKIES_FILE));
|
||||||
|
|
||||||
|
NS_ENSURE_SUCCESS_VOID(NS_NewNamedThread("Cookie", getter_AddRefs(mThread)));
|
||||||
|
|
||||||
nsCOMPtr<nsIRunnable> runnable = NS_NewRunnableFunction([] {
|
nsCOMPtr<nsIRunnable> runnable = NS_NewRunnableFunction([] {
|
||||||
NS_ENSURE_TRUE_VOID(gCookieService &&
|
NS_ENSURE_TRUE_VOID(gCookieService &&
|
||||||
gCookieService->mDBState &&
|
gCookieService->mDBState &&
|
||||||
|
|
@ -1553,7 +1553,10 @@ nsCookieService::CloseDBStates()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
EnsureReadComplete(false);
|
if (mThread) {
|
||||||
|
mThread->Shutdown();
|
||||||
|
mThread = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
// Null out our private and pointer DBStates regardless.
|
// Null out our private and pointer DBStates regardless.
|
||||||
mPrivateDBState = nullptr;
|
mPrivateDBState = nullptr;
|
||||||
|
|
@ -1812,9 +1815,6 @@ nsCookieService::~nsCookieService()
|
||||||
UnregisterWeakMemoryReporter(this);
|
UnregisterWeakMemoryReporter(this);
|
||||||
|
|
||||||
gCookieService = nullptr;
|
gCookieService = nullptr;
|
||||||
if (mThread) {
|
|
||||||
mThread->Shutdown();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue