Back out f9e075d85552 (Bug 635482) to investigate Mac tp4 regression, a=backout
authorPhil Ringnalda <philringnalda@gmail.com>
Sun, 27 Feb 2011 10:27:44 -0800
changeset 63153 78f7521c8e7fc77dbf47fbdbe89938d557c47e80
parent 63152 b66fe2e433c9024b057b4ff9adb1e74cd47a80cb
child 63154 279792a400ff39cb8460ab87b2727b908e711ec2
push id19045
push userphilringnalda@gmail.com
push dateSun, 27 Feb 2011 18:48:40 +0000
treeherdermozilla-central@78f7521c8e7f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbackout
bugs635482
milestone2.0b13pre
backs outf9e075d85552ca435ad89787ce473e9d8d3f269b
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
Back out f9e075d85552 (Bug 635482) to investigate Mac tp4 regression, a=backout
storage/src/mozStorageAsyncStatementExecution.cpp
storage/src/mozStorageStatementData.h
--- a/storage/src/mozStorageAsyncStatementExecution.cpp
+++ b/storage/src/mozStorageAsyncStatementExecution.cpp
@@ -421,17 +421,17 @@ AsyncExecuteStatements::notifyComplete()
   mMutex.AssertNotCurrentThreadOwns();
   NS_ASSERTION(mState != PENDING,
                "Still in a pending state when calling Complete!");
 
   // Finalize our statements before we try to commit or rollback.  If we are
   // canceling and have statements that think they have pending work, the
   // rollback will fail.
   for (PRUint32 i = 0; i < mStatements.Length(); i++)
-    mStatements[i].finalize(mCallingThread);
+    mStatements[i].finalize();
 
   // Handle our transaction, if we have one
   if (mTransactionManager) {
     if (mState == COMPLETED) {
       nsresult rv = mTransactionManager->Commit();
       if (NS_FAILED(rv)) {
         mState = ERROR;
         (void)notifyError(mozIStorageError::ERROR,
--- a/storage/src/mozStorageStatementData.h
+++ b/storage/src/mozStorageStatementData.h
@@ -11,17 +11,17 @@
  * Software distributed under the License is distributed on an "AS IS" basis,
  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  * for the specific language governing rights and limitations under the
  * License.
  *
  * The Original Code is mozilla.org code.
  *
  * The Initial Developer of the Original Code is
- * the Mozilla Foundation.
+ * Mozilla Corporation.
  * Portions created by the Initial Developer are Copyright (C) 2009
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  *   Shawn Wilsher <me@shawnwilsher.com> (Original Author)
  *
  * Alternatively, the contents of this file may be used under the terms of
  * either the GNU General Public License Version 2 or later (the "GPL"), or
@@ -39,18 +39,16 @@
 
 #ifndef mozStorageStatementData_h
 #define mozStorageStatementData_h
 
 #include "sqlite3.h"
 
 #include "nsAutoPtr.h"
 #include "nsTArray.h"
-#include "nsIEventTarget.h"
-#include "nsProxyRelease.h"
 
 #include "mozStorageBindingParamsArray.h"
 #include "mozIStorageBaseStatement.h"
 #include "mozStorageConnection.h"
 #include "StorageBaseStatementInternal.h"
 
 struct sqlite3_stmt;
 
@@ -62,24 +60,22 @@ class StatementData
 public:
   StatementData(sqlite3_stmt *aStatement,
                 already_AddRefed<BindingParamsArray> aParamsArray,
                 StorageBaseStatementInternal *aStatementOwner)
   : mStatement(aStatement)
   , mParamsArray(aParamsArray)
   , mStatementOwner(aStatementOwner)
   {
-    NS_PRECONDITION(mStatementOwner, "Must have a statement owner!");
   }
   StatementData(const StatementData &aSource)
   : mStatement(aSource.mStatement)
   , mParamsArray(aSource.mParamsArray)
   , mStatementOwner(aSource.mStatementOwner)
   {
-    NS_PRECONDITION(mStatementOwner, "Must have a statement owner!");
   }
   StatementData()
   {
   }
 
   /**
    * Return the sqlite statement, fetching it from the storage statement.  In
    * the case of AsyncStatements this may actually create the statement 
@@ -104,49 +100,31 @@ public:
   {
     return mStatementOwner->getOwner()->GetNativeConnection();
   }
 
   /**
    * NULLs out our sqlite3_stmt (it is held by the owner) after reseting it and
    * clear all bindings to it.  This is expected to occur on the async thread.
    *
-   * @param aReleaseThread
-   *        The thread that we should release mParamsArray and mStatementOwner
-   *        on.  This may not be the thread we are called on.
+   * We do not clear mParamsArray out because we only want to release
+   * mParamsArray on the calling thread because of XPCVariant addref/release
+   * thread-safety issues.  The same holds for mStatementOwner which can be
+   * holding such a reference chain as well.
    */
-  inline void finalize(nsIEventTarget *aReleaseThread)
+  inline void finalize()
   {
-    NS_PRECONDITION(aReleaseThread, "Must have a non-NULL release thread!");
-    NS_PRECONDITION(mStatementOwner, "Must have a statement owner!");
-#ifdef DEBUG
-    {
-      nsCOMPtr<nsIEventTarget> asyncThread =
-        mStatementOwner->getOwner()->getAsyncExecutionTarget();
-      // It's possible that we are shutting down the async thread, and this
-      // method would return NULL as a result.
-      if (asyncThread) {
-        PRBool onAsyncThread;
-        NS_ASSERTION(NS_SUCCEEDED(asyncThread->IsOnCurrentThread(&onAsyncThread)) && onAsyncThread,
-                     "This should only be running on the async thread!");
-      }
-    }
-#endif
     // In the AsyncStatement case we may never have populated mStatement if the
     // AsyncExecuteStatements got canceled or a failure occurred in constructing
     // the statement.
     if (mStatement) {
       (void)::sqlite3_reset(mStatement);
       (void)::sqlite3_clear_bindings(mStatement);
       mStatement = NULL;
     }
-    (void)NS_ProxyRelease(aReleaseThread, mStatementOwner, PR_TRUE);
-    if (mParamsArray) {
-      (void)NS_ProxyRelease(aReleaseThread, mParamsArray, PR_TRUE);
-    }
   }
 
   /**
    * Indicates if this statement has parameters to be bound before it is
    * executed.
    *
    * @return true if the statement has parameters to bind against, false
    *         otherwise.