Bug 1048272 - Fix some bad implicit constructors in storage; r=mak
authorEhsan Akhgari <ehsan@mozilla.com>
Thu, 07 Aug 2014 19:47:28 -0400
changeset 198456 26218f791bbf849c0e8c2ae067d7352478d3e764
parent 198455 0c7c3cdfbf29fbae4cad31a55766e562ad6a07d1
child 198457 e4310d8289b99c2e781b01941c62100ac7e402e4
push id27272
push useremorley@mozilla.com
push dateFri, 08 Aug 2014 14:41:27 +0000
treeherdermozilla-central@96a566fa1599 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmak
bugs1048272
milestone34.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 1048272 - Fix some bad implicit constructors in storage; r=mak
storage/public/StatementCache.h
storage/public/mozStorageHelper.h
storage/src/SQLiteMutex.h
storage/src/TelemetryVFS.cpp
storage/src/VacuumManager.cpp
storage/src/Variant.h
storage/src/mozStorageAsyncStatementParams.h
storage/src/mozStorageBindingParams.h
storage/src/mozStorageBindingParamsArray.h
storage/src/mozStoragePrivateHelpers.cpp
storage/src/mozStorageSQLFunctions.cpp
storage/src/mozStorageStatementParams.h
storage/src/mozStorageStatementRow.h
--- a/storage/public/StatementCache.h
+++ b/storage/public/StatementCache.h
@@ -30,17 +30,17 @@ public:
    *
    * @note a connection can have more than one cache.
    *
    * @param aConnection
    *        A reference to the nsCOMPtr for the connection this cache is to be
    *        used for.  This nsCOMPtr must at least live as long as this class,
    *        otherwise crashes will happen.
    */
