From b22606db84fc72a522c84441ab62ecb3a269a315 Mon Sep 17 00:00:00 2001 From: Eric Butler Date: Sun, 17 Aug 2008 21:05:54 -0700 Subject: [PATCH] open cookie db unshared and exclusive - bug 449987. r=dwitte --- netwerk/cookie/src/nsCookieService.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/netwerk/cookie/src/nsCookieService.cpp b/netwerk/cookie/src/nsCookieService.cpp index 6b5e899aa7c..9343ca876a6 100644 --- a/netwerk/cookie/src/nsCookieService.cpp +++ b/netwerk/cookie/src/nsCookieService.cpp @@ -467,13 +467,13 @@ nsCookieService::InitDB() return NS_ERROR_UNEXPECTED; // cache a connection to the cookie database - rv = storage->OpenDatabase(cookieFile, getter_AddRefs(mDBConn)); + rv = storage->OpenUnsharedDatabase(cookieFile, getter_AddRefs(mDBConn)); if (rv == NS_ERROR_FILE_CORRUPTED) { // delete and try again rv = cookieFile->Remove(PR_FALSE); NS_ENSURE_SUCCESS(rv, rv); - rv = storage->OpenDatabase(cookieFile, getter_AddRefs(mDBConn)); + rv = storage->OpenUnsharedDatabase(cookieFile, getter_AddRefs(mDBConn)); } NS_ENSURE_SUCCESS(rv, rv); @@ -553,6 +553,9 @@ nsCookieService::InitDB() // make operations on the table asynchronous, for performance mDBConn->ExecuteSimpleSQL(NS_LITERAL_CSTRING("PRAGMA synchronous = OFF")); + // open in exclusive mode for performance + mDBConn->ExecuteSimpleSQL(NS_LITERAL_CSTRING("PRAGMA locking_mode = EXCLUSIVE")); + // cache frequently used statements (for insertion, deletion, and updating) rv = mDBConn->CreateStatement(NS_LITERAL_CSTRING( "INSERT INTO moz_cookies "