Bug 686025 - nsNavHistory::AsyncExecuteLegacyQueries uses synchronous createStatement instead of createAsyncStatement.
authorMarco Bonardo <mbonardo@mozilla.com>
Mon, 03 Oct 2011 23:50:23 +0200
changeset 78033 347b57a14ce386ea8efa2416b64dd2fc75e0f111
parent 78032 c6405a1d4b2271705bf1f74a73cf4d1808afe108
child 78034 db349edef0d61ace67490c13185e52b655a6ed44
push id2352
push usermak77@bonardo.net
push dateMon, 03 Oct 2011 21:50:39 +0000
treeherdermozilla-inbound@347b57a14ce3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs686025
milestone10.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 686025 - nsNavHistory::AsyncExecuteLegacyQueries uses synchronous createStatement instead of createAsyncStatement. r=asuth, sdwilsh
netwerk/cookie/nsCookieService.cpp
storage/test/test_AsXXX_helpers.cpp
toolkit/components/places/nsNavHistory.cpp
toolkit/components/places/nsNavHistory.h
--- a/netwerk/cookie/nsCookieService.cpp
+++ b/netwerk/cookie/nsCookieService.cpp
@@ -1645,18 +1645,18 @@ nsCookieService::RemoveAll()
     NS_ASSERTION(mDBState == mDefaultDBState, "not in default DB state");
 
     // Cancel any pending read. No further results will be received by our
     // read listener.
     if (mDefaultDBState->pendingRead) {
       CancelAsyncRead(PR_TRUE);
     }
 