-  StatementCache(nsCOMPtr<mozIStorageConnection>& aConnection)
+  explicit StatementCache(nsCOMPtr<mozIStorageConnection>& aConnection)
   : mConnection(aConnection)
   {
   }
 
   /**
    * Obtains a cached statement.  If this statement is not yet created, it will
    * be created and stored for later use.
    *
--- a/storage/public/mozStorageHelper.h
+++ b/storage/public/mozStorageHelper.h
@@ -145,17 +145,17 @@ mozStorageTransaction;
  * this object goes out of scope.
  *
  * Note that this always just resets the statement. If the statement doesn't
  * need resetting, the reset operation is inexpensive.
  */
 class MOZ_STACK_CLASS mozStorageStatementScoper
 {
 public:
-  mozStorageStatementScoper(mozIStorageStatement* aStatement)
+  explicit mozStorageStatementScoper(mozIStorageStatement* aStatement)
       : mStatement(aStatement)
   {
   }
   ~mozStorageStatementScoper()
   {
     if (mStatement)
       mStatement->Reset();
   }
--- a/storage/src/SQLiteMutex.h
+++ b/storage/src/SQLiteMutex.h
@@ -24,17 +24,17 @@ class SQLiteMutex : private BlockingReso
 {
 public:
   /**
    * Constructs a wrapper for a sqlite3_mutex that has deadlock detecting.
    *
    * @param aName
    *        A name which can be used to reference this mutex.
    */
-  SQLiteMutex(const char *aName)
+  explicit SQLiteMutex(const char *aName)
   : BlockingResourceBase(aName, eMutex)
   , mMutex(nullptr)
   {
   }
 
   /**
    * Sets the mutex that we are wrapping.  We generally do not have access to
    * our mutex at class construction, so we have to set it once we get access to
@@ -126,17 +126,17 @@ private:
 
 /**
  * Automatically acquires the mutex when it enters scope, and releases it when
  * it leaves scope.
  */
 class MOZ_STACK_CLASS SQLiteMutexAutoLock
 {
 public:
-  SQLiteMutexAutoLock(SQLiteMutex &aMutex)
+  explicit SQLiteMutexAutoLock(SQLiteMutex &aMutex)
   : mMutex(aMutex)
   {
     mMutex.lock();
   }
 
   ~SQLiteMutexAutoLock()
   {
     mMutex.unlock();
@@ -148,17 +148,17 @@ private:
 
 /**
  * Automatically releases the mutex when it enters scope, and acquires it when
  * it leaves scope.
  */
 class MOZ_STACK_CLASS SQLiteMutexAutoUnlock
 {
 public:
-  SQLiteMutexAutoUnlock(SQLiteMutex &aMutex)
+  explicit SQLiteMutexAutoUnlock(SQLiteMutex &aMutex)
   : mMutex(aMutex)
   {
     mMutex.unlock();
   }
 
   ~SQLiteMutexAutoUnlock()
   {
     mMutex.lock();
--- a/storage/src/TelemetryVFS.cpp
+++ b/storage/src/TelemetryVFS.cpp
@@ -73,31 +73,31 @@ public:
    * @param id takes a telemetry histogram id. The id+1 must be an
    * equivalent histogram for the main thread. Eg, MOZ_SQLITE_OPEN_MS 
    * is followed by MOZ_SQLITE_OPEN_MAIN_THREAD_MS.
    *
    * @param aOp optionally takes an IO operation to report through the
    * IOInterposer. Filename will be reported as NULL, and reference will be
    * either "sqlite-mainthread" or "sqlite-otherthread".
    */
-  IOThreadAutoTimer(Telemetry::ID id,
+  explicit IOThreadAutoTimer(Telemetry::ID id,
     IOInterposeObserver::Operation aOp = IOInterposeObserver::OpNone)
     : start(TimeStamp::Now()),
       id(id),
       op(aOp)
   {
   }
 
   /**
    * This constructor is for when we want to report an operation to
    * IOInterposer but do not require a telemetry probe.
    *
    * @param aOp IO Operation to report through the IOInterposer.
    */
-  IOThreadAutoTimer(IOInterposeObserver::Operation aOp)
+  explicit IOThreadAutoTimer(IOInterposeObserver::Operation aOp)
     : start(TimeStamp::Now()),
       id(Telemetry::HistogramCount),
       op(aOp)
   {
   }
 
   ~IOThreadAutoTimer()
   {
--- a/storage/src/VacuumManager.cpp
+++ b/storage/src/VacuumManager.cpp
@@ -104,17 +104,17 @@ NS_IMPL_ISUPPORTS(
 //////////////////////////////////////////////////////////////////////////////// 
 //// Vacuumer declaration.
 
 class Vacuumer : public BaseCallback
 {
 public:
   NS_DECL_MOZISTORAGESTATEMENTCALLBACK
 
-  Vacuumer(mozIStorageVacuumParticipant *aParticipant);
+  explicit Vacuumer(mozIStorageVacuumParticipant *aParticipant);
 
   bool execute();
   nsresult notifyCompletion(bool aSucceeded);
 
 private:
   nsCOMPtr<mozIStorageVacuumParticipant> mParticipant;
   nsCString mDBFilename;
   nsCOMPtr<mozIStorageConnection> mDBConn;
--- a/storage/src/Variant.h
+++ b/storage/src/Variant.h
@@ -369,17 +369,17 @@ template <typename DataType, bool Adopti
 class Variant : public Variant_base
 {
   ~Variant()
   {
     variant_storage_traits<DataType, Adopting>::destroy(mData);
   }
 
 public:
-  Variant(const typename variant_storage_traits<DataType, Adopting>::ConstructorType aData)
+  explicit Variant(const typename variant_storage_traits<DataType, Adopting>::ConstructorType aData)
   {
     variant_storage_traits<DataType, Adopting>::storage_conversion(aData, &mData);
   }
 
   NS_IMETHOD GetDataType(uint16_t *_type)
   {
     *_type = variant_traits<DataType>::type();
     return NS_OK;
--- a/storage/src/mozStorageAsyncStatementParams.h
+++ b/storage/src/mozStorageAsyncStatementParams.h
@@ -21,17 +21,17 @@ class AsyncStatement;
 /*
  * Since mozIStorageStatementParams is just a tagging interface we do not have
  * an async variant.
  */
 class AsyncStatementParams MOZ_FINAL : public mozIStorageStatementParams
                                      , public nsIXPCScriptable
 {
 public:
-  AsyncStatementParams(AsyncStatement *aStatement);
+  explicit AsyncStatementParams(AsyncStatement *aStatement);
 
   // interfaces
   NS_DECL_ISUPPORTS
   NS_DECL_MOZISTORAGESTATEMENTPARAMS
   NS_DECL_NSIXPCSCRIPTABLE
 
 protected:
   virtual ~AsyncStatementParams() {}
--- a/storage/src/mozStorageBindingParams.h
+++ b/storage/src/mozStorageBindingParams.h
@@ -51,17 +51,17 @@ public:
    */
   const mozIStorageBindingParamsArray *getOwner() const;
 
   BindingParams(mozIStorageBindingParamsArray *aOwningArray,
                 Statement *aOwningStatement);
 protected:
   virtual ~BindingParams() {}
 
-  BindingParams(mozIStorageBindingParamsArray *aOwningArray);
+  explicit BindingParams(mozIStorageBindingParamsArray *aOwningArray);
   nsCOMArray<nsIVariant> mParameters;
   bool mLocked;
 
 private:
 
   /**
    * Track the BindingParamsArray that created us until we are added to it.
    * (Once we are added we are locked and no one needs to look up our owner.)
@@ -92,17 +92,17 @@ class AsyncBindingParams : public Bindin
 {
 public:
   NS_IMETHOD BindByName(const nsACString & aName,
                                       nsIVariant *aValue);
   NS_IMETHOD BindByIndex(uint32_t aIndex, nsIVariant *aValue);
 
   virtual already_AddRefed<mozIStorageError> bind(sqlite3_stmt * aStatement);
 
-  AsyncBindingParams(mozIStorageBindingParamsArray *aOwningArray);
+  explicit AsyncBindingParams(mozIStorageBindingParamsArray *aOwningArray);
   virtual ~AsyncBindingParams() {}
 
 private:
   nsInterfaceHashtable<nsCStringHashKey, nsIVariant> mNamedParameters;
 
   struct NamedParameterIterationClosureThunk
   {
     AsyncBindingParams *self;
--- a/storage/src/mozStorageBindingParamsArray.h
+++ b/storage/src/mozStorageBindingParamsArray.h
@@ -23,17 +23,17 @@ class BindingParamsArray MOZ_FINAL : pub
   typedef nsTArray< nsCOMPtr<mozIStorageBindingParams> > array_type;
 
   ~BindingParamsArray() {}
 
 public:
   NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_MOZISTORAGEBINDINGPARAMSARRAY
 
-  BindingParamsArray(StorageBaseStatementInternal *aOwningStatement);
+  explicit BindingParamsArray(StorageBaseStatementInternal *aOwningStatement);
 
   typedef array_type::size_type size_type;
 
   /**
    * Locks the array and prevents further modification to it (such as adding
    * more elements to it).
    */
   void lock();
--- a/storage/src/mozStoragePrivateHelpers.cpp
+++ b/storage/src/mozStoragePrivateHelpers.cpp
@@ -153,17 +153,17 @@ convertJSValToVariant(
 
   return nullptr;
 }
 
 namespace {
 class CallbackEvent : public nsRunnable
 {
 public:
-  CallbackEvent(mozIStorageCompletionCallback *aCallback)
+  explicit CallbackEvent(mozIStorageCompletionCallback *aCallback)
   : mCallback(aCallback)
   {
   }
 
   NS_IMETHOD Run()
   {
     (void)mCallback->Complete(NS_OK, nullptr);
     return NS_OK;
--- a/storage/src/mozStorageSQLFunctions.cpp
+++ b/storage/src/mozStorageSQLFunctions.cpp
@@ -126,17 +126,17 @@ likeCompare(nsAString::const_iterator aP
  * free any heap-allocated memory, client code doesn't need to care where the
  * memory came from.
  */
 template <class T, size_t N> class AutoArray
 {
 
 public:
 
-  AutoArray(size_t size)
+  explicit AutoArray(size_t size)
   : mBuffer(size <= N ? mAutoBuffer : new T[size])
   {
   }
 
   ~AutoArray()
   { 
     if (mBuffer != mAutoBuffer)
       delete[] mBuffer; 
--- a/storage/src/mozStorageStatementParams.h
+++ b/storage/src/mozStorageStatementParams.h
@@ -17,17 +17,17 @@ namespace mozilla {
 namespace storage {
 
 class Statement;
 
 class StatementParams MOZ_FINAL : public mozIStorageStatementParams
                                 , public nsIXPCScriptable
 {
 public:
-  StatementParams(mozIStorageStatement *aStatement);
+  explicit StatementParams(mozIStorageStatement *aStatement);
 
   // interfaces
   NS_DECL_ISUPPORTS
   NS_DECL_MOZISTORAGESTATEMENTPARAMS
   NS_DECL_NSIXPCSCRIPTABLE
 
 protected:
   ~StatementParams() {}
--- a/storage/src/mozStorageStatementRow.h
+++ b/storage/src/mozStorageStatementRow.h
@@ -19,17 +19,17 @@ class Statement;
 class StatementRow MOZ_FINAL : public mozIStorageStatementRow
                              , public nsIXPCScriptable
 {
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_MOZISTORAGESTATEMENTROW
   NS_DECL_NSIXPCSCRIPTABLE
 
-  StatementRow(Statement *aStatement);
+  explicit StatementRow(Statement *aStatement);
 protected:
 
   ~StatementRow() {}
 
   Statement *mStatement;
 
   friend class Statement;
 };