Bug 1048239 - Fix more bad implicit constructors in XPCOM; r=froydnj
authorEhsan Akhgari <ehsan@mozilla.com>
Tue, 05 Aug 2014 09:36:32 -0400
changeset 197840 b81d755b1b376ea2b23b38fd0de5ac1d92c31239
parent 197839 0f10ded995a781358e0ee20b32c4e55cc4803c6e
child 197841 64249d8c98148a2bc993e2c9fd1a160582b0a7ad
push id47240
push usereakhgari@mozilla.com
push dateTue, 05 Aug 2014 13:38:31 +0000
treeherdermozilla-inbound@5fabfe36fa48 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfroydnj
bugs1048239
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 1048239 - Fix more bad implicit constructors in XPCOM; r=froydnj
intl/unicharutil/nsSaveAsCharset.cpp
xpcom/base/nsMemoryInfoDumper.cpp
xpcom/base/nsMemoryReporterManager.cpp
xpcom/base/nsMessageLoop.cpp
xpcom/ds/nsExpirationTracker.h
xpcom/ds/nsWhitespaceTokenizer.h
--- a/intl/unicharutil/nsSaveAsCharset.cpp
+++ b/intl/unicharutil/nsSaveAsCharset.cpp
@@ -351,17 +351,17 @@ nsresult nsSaveAsCharset::SetupCharsetLi
   if (!charsetList[0])
     return NS_ERROR_INVALID_ARG;
 
   if (mCharsetListIndex >= 0) {
     mCharsetList.Clear();
     mCharsetListIndex = -1;
   }
 
-  nsCWhitespaceTokenizer tokenizer = nsDependentCString(charsetList);
+  nsCWhitespaceTokenizer tokenizer((nsDependentCString(charsetList)));
   while (tokenizer.hasMoreTokens()) {
     ParseString(tokenizer.nextToken(), ',', mCharsetList);
   }
 
   return NS_OK;
 }
 
 const char * nsSaveAsCharset::GetNextCharset()