-    nsCOMPtr<mozIStorageStatement> stmt;
-    nsresult rv = mDefaultDBState->dbConn->CreateStatement(NS_LITERAL_CSTRING(
+    nsCOMPtr<mozIStorageAsyncStatement> stmt;
+    nsresult rv = mDefaultDBState->dbConn->CreateAsyncStatement(NS_LITERAL_CSTRING(
       "DELETE FROM moz_cookies"), getter_AddRefs(stmt));
     if (NS_SUCCEEDED(rv)) {
       nsCOMPtr<mozIStoragePendingStatement> handle;
       rv = stmt->ExecuteAsync(mDefaultDBState->removeListener,
         getter_AddRefs(handle));
       NS_ASSERT_SUCCESS(rv);
     } else {
       // Recreate the database.
@@ -1804,18 +1804,18 @@ nsCookieService::Remove(const nsACString
  ******************************************************************************/
 
 // Begin an asynchronous read from the database.
 OpenDBResult
 nsCookieService::Read()
 {
   // Set up a statement for the read. Note that our query specifies that
   // 'baseDomain' not be NULL -- see below for why.
-  nsCOMPtr<mozIStorageStatement> stmtRead;
-  nsresult rv = mDefaultDBState->dbConn->CreateStatement(NS_LITERAL_CSTRING(
+  nsCOMPtr<mozIStorageAsyncStatement> stmtRead;
+  nsresult rv = mDefaultDBState->dbConn->CreateAsyncStatement(NS_LITERAL_CSTRING(
     "SELECT "
       "name, "
       "value, "
       "host, "
       "path, "
       "expiry, "
       "lastAccessed, "
       "creationTime, "
@@ -1825,18 +1825,18 @@ nsCookieService::Read()
     "FROM moz_cookies "
     "WHERE baseDomain NOTNULL"), getter_AddRefs(stmtRead));
   NS_ENSURE_SUCCESS(rv, RESULT_RETRY);
 
   // Set up a statement to delete any rows with a NULL 'baseDomain'
   // column. This takes care of any cookies set by browsers that don't
   // understand the 'baseDomain' column, where the database schema version
   // is from one that does. (This would occur when downgrading.)
-  nsCOMPtr<mozIStorageStatement> stmtDeleteNull;
-  rv = mDefaultDBState->dbConn->CreateStatement(NS_LITERAL_CSTRING(
+  nsCOMPtr<mozIStorageAsyncStatement> stmtDeleteNull;
+  rv = mDefaultDBState->dbConn->CreateAsyncStatement(NS_LITERAL_CSTRING(
     "DELETE FROM moz_cookies WHERE baseDomain ISNULL"),
     getter_AddRefs(stmtDeleteNull));
   NS_ENSURE_SUCCESS(rv, RESULT_RETRY);
 
   // Start a new connection for sync reads, to reduce contention with the
   // background thread. We need to do this before we kick off write statements,
   // since they can lock the database and prevent connections from being opened.
   rv = mStorageService->OpenUnsharedDatabase(mDefaultDBState->cookieFile,
--- a/storage/test/test_AsXXX_helpers.cpp
+++ b/storage/test/test_AsXXX_helpers.cpp
@@ -94,18 +94,18 @@ test_NULLFallback()
   do_check_eq(valueArray->IsNull(0), PR_TRUE);
 }
 
 void
 test_asyncNULLFallback()
 {
   nsCOMPtr<mozIStorageConnection> db(getMemoryDatabase());
 
-  nsCOMPtr<mozIStorageStatement> stmt;
-  (void)db->CreateStatement(NS_LITERAL_CSTRING(
+  nsCOMPtr<mozIStorageAsyncStatement> stmt;
+  (void)db->CreateAsyncStatement(NS_LITERAL_CSTRING(
     "SELECT NULL"
   ), getter_AddRefs(stmt));
 
   nsRefPtr<Spinner> asyncSpin(new Spinner());
   nsCOMPtr<mozIStoragePendingStatement> pendingStmt;
   do_check_true(NS_SUCCEEDED(stmt->ExecuteAsync(asyncSpin, getter_AddRefs(pendingStmt))));
   do_check_true(pendingStmt);
   asyncSpin->SpinUntilCompleted();
--- a/toolkit/components/places/nsNavHistory.cpp
+++ b/toolkit/components/places/nsNavHistory.cpp
@@ -5177,18 +5177,18 @@ nsNavHistory::AsyncExecuteLegacyQueries(
   nsCString queryString;
   bool paramsPresent = false;
   nsNavHistory::StringHash addParams;
   addParams.Init(HISTORY_DATE_CONT_MAX);
   nsresult rv = ConstructQueryString(queries, options, queryString,
                                      paramsPresent, addParams);
   NS_ENSURE_SUCCESS(rv,rv);
 
-  nsCOMPtr<mozIStorageStatement> statement;
-  rv = mDBConn->CreateStatement(queryString, getter_AddRefs(statement));
+  nsCOMPtr<mozIStorageAsyncStatement> statement;
+  rv = mDBConn->CreateAsyncStatement(queryString, getter_AddRefs(statement));
 #ifdef DEBUG
   if (NS_FAILED(rv)) {
     nsCAutoString lastErrorString;
     (void)mDBConn->GetLastErrorString(lastErrorString);
     PRInt32 lastError = 0;
     (void)mDBConn->GetLastError(&lastError);
     printf("Places failed to create a statement from this query:\n%s\nStorage error (%d): %s\n",
            queryString.get(), lastError, lastErrorString.get());
@@ -5634,17 +5634,17 @@ nsNavHistory::QueryToSelectClause(nsNavH
 }
 
 
 // nsNavHistory::BindQueryClauseParameters
 //
 //    THE BEHAVIOR SHOULD BE IN SYNC WITH QueryToSelectClause
 
 nsresult
-nsNavHistory::BindQueryClauseParameters(mozIStorageStatement* statement,
+nsNavHistory::BindQueryClauseParameters(mozIStorageBaseStatement* statement,
                                         PRInt32 aQueryIndex,
                                         nsNavHistoryQuery* aQuery, // const
                                         nsNavHistoryQueryOptions* aOptions)
 {
   nsresult rv;
 
   bool hasIt;
   // Append numbered index to param names, to replace them correctly in
@@ -6769,18 +6769,18 @@ nsNavHistory::FixInvalidFrecencies()
   // From older versions, unmigrated bookmarks might be hidden, so we can't
   // exclude hidden places (by doing "WHERE hidden = 0") from our query, as we
   // want to calculate the frecency for those places and unhide them (if they
   // are not livemark items and not place: queries.)
   //
   // Note, we are not limiting ourselves to places with visits because we may
   // not have any if the place is a bookmark and we expired or deleted all the
   // visits.
-  nsCOMPtr<mozIStorageStatement> fixInvalidFrecenciesStmt;
-  nsresult rv = mDBConn->CreateStatement(NS_LITERAL_CSTRING(
+  nsCOMPtr<mozIStorageAsyncStatement> fixInvalidFrecenciesStmt;
+  nsresult rv = mDBConn->CreateAsyncStatement(NS_LITERAL_CSTRING(
       "UPDATE moz_places "
       "SET frecency = CALCULATE_FRECENCY(id) "
       "WHERE frecency < 0"),
     getter_AddRefs(fixInvalidFrecenciesStmt));
   NS_ENSURE_SUCCESS(rv, rv);
 
   nsCOMPtr<AsyncStatementCallbackNotifier> callback =
     new AsyncStatementCallbackNotifier(TOPIC_FRECENCY_UPDATED);
--- a/toolkit/components/places/nsNavHistory.h
+++ b/toolkit/components/places/nsNavHistory.h
@@ -778,17 +778,17 @@ protected:
                                 nsCString& queryString,
                                 bool& aParamsPresent,
                                 StringHash& aAddParams);
 
   nsresult QueryToSelectClause(nsNavHistoryQuery* aQuery,
                                nsNavHistoryQueryOptions* aOptions,
                                PRInt32 aQueryIndex,
                                nsCString* aClause);
-  nsresult BindQueryClauseParameters(mozIStorageStatement* statement,
+  nsresult BindQueryClauseParameters(mozIStorageBaseStatement* statement,
                                      PRInt32 aQueryIndex,
                                      nsNavHistoryQuery* aQuery,
                                      nsNavHistoryQueryOptions* aOptions);
 
   nsresult ResultsAsList(mozIStorageStatement* statement,
                          nsNavHistoryQueryOptions* aOptions,
                          nsCOMArray<nsNavHistoryResultNode>* aResults);