Bug 884061 - Part 3u: Use NS_DECL_THREADSAFE_ISUPPORTS in storage/, r=mak
authorJoshua Cranmer <Pidgeot18@gmail.com>
Thu, 18 Jul 2013 21:24:15 -0500
changeset 139623 bf72f0094528d9f4546030da46e9d86d2444d973
parent 139622 f3e3a8389cdf19d286f46a62543929e524c4ff28
child 139624 58c8a357338c6255a096ca68c6182b1e01485b68
push id1911
push userryanvm@gmail.com
push dateWed, 24 Jul 2013 00:53:40 +0000
treeherderfx-team@ff0814879910 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmak
bugs884061
milestone25.0a1
Bug 884061 - Part 3u: Use NS_DECL_THREADSAFE_ISUPPORTS in storage/, r=mak
storage/src/Variant.h
storage/src/Variant_inl.h
storage/src/mozStorageAsyncStatement.cpp
storage/src/mozStorageAsyncStatement.h
storage/src/mozStorageAsyncStatementExecution.cpp
storage/src/mozStorageAsyncStatementExecution.h
storage/src/mozStorageBindingParams.cpp
storage/src/mozStorageBindingParams.h
storage/src/mozStorageBindingParamsArray.cpp
storage/src/mozStorageBindingParamsArray.h
storage/src/mozStorageConnection.cpp
storage/src/mozStorageConnection.h
storage/src/mozStorageError.cpp
storage/src/mozStorageError.h
storage/src/mozStorageResultSet.cpp
storage/src/mozStorageResultSet.h
storage/src/mozStorageRow.cpp
storage/src/mozStorageRow.h
storage/src/mozStorageService.cpp
storage/src/mozStorageService.h
storage/src/mozStorageStatement.cpp
storage/src/mozStorageStatement.h
storage/style.txt
--- a/storage/src/Variant.h
+++ b/storage/src/Variant.h
@@ -29,17 +29,17 @@ namespace mozilla {
 namespace storage {
 
 ////////////////////////////////////////////////////////////////////////////////
 //// Base Class
 
 class Variant_base : public nsIVariant
 {
 public:
-  NS_DECL_ISUPPORTS
+  NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_NSIVARIANT
 
 protected:
   virtual ~Variant_base() { }
 };
 
 ////////////////////////////////////////////////////////////////////////////////
 //// Traits
--- a/storage/src/Variant_inl.h
+++ b/storage/src/Variant_inl.h
@@ -13,19 +13,19 @@
 #endif
 
 namespace mozilla {
 namespace storage {
 
 ////////////////////////////////////////////////////////////////////////////////
 //// Variant_base
 
-inline NS_IMPL_THREADSAFE_ADDREF(Variant_base)
-inline NS_IMPL_THREADSAFE_RELEASE(Variant_base)
-inline NS_IMPL_THREADSAFE_QUERY_INTERFACE1(
+inline NS_IMPL_ADDREF(Variant_base)
+inline NS_IMPL_RELEASE(Variant_base)
+inline NS_IMPL_QUERY_INTERFACE1(
   Variant_base,
   nsIVariant
 )
 
 ////////////////////////////////////////////////////////////////////////////////
 //// nsIVariant
 
 inline
--- a/storage/src/mozStorageAsyncStatement.cpp
+++ b/storage/src/mozStorageAsyncStatement.cpp
@@ -257,18 +257,18 @@ AsyncStatement::cleanupJSHelpers()
     params->mStatement = nullptr;
     mStatementParamsHolder = nullptr;
   }
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 //// nsISupports
 
-NS_IMPL_THREADSAFE_ADDREF(AsyncStatement)
-NS_IMPL_THREADSAFE_RELEASE(AsyncStatement)
+NS_IMPL_ADDREF(AsyncStatement)
+NS_IMPL_RELEASE(AsyncStatement)
 
 NS_INTERFACE_MAP_BEGIN(AsyncStatement)
   NS_INTERFACE_MAP_ENTRY(mozIStorageAsyncStatement)
   NS_INTERFACE_MAP_ENTRY(mozIStorageBaseStatement)
   NS_INTERFACE_MAP_ENTRY(mozIStorageBindingParams)
   NS_INTERFACE_MAP_ENTRY(mozilla::storage::StorageBaseStatementInternal)
   if (aIID.Equals(NS_GET_IID(nsIClassInfo))) {
     foundInterface = static_cast<nsIClassInfo *>(&sAsyncStatementClassInfo);
--- a/storage/src/mozStorageAsyncStatement.h
+++ b/storage/src/mozStorageAsyncStatement.h
@@ -26,17 +26,17 @@ namespace storage {
 
 class AsyncStatementJSHelper;
 class Connection;
 
 class AsyncStatement MOZ_FINAL : public mozIStorageAsyncStatement
                                , public StorageBaseStatementInternal
 {
 public:
-  NS_DECL_ISUPPORTS
+  NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_MOZISTORAGEASYNCSTATEMENT
   NS_DECL_MOZISTORAGEBASESTATEMENT
   NS_DECL_MOZISTORAGEBINDINGPARAMS
   NS_DECL_STORAGEBASESTATEMENTINTERNAL
 
   AsyncStatement();
 
   /**
--- a/storage/src/mozStorageAsyncStatementExecution.cpp
+++ b/storage/src/mozStorageAsyncStatementExecution.cpp
@@ -509,17 +509,17 @@ AsyncExecuteStatements::notifyResults()
   NS_ENSURE_TRUE(notifier, NS_ERROR_OUT_OF_MEMORY);
 
   nsresult rv = mCallingThread->Dispatch(notifier, NS_DISPATCH_NORMAL);
   if (NS_SUCCEEDED(rv))
     mResultSet = nullptr; // we no longer own it on success
   return rv;
 }
 
-NS_IMPL_THREADSAFE_ISUPPORTS2(
+NS_IMPL_ISUPPORTS2(
   AsyncExecuteStatements,
   nsIRunnable,
   mozIStoragePendingStatement
 )
 
 bool
 AsyncExecuteStatements::statementsNeedTransaction()
 {
--- a/storage/src/mozStorageAsyncStatementExecution.h
+++ b/storage/src/mozStorageAsyncStatementExecution.h
@@ -36,17 +36,17 @@ class StatementData;
 typedef mozStorageTransactionBase<mozilla::storage::Connection,
                                   nsRefPtr<mozilla::storage::Connection> >
     mozStorageAsyncTransaction;
 
 class AsyncExecuteStatements MOZ_FINAL : public nsIRunnable
                                        , public mozIStoragePendingStatement
 {
 public:
-  NS_DECL_ISUPPORTS
+  NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_NSIRUNNABLE
   NS_DECL_MOZISTORAGEPENDINGSTATEMENT
 
   /**
    * Describes the state of execution.
    */
   enum ExecutionState {
     PENDING = -1,
--- a/storage/src/mozStorageBindingParams.cpp
+++ b/storage/src/mozStorageBindingParams.cpp
@@ -197,17 +197,17 @@ AsyncBindingParams::iterateOverNamedPara
     return PL_DHASH_STOP;
   }
   return PL_DHASH_NEXT;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 //// nsISupports
 
-NS_IMPL_THREADSAFE_ISUPPORTS2(
+NS_IMPL_ISUPPORTS2(
   BindingParams
 , mozIStorageBindingParams
 , IStorageBindingParamsInternal
 )
 
 
 ////////////////////////////////////////////////////////////////////////////////
 //// IStorageBindingParamsInternal
--- a/storage/src/mozStorageBindingParams.h
+++ b/storage/src/mozStorageBindingParams.h
@@ -20,17 +20,17 @@
 
 namespace mozilla {
 namespace storage {
 
 class BindingParams : public mozIStorageBindingParams
                     , public IStorageBindingParamsInternal
 {
 public:
-  NS_DECL_ISUPPORTS
+  NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_MOZISTORAGEBINDINGPARAMS
   NS_DECL_ISTORAGEBINDINGPARAMSINTERNAL
 
   /**
    * Locks the parameters and prevents further modification to it (such as
    * binding more elements to it).
    */
   void lock();
--- a/storage/src/mozStorageBindingParamsArray.cpp
+++ b/storage/src/mozStorageBindingParamsArray.cpp
@@ -34,17 +34,17 @@ BindingParamsArray::lock()
 }
 
 const StorageBaseStatementInternal *
 BindingParamsArray::getOwner() const
 {
   return mOwningStatement;
 }
 
-NS_IMPL_THREADSAFE_ISUPPORTS1(
+NS_IMPL_ISUPPORTS1(
   BindingParamsArray,
   mozIStorageBindingParamsArray
 )
 
 ///////////////////////////////////////////////////////////////////////////////
 //// mozIStorageBindingParamsArray
 
 NS_IMETHODIMP
--- a/storage/src/mozStorageBindingParamsArray.h
+++ b/storage/src/mozStorageBindingParamsArray.h
@@ -18,17 +18,17 @@ namespace storage {
 
 class StorageBaseStatementInternal;
 
 class BindingParamsArray MOZ_FINAL : public mozIStorageBindingParamsArray
 {
   typedef nsTArray< nsCOMPtr<mozIStorageBindingParams> > array_type;
 
 public:
-  NS_DECL_ISUPPORTS
+  NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_MOZISTORAGEBINDINGPARAMSARRAY
 
   BindingParamsArray(StorageBaseStatementInternal *aOwningStatement);
 
   typedef array_type::size_type size_type;
 
   /**
    * Locks the array and prevents further modification to it (such as adding
--- a/storage/src/mozStorageConnection.cpp
+++ b/storage/src/mozStorageConnection.cpp
@@ -492,31 +492,31 @@ Connection::Connection(Service *aService
 Connection::~Connection()
 {
   (void)Close();
 
   MOZ_ASSERT(!mAsyncExecutionThread,
              "AsyncClose has not been invoked on this connection!");
 }
 
-NS_IMPL_THREADSAFE_ADDREF(Connection)
+NS_IMPL_ADDREF(Connection)
 
 NS_INTERFACE_MAP_BEGIN(Connection)
   NS_INTERFACE_MAP_ENTRY(mozIStorageAsyncConnection)
   NS_INTERFACE_MAP_ENTRY(nsIInterfaceRequestor)
   NS_INTERFACE_MAP_ENTRY_CONDITIONAL(mozIStorageConnection, !mAsyncOnly)
   NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, mozIStorageConnection)
 NS_INTERFACE_MAP_END
 
-// This is identical to what NS_IMPL_THREADSAFE_RELEASE provides, but with the
+// This is identical to what NS_IMPL_RELEASE provides, but with the
 // extra |1 == count| case.
 NS_IMETHODIMP_(nsrefcnt) Connection::Release(void)
 {
   NS_PRECONDITION(0 != mRefCnt, "dup release");
-  nsrefcnt count = NS_AtomicDecrementRefcnt(mRefCnt);
+  nsrefcnt count = --mRefCnt;
   NS_LOG_RELEASE(this, count, "Connection");
   if (1 == count) {
     // If the refcount is 1, the single reference must be from
     // gService->mConnections (in class |Service|).  Which means we can
     // unregister it safely.
     mStorageService->unregisterConnection(this);
   } else if (0 == count) {
     mRefCnt = 1; /* stabilize */
--- a/storage/src/mozStorageConnection.h
+++ b/storage/src/mozStorageConnection.h
@@ -35,17 +35,17 @@ class nsIThread;
 
 namespace mozilla {
 namespace storage {
 
 class Connection MOZ_FINAL : public mozIStorageConnection
                            , public nsIInterfaceRequestor
 {
 public:
-  NS_DECL_ISUPPORTS
+  NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_MOZISTORAGEASYNCCONNECTION
   NS_DECL_MOZISTORAGECONNECTION
   NS_DECL_NSIINTERFACEREQUESTOR
 
   /**
    * Structure used to describe user functions on the database connection.
    */
   struct FunctionInfo {
--- a/storage/src/mozStorageError.cpp
+++ b/storage/src/mozStorageError.cpp
@@ -18,17 +18,17 @@ Error::Error(int aResult,
 , mMessage(aMessage)
 {
 }
 
 /**
  * Note:  This object is only ever accessed on one thread at a time.  It it not
  *        threadsafe, but it does need threadsafe AddRef and Release.
  */
-NS_IMPL_THREADSAFE_ISUPPORTS1(
+NS_IMPL_ISUPPORTS1(
   Error,
   mozIStorageError
 )
 
 ////////////////////////////////////////////////////////////////////////////////
 //// mozIStorageError
 
 NS_IMETHODIMP
--- a/storage/src/mozStorageError.h
+++ b/storage/src/mozStorageError.h
@@ -12,17 +12,17 @@
 #include "mozilla/Attributes.h"
 
 namespace mozilla {
 namespace storage {
 
 class Error MOZ_FINAL : public mozIStorageError
 {
 public:
-  NS_DECL_ISUPPORTS
+  NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_MOZISTORAGEERROR
 
   Error(int aResult, const char *aMessage);
 
 private:
   int mResult;
   nsCString mMessage;
 };
--- a/storage/src/mozStorageResultSet.cpp
+++ b/storage/src/mozStorageResultSet.cpp
@@ -28,17 +28,17 @@ ResultSet::add(mozIStorageRow *aRow)
 {
   return mData.AppendObject(aRow) ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
 }
 
 /**
  * Note:  This object is only ever accessed on one thread at a time.  It it not
  *        threadsafe, but it does need threadsafe AddRef and Release.
  */
-NS_IMPL_THREADSAFE_ISUPPORTS1(
+NS_IMPL_ISUPPORTS1(
   ResultSet,
   mozIStorageResultSet
 )
 
 ////////////////////////////////////////////////////////////////////////////////
 //// mozIStorageResultSet
 
 NS_IMETHODIMP
--- a/storage/src/mozStorageResultSet.h
+++ b/storage/src/mozStorageResultSet.h
@@ -13,17 +13,17 @@
 class mozIStorageRow;
 
 namespace mozilla {
 namespace storage {
 
 class ResultSet MOZ_FINAL : public mozIStorageResultSet
 {
 public:
-  NS_DECL_ISUPPORTS
+  NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_MOZISTORAGERESULTSET
 
   ResultSet();
   ~ResultSet();
 
   /**
    * Adds a tuple to this result set.
    */
--- a/storage/src/mozStorageRow.cpp
+++ b/storage/src/mozStorageRow.cpp
@@ -73,17 +73,17 @@ Row::initialize(sqlite3_stmt *aStatement
 
   return NS_OK;
 }
 
 /**
  * Note:  This object is only ever accessed on one thread at a time.  It it not
  *        threadsafe, but it does need threadsafe AddRef and Release.
  */
-NS_IMPL_THREADSAFE_ISUPPORTS2(
+NS_IMPL_ISUPPORTS2(
   Row,
   mozIStorageRow,
   mozIStorageValueArray
 )
 
 ////////////////////////////////////////////////////////////////////////////////
 //// mozIStorageRow
 
--- a/storage/src/mozStorageRow.h
+++ b/storage/src/mozStorageRow.h
@@ -15,17 +15,17 @@ class nsIVariant;
 struct sqlite3_stmt;
 
 namespace mozilla {
 namespace storage {
 
 class Row MOZ_FINAL : public mozIStorageRow
 {
 public:
-  NS_DECL_ISUPPORTS
+  NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_MOZISTORAGEROW
   NS_DECL_MOZISTORAGEVALUEARRAY
 
   /**
    * Initializes the object with the given statement.  Copies the values from
    * the statement.
    *
    * @param aStatement
--- a/storage/src/mozStorageService.cpp
+++ b/storage/src/mozStorageService.cpp
@@ -74,17 +74,17 @@ class StorageSQLiteMultiReporter MOZ_FIN
 {
 private:
   Service *mService;    // a weakref because Service contains a strongref to this
   nsCString mStmtDesc;
   nsCString mCacheDesc;
   nsCString mSchemaDesc;
 
 public:
-  NS_DECL_ISUPPORTS
+  NS_DECL_THREADSAFE_ISUPPORTS
 
   StorageSQLiteMultiReporter(Service *aService) 
   : mService(aService)
   {
     mStmtDesc = NS_LITERAL_CSTRING(
       "Memory (approximate) used by all prepared statements used by "
       "connections to this database.");
 
@@ -211,25 +211,25 @@ private:
                        aDesc, aClosure);
     NS_ENSURE_SUCCESS(rv, rv);
     *aTotal += curr;
 
     return NS_OK;
   }
 };
 
-NS_IMPL_THREADSAFE_ISUPPORTS1(
+NS_IMPL_ISUPPORTS1(
   StorageSQLiteMultiReporter,
   nsIMemoryMultiReporter
 )
 
 ////////////////////////////////////////////////////////////////////////////////
 //// Service
 
-NS_IMPL_THREADSAFE_ISUPPORTS2(
+NS_IMPL_ISUPPORTS2(
   Service,
   mozIStorageService,
   nsIObserver
 )
 
 Service *Service::gService = nullptr;
 
 Service *
--- a/storage/src/mozStorageService.h
+++ b/storage/src/mozStorageService.h
@@ -48,17 +48,17 @@ public:
    *         aStr1 == aStr2, returns 0.
    */
   int localeCompareStrings(const nsAString &aStr1,
                            const nsAString &aStr2,
                            int32_t aComparisonStrength);
 
   static Service *getSingleton();
 
-  NS_DECL_ISUPPORTS
+  NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_MOZISTORAGESERVICE
   NS_DECL_NSIOBSERVER
 
   /**
    * Obtains an already AddRefed pointer to XPConnect.  This is used by
    * language helpers.
    */
   static already_AddRefed<nsIXPConnect> getXPConnect();
--- a/storage/src/mozStorageStatement.cpp
+++ b/storage/src/mozStorageStatement.cpp
@@ -245,18 +245,18 @@ Statement::getParams()
 Statement::~Statement()
 {
   (void)internalFinalize(true);
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 //// nsISupports
 
-NS_IMPL_THREADSAFE_ADDREF(Statement)
-NS_IMPL_THREADSAFE_RELEASE(Statement)
+NS_IMPL_ADDREF(Statement)
+NS_IMPL_RELEASE(Statement)
 
 NS_INTERFACE_MAP_BEGIN(Statement)
   NS_INTERFACE_MAP_ENTRY(mozIStorageStatement)
   NS_INTERFACE_MAP_ENTRY(mozIStorageBaseStatement)
   NS_INTERFACE_MAP_ENTRY(mozIStorageBindingParams)
   NS_INTERFACE_MAP_ENTRY(mozIStorageValueArray)
   NS_INTERFACE_MAP_ENTRY(mozilla::storage::StorageBaseStatementInternal)
   if (aIID.Equals(NS_GET_IID(nsIClassInfo))) {
--- a/storage/src/mozStorageStatement.h
+++ b/storage/src/mozStorageStatement.h
@@ -27,17 +27,17 @@ namespace storage {
 class StatementJSHelper;
 class Connection;
 
 class Statement MOZ_FINAL : public mozIStorageStatement
                           , public mozIStorageValueArray
                           , public StorageBaseStatementInternal
 {
 public:
-  NS_DECL_ISUPPORTS
+  NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_MOZISTORAGESTATEMENT
   NS_DECL_MOZISTORAGEBASESTATEMENT
   NS_DECL_MOZISTORAGEBINDINGPARAMS
   // NS_DECL_MOZISTORAGEVALUEARRAY (methods in mozIStorageStatement)
   NS_DECL_STORAGEBASESTATEMENTINTERNAL
 
   Statement();
 
--- a/storage/style.txt
+++ b/storage/style.txt
@@ -103,17 +103,17 @@ public:
 *** Implementation ***
 
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  * vim: sw=2 ts=2 et lcs=trail\:.,tab\:>~ : */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
-NS_IMPL_THREADSAFE_ISUPPORTS2(
+NS_IMPL_ISUPPORTS2(
   Foo
 , IBar
 , IBaz
 )
 
 Foo::Foo(
   LongArgumentLineThatWouldOtherwiseOverflow *aArgument1
 )