--- a/xpcom/base/nsMemoryInfoDumper.cpp
+++ b/xpcom/base/nsMemoryInfoDumper.cpp
@@ -314,17 +314,17 @@ EnsureNonEmptyIdentifier(nsAString& aIde
 // Use XPCOM refcounting to fire |onFinish| when all reference-holders
 // (remote dump actors or the |DumpGCAndCCLogsToFile| activation itself)
 // have gone away.
 class nsDumpGCAndCCLogsCallbackHolder MOZ_FINAL : public nsIDumpGCAndCCLogsCallback
 {
 public:
   NS_DECL_ISUPPORTS
 
-  nsDumpGCAndCCLogsCallbackHolder(nsIDumpGCAndCCLogsCallback* aCallback)
+  explicit nsDumpGCAndCCLogsCallbackHolder(nsIDumpGCAndCCLogsCallback* aCallback)
     : mCallback(aCallback)
   {
   }
 
   NS_IMETHODIMP OnFinish()
   {
     return NS_ERROR_UNEXPECTED;
   }
@@ -425,17 +425,17 @@ namespace mozilla {
       return rv; \
   } while (0)
 
 class DumpReportCallback MOZ_FINAL : public nsIHandleReportCallback
 {
 public:
   NS_DECL_ISUPPORTS
 
-  DumpReportCallback(nsGZFileWriter* aWriter)
+  explicit DumpReportCallback(nsGZFileWriter* aWriter)
     : mIsFirst(true)
     , mWriter(aWriter)
   {
   }
 
   NS_IMETHOD Callback(const nsACString& aProcess, const nsACString& aPath,
                       int32_t aKind, int32_t aUnits, int64_t aAmount,
                       const nsACString& aDescription,
--- a/xpcom/base/nsMemoryReporterManager.cpp
+++ b/xpcom/base/nsMemoryReporterManager.cpp
@@ -1856,17 +1856,17 @@ namespace {
  * notification, spin the event loop, and repeat this process a few times.
  *
  * When this sequence finishes, we invoke the callback function passed to the
  * runnable's constructor.
  */
 class MinimizeMemoryUsageRunnable : public nsRunnable
 {
 public:
-  MinimizeMemoryUsageRunnable(nsIRunnable* aCallback)
+  explicit MinimizeMemoryUsageRunnable(nsIRunnable* aCallback)
     : mCallback(aCallback)
     , mRemainingIters(sNumIters)
   {
   }
 
   NS_IMETHOD Run()
   {
     nsCOMPtr<nsIObserverService> os = services::GetObserverService();
--- a/xpcom/base/nsMessageLoop.cpp
+++ b/xpcom/base/nsMessageLoop.cpp
@@ -54,17 +54,17 @@ private:
  * should in theory suffice: When the MessageLoopIdleTask runs (right before
  * the MessageLoop deletes it), it cancels its timer.  But the weak pointer
  * saves us from worrying about an edge case somehow messing us up here.
  */
 class MessageLoopTimerCallback
   : public nsITimerCallback
 {
 public:
-  MessageLoopTimerCallback(MessageLoopIdleTask* aTask);
+  explicit MessageLoopTimerCallback(MessageLoopIdleTask* aTask);
 
   NS_DECL_ISUPPORTS
   NS_DECL_NSITIMERCALLBACK
 
 private:
   WeakPtr<MessageLoopIdleTask> mTask;
 
   virtual ~MessageLoopTimerCallback() {}
--- a/xpcom/ds/nsExpirationTracker.h
+++ b/xpcom/ds/nsExpirationTracker.h
@@ -78,17 +78,17 @@ class nsExpirationTracker
 public:
   /**
    * Initialize the tracker.
    * @param aTimerPeriod the timer period in milliseconds. The guarantees
    * provided by the tracker are defined in terms of this period. If the
    * period is zero, then we don't use a timer and rely on someone calling
    * AgeOneGeneration explicitly.
    */
-  nsExpirationTracker(uint32_t aTimerPeriod)
+  explicit nsExpirationTracker(uint32_t aTimerPeriod)
     : mTimerPeriod(aTimerPeriod)
     , mNewestGeneration(0)
     , mInAgeOneGeneration(false)
   {
     static_assert(K >= 2 && K <= nsExpirationState::NOT_TRACKED,
                   "Unsupported number of generations (must be 2 <= K <= 15)");
     mObserver = new ExpirationTrackerObserver();
     mObserver->Init(this);
@@ -233,17 +233,17 @@ public:
 
   class Iterator
   {
   private:
     nsExpirationTracker<T, K>* mTracker;
     uint32_t mGeneration;
     uint32_t mIndex;
   public:
-    Iterator(nsExpirationTracker<T, K>* aTracker)
+    explicit Iterator(nsExpirationTracker<T, K>* aTracker)
       : mTracker(aTracker)
       , mGeneration(0)
       , mIndex(0)
     {
     }
 
     T* Next()
     {
--- a/xpcom/ds/nsWhitespaceTokenizer.h
+++ b/xpcom/ds/nsWhitespaceTokenizer.h
@@ -12,17 +12,17 @@
 
 template<typename DependentSubstringType, bool IsWhitespace(char16_t)>
 class nsTWhitespaceTokenizer
 {
   typedef typename DependentSubstringType::char_type CharType;
   typedef typename DependentSubstringType::substring_type SubstringType;
 
 public:
-    nsTWhitespaceTokenizer(const SubstringType& aSource)
+    explicit nsTWhitespaceTokenizer(const SubstringType& aSource)
         : mIter(aSource.Data(), aSource.Length()),
           mEnd(aSource.Data() + aSource.Length(), aSource.Data(),
                aSource.Length()),
           mWhitespaceBeforeFirstToken(false),
           mWhitespaceAfterCurrentToken(false)
     {
         while (mIter < mEnd && IsWhitespace(*mIter)) {
             mWhitespaceBeforeFirstToken = true;
@@ -80,30 +80,30 @@ private:
     bool mWhitespaceAfterCurrentToken;
 };
 
 template<bool IsWhitespace(char16_t) = NS_IsAsciiWhitespace>
 class nsWhitespaceTokenizerTemplate
   : public nsTWhitespaceTokenizer<nsDependentSubstring, IsWhitespace>
 {
 public:
-  nsWhitespaceTokenizerTemplate(const nsSubstring& aSource)
+  explicit nsWhitespaceTokenizerTemplate(const nsSubstring& aSource)
     : nsTWhitespaceTokenizer<nsDependentSubstring, IsWhitespace>(aSource)
   {
   }
 };
 
 typedef nsWhitespaceTokenizerTemplate<> nsWhitespaceTokenizer;
 
 template<bool IsWhitespace(char16_t) = NS_IsAsciiWhitespace>
 class nsCWhitespaceTokenizerTemplate
   : public nsTWhitespaceTokenizer<nsDependentCSubstring, IsWhitespace>
 {
 public:
-  nsCWhitespaceTokenizerTemplate(const nsCSubstring& aSource)
+  explicit nsCWhitespaceTokenizerTemplate(const nsCSubstring& aSource)
     : nsTWhitespaceTokenizer<nsDependentCSubstring, IsWhitespace>(aSource)
   {
   }
 };
 
 typedef nsCWhitespaceTokenizerTemplate<> nsCWhitespaceTokenizer;
 
 #endif /* __nsWhitespaceTokenizer_h */