Bug 1109694 - Fix more bad implicit constructors in DOM; r=baku
authorEhsan Akhgari <ehsan@mozilla.com>
Wed, 10 Dec 2014 17:49:09 -0500
changeset 219208 aa98e850663059ac81e09712fc0020c5b0274f1b
parent 219207 ccd27160dd9796a14a6caf52c1eda00d69463826
child 219209 cc15b655efc2aaae315c959c6f5752e566081ced
push idunknown
push userunknown
push dateunknown
reviewersbaku
bugs1109694
milestone37.0a1
Bug 1109694 - Fix more bad implicit constructors in DOM; r=baku
docshell/shistory/src/nsSHEntryShared.cpp
dom/canvas/CanvasRenderingContext2D.cpp
dom/canvas/WebGLBindableName.h
dom/geolocation/nsGeolocationSettings.h
dom/html/nsBrowserElement.cpp
dom/ipc/TabChild.cpp
dom/media/MediaDevices.h
dom/media/MediaPromise.h
dom/media/MediaStreamError.h
dom/media/MediaStreamGraph.h
dom/media/MediaTaskQueue.h
dom/media/fmp4/SharedDecoderManager.cpp
dom/media/gmp-plugin/gmp-test-decryptor.cpp
dom/media/gmp-plugin/gmp-test-decryptor.h
dom/media/gmp/GMPChild.cpp
dom/media/gmp/GMPStorageChild.cpp
dom/media/webm/SoftwareWebMVideoDecoder.h
dom/plugins/ipc/PluginModuleChild.h
dom/vr/VRDevice.h
dom/workers/ServiceWorkerClients.h
--- a/docshell/shistory/src/nsSHEntryShared.cpp
+++ b/docshell/shistory/src/nsSHEntryShared.cpp
@@ -29,17 +29,17 @@ uint64_t gSHEntrySharedID = 0;
 
 #define CONTENT_VIEWER_TIMEOUT_SECONDS "browser.sessionhistory.contentViewerTimeout"
 // Default this to time out unused content viewers after 30 minutes
 #define CONTENT_VIEWER_TIMEOUT_SECONDS_DEFAULT (30*60)
 
 typedef nsExpirationTracker<nsSHEntryShared, 3> HistoryTrackerBase;
 class HistoryTracker MOZ_FINAL : public HistoryTrackerBase {
 public:
-  HistoryTracker(uint32_t aTimeout)
+  explicit HistoryTracker(uint32_t aTimeout)
     : HistoryTrackerBase(1000 * aTimeout / 2)
   {
   }
 
 protected:
   virtual void NotifyExpired(nsSHEntryShared *aObj) {
     RemoveObject(aObj);
     aObj->Expire();
--- a/dom/canvas/CanvasRenderingContext2D.cpp
+++ b/dom/canvas/CanvasRenderingContext2D.cpp
@@ -690,17 +690,17 @@ NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(Ca
 NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(CanvasPattern, AddRef)
 NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(CanvasPattern, Release)
 
 NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(CanvasPattern, mContext)
 
 class CanvasDrawObserver
 {
 public:
-  CanvasDrawObserver(CanvasRenderingContext2D* aCanvasContext);
+  explicit CanvasDrawObserver(CanvasRenderingContext2D* aCanvasContext);
 
   // Only enumerate draw calls that could affect the heuristic
   enum DrawCallType {
     PutImageData,
     GetImageData,
     DrawImage
   };
 
--- a/dom/canvas/WebGLBindableName.h
+++ b/dom/canvas/WebGLBindableName.h
@@ -49,19 +49,19 @@ protected:
 /** Represents a GL name that can be bound to a target.
  */
 template<typename T>
 class WebGLBindableName
     : public WebGLBindable<T>
 {
 public:
 
-    WebGLBindableName(GLuint name)
+    explicit WebGLBindableName(GLuint aName)
         : WebGLBindable<T>()
-        , mGLName(name)
+        , mGLName(aName)
     { }
     GLuint GLName() const { return mGLName; }
 
 protected:
     const GLuint mGLName;
 };
 
 
--- a/dom/geolocation/nsGeolocationSettings.h
+++ b/dom/geolocation/nsGeolocationSettings.h
@@ -52,17 +52,17 @@ enum GeolocationFuzzMethod {
 #endif
 
 /**
  * Simple class for holding the geolocation settings values.
  */
 
 class GeolocationSetting MOZ_FINAL {
 public:
-  GeolocationSetting(const nsString& aOrigin) :
+  explicit GeolocationSetting(const nsString& aOrigin) :
     mFuzzMethod(GEO_ALA_TYPE_DEFAULT),
 #ifdef MOZ_APPROX_LOCATION
     mDistance(0),
 #endif
     mLatitude(0.0),
     mLongitude(0.0),
     mOrigin(aOrigin) {}
 
--- a/dom/html/nsBrowserElement.cpp
+++ b/dom/html/nsBrowserElement.cpp
@@ -30,17 +30,17 @@ namespace mozilla {
 
 static const char kRemoteBrowserPending[] = "remote-browser-pending";
 static const char kInprocessBrowserShown[] = "inprocess-browser-shown";
 
 class nsBrowserElement::BrowserShownObserver : public nsIObserver
                                              , public nsSupportsWeakReference
 {
 public:
-  BrowserShownObserver(nsBrowserElement* aBrowserElement);
+  explicit BrowserShownObserver(nsBrowserElement* aBrowserElement);
   NS_DECL_ISUPPORTS
   NS_DECL_NSIOBSERVER
   void AddObserver();
   void RemoveObserver();
 private:
   virtual ~BrowserShownObserver();
 
   // Weak reference to the browser element. nsBrowserElement has a
--- a/dom/ipc/TabChild.cpp
+++ b/dom/ipc/TabChild.cpp
@@ -753,17 +753,17 @@ private:
 };
 
 class TabChild::DelayedDeleteRunnable MOZ_FINAL
   : public nsRunnable
 {
     nsRefPtr<TabChild> mTabChild;
 
 public:
-    DelayedDeleteRunnable(TabChild* aTabChild)
+    explicit DelayedDeleteRunnable(TabChild* aTabChild)
       : mTabChild(aTabChild)
     {
         MOZ_ASSERT(NS_IsMainThread());
         MOZ_ASSERT(aTabChild);
     }
 
 private:
     ~DelayedDeleteRunnable()
--- a/dom/media/MediaDevices.h
+++ b/dom/media/MediaDevices.h
@@ -19,17 +19,18 @@ struct MediaStreamConstraints;
 
 #define MOZILLA_DOM_MEDIADEVICES_IMPLEMENTATION_IID \
 { 0x2f784d8a, 0x7485, 0x4280, \
  { 0x9a, 0x36, 0x74, 0xa4, 0xd6, 0x71, 0xa6, 0xc8 } }
 
 class MediaDevices MOZ_FINAL : public DOMEventTargetHelper
 {
 public:
-  MediaDevices(nsPIDOMWindow* aWindow) : DOMEventTargetHelper(aWindow) {}
+  explicit MediaDevices(nsPIDOMWindow* aWindow) :
+    DOMEventTargetHelper(aWindow) {}
 
   NS_DECL_ISUPPORTS_INHERITED
   NS_DECLARE_STATIC_IID_ACCESSOR(MOZILLA_DOM_MEDIADEVICES_IMPLEMENTATION_IID)
 
   JSObject* WrapObject(JSContext* cx) MOZ_OVERRIDE;
 
   already_AddRefed<Promise>
   GetUserMedia(const MediaStreamConstraints& aConstraints, ErrorResult &aRv);
--- a/dom/media/MediaPromise.h
+++ b/dom/media/MediaPromise.h
@@ -52,17 +52,17 @@ template<typename T> class MediaPromiseH
 template<typename ResolveValueT, typename RejectValueT>
 class MediaPromise
 {
 public:
   typedef ResolveValueT ResolveValueType;
   typedef RejectValueT RejectValueType;
 
   NS_INLINE_DECL_THREADSAFE_REFCOUNTING(MediaPromise)
-  MediaPromise(const char* aCreationSite)
+  explicit MediaPromise(const char* aCreationSite)
     : mCreationSite(aCreationSite)
     , mMutex("MediaPromise Mutex")
   {
     MOZ_COUNT_CTOR(MediaPromise);
     PROMISE_LOG("%s creating MediaPromise (%p)", mCreationSite, this);
   }
 
 protected:
@@ -133,17 +133,17 @@ protected:
         return NS_OK;
       }
 
     private:
       ThenValueBase* mThenValue;
       RejectValueType mRejectValue;
     };
 
-    ThenValueBase(const char* aCallSite) : mCallSite(aCallSite)
+    explicit ThenValueBase(const char* aCallSite) : mCallSite(aCallSite)
     {
       MOZ_COUNT_CTOR(ThenValueBase);
     }
 
     virtual void Dispatch(MediaPromise *aPromise) = 0;
 
   protected:
     // This may only be deleted by {Resolve,Reject}Runnable::Run.
--- a/dom/media/MediaStreamError.h
+++ b/dom/media/MediaStreamError.h
@@ -39,19 +39,19 @@ protected:
   nsString mMessage;
   const nsString mConstraintName;
 };
 
 class MediaMgrError MOZ_FINAL : public nsISupports,
                                 public BaseMediaMgrError
 {
 public:
-  MediaMgrError(const nsAString& aName,
-                const nsAString& aMessage =  EmptyString(),
-                const nsAString& aConstraintName =  EmptyString())
+  explicit MediaMgrError(const nsAString& aName,
+                         const nsAString& aMessage =  EmptyString(),
+                         const nsAString& aConstraintName =  EmptyString())
   : BaseMediaMgrError(aName, aMessage, aConstraintName) {}
 
   NS_DECL_THREADSAFE_ISUPPORTS
 
 private:
   ~MediaMgrError() {}
 };
 
--- a/dom/media/MediaStreamGraph.h
+++ b/dom/media/MediaStreamGraph.h
@@ -1206,17 +1206,17 @@ public:
   }
 
   /**
    * Returns graph sample rate in Hz.
    */
   TrackRate GraphRate() const { return mSampleRate; }
 
 protected:
-  MediaStreamGraph(TrackRate aSampleRate)
+  explicit MediaStreamGraph(TrackRate aSampleRate)
     : mNextGraphUpdateIndex(1)
     , mSampleRate(aSampleRate)
   {
     MOZ_COUNT_CTOR(MediaStreamGraph);
   }
   virtual ~MediaStreamGraph()
   {
     MOZ_COUNT_DTOR(MediaStreamGraph);
--- a/dom/media/MediaTaskQueue.h
+++ b/dom/media/MediaTaskQueue.h
@@ -87,17 +87,18 @@ private:
 
   // Monitor that protects the queue and mIsRunning;
   Monitor mQueueMonitor;
 
   struct TaskQueueEntry {
     RefPtr<nsIRunnable> mRunnable;
     bool mForceDispatch;
 
-    TaskQueueEntry(TemporaryRef<nsIRunnable> aRunnable, bool aForceDispatch = false)
+    explicit TaskQueueEntry(TemporaryRef<nsIRunnable> aRunnable,
+                            bool aForceDispatch = false)
       : mRunnable(aRunnable), mForceDispatch(aForceDispatch) {}
   };
 
   // Queue of tasks to run.
   std::queue<TaskQueueEntry> mTasks;
 
   // The thread currently running the task queue. We store a reference
   // to this so that IsCurrentThreadIn() can tell if the current thread
--- a/dom/media/fmp4/SharedDecoderManager.cpp
+++ b/dom/media/fmp4/SharedDecoderManager.cpp
@@ -7,17 +7,17 @@
 #include "SharedDecoderManager.h"
 #include "mp4_demuxer/DecoderData.h"
 
 namespace mozilla {
 
 class SharedDecoderCallback : public MediaDataDecoderCallback
 {
 public:
-  SharedDecoderCallback(SharedDecoderManager* aManager) : mManager(aManager) {}
+  explicit SharedDecoderCallback(SharedDecoderManager* aManager) : mManager(aManager) {}
 
   virtual void Output(MediaData* aData) MOZ_OVERRIDE
   {
     if (mManager->mActiveCallback) {
       mManager->mActiveCallback->Output(aData);
     }
   }
   virtual void Error() MOZ_OVERRIDE
--- a/dom/media/gmp-plugin/gmp-test-decryptor.cpp
+++ b/dom/media/gmp-plugin/gmp-test-decryptor.cpp
@@ -145,19 +145,19 @@ public:
     delete this;
   }
   string mId;
   ReadContinuation* mThen;
 };
 
 class SendMessageTask : public GMPTask {
 public:
-  SendMessageTask(const string& aMessage,
-                  TestManager* aTestManager = nullptr,
-                  const string& aTestID = "")
+  explicit SendMessageTask(const string& aMessage,
+                           TestManager* aTestManager = nullptr,
+                           const string& aTestID = "")
     : mMessage(aMessage), mTestmanager(aTestManager), mTestID(aTestID) {}
 
   void Run() MOZ_OVERRIDE {
     FakeDecryptor::Message(mMessage);
     if (mTestmanager) {
       mTestmanager->EndTest(mTestID);
     }
   }
--- a/dom/media/gmp-plugin/gmp-test-decryptor.h
+++ b/dom/media/gmp-plugin/gmp-test-decryptor.h
@@ -9,17 +9,17 @@
 #include "gmp-decryption.h"
 #include "gmp-async-shutdown.h"
 #include <string>
 #include "mozilla/Attributes.h"
 
 class FakeDecryptor : public GMPDecryptor {
 public:
 
-  FakeDecryptor(GMPDecryptorHost* aHost);
+  explicit FakeDecryptor(GMPDecryptorHost* aHost);
 
   virtual void Init(GMPDecryptorCallback* aCallback) MOZ_OVERRIDE {
     mCallback = aCallback;
   }
 
   virtual void CreateSession(uint32_t aPromiseId,
                              const char* aInitDataType,
                              uint32_t aInitDataTypeSize,
--- a/dom/media/gmp/GMPChild.cpp
+++ b/dom/media/gmp/GMPChild.cpp
@@ -356,17 +356,17 @@ GMPChild::PreLoadLibraries(const std::st
 }
 #endif
 
 #if defined(MOZ_GMP_SANDBOX)
 
 #if defined(XP_MACOSX)
 class MacOSXSandboxStarter : public SandboxStarter {
 public:
-  MacOSXSandboxStarter(GMPChild* aGMPChild)
+  explicit MacOSXSandboxStarter(GMPChild* aGMPChild)
     : mGMPChild(aGMPChild)
   {}
   virtual void Start(const char* aLibPath) MOZ_OVERRIDE {
     mGMPChild->StartMacSandbox();
   }
 private:
   GMPChild* mGMPChild;
 };
--- a/dom/media/gmp/GMPStorageChild.cpp
+++ b/dom/media/gmp/GMPStorageChild.cpp
@@ -288,17 +288,17 @@ GMPStorageChild::EnumerateRecords(RecvGM
 
   CALL_ON_GMP_THREAD(SendGetRecordNames);
 
   return GMPNoErr;
 }
 
 class GMPRecordIteratorImpl : public GMPRecordIterator {
 public:
-  GMPRecordIteratorImpl(const InfallibleTArray<nsCString>& aRecordNames)
+  explicit GMPRecordIteratorImpl(const InfallibleTArray<nsCString>& aRecordNames)
     : mRecordNames(aRecordNames)
     , mIndex(0)
   {
     mRecordNames.Sort();
   }
 
   virtual GMPErr GetName(const char** aOutName, uint32_t* aOutNameLength) MOZ_OVERRIDE {
     if (!aOutName || !aOutNameLength) {
--- a/dom/media/webm/SoftwareWebMVideoDecoder.h
+++ b/dom/media/webm/SoftwareWebMVideoDecoder.h
@@ -19,17 +19,17 @@ public:
 
   virtual nsresult Init(unsigned int aWidth, unsigned int aHeight) MOZ_OVERRIDE;
 
   virtual bool DecodeVideoFrame(bool &aKeyframeSkip,
                                 int64_t aTimeThreshold) MOZ_OVERRIDE;
 
   virtual void Shutdown() MOZ_OVERRIDE;
 
-  SoftwareWebMVideoDecoder(WebMReader* aReader);
+  explicit SoftwareWebMVideoDecoder(WebMReader* aReader);
   ~SoftwareWebMVideoDecoder();
 
 private:
   nsRefPtr<WebMReader> mReader;
 
   // VPx decoder state
   vpx_codec_ctx_t mVPX;
 };
--- a/dom/plugins/ipc/PluginModuleChild.h
+++ b/dom/plugins/ipc/PluginModuleChild.h
@@ -145,17 +145,17 @@ protected:
     virtual bool RecvStartProfiler(const uint32_t& aEntries,
                                    const double& aInterval,
                                    const nsTArray<nsCString>& aFeatures,
                                    const nsTArray<nsCString>& aThreadNameFilters) MOZ_OVERRIDE;
     virtual bool RecvStopProfiler() MOZ_OVERRIDE;
     virtual bool AnswerGetProfile(nsCString* aProfile) MOZ_OVERRIDE;
 
 public:
-    PluginModuleChild(bool aIsChrome);
+    explicit PluginModuleChild(bool aIsChrome);
     virtual ~PluginModuleChild();
 
     bool CommonInit(base::ProcessHandle aParentProcessHandle,
                     MessageLoop* aIOLoop,
                     IPC::Channel* aChannel);
 
     // aPluginFilename is UTF8, not native-charset!
     bool InitForChrome(const std::string& aPluginFilename,
--- a/dom/vr/VRDevice.h
+++ b/dom/vr/VRDevice.h
@@ -217,17 +217,17 @@ class PositionSensorVRDevice : public VR
 public:
   virtual already_AddRefed<VRPositionState> GetState(double timeOffset) = 0;
 
   virtual void ZeroSensor() = 0;
 
   virtual JSObject* WrapObject(JSContext* aCx) MOZ_OVERRIDE;
 
 protected:
-  PositionSensorVRDevice(nsISupports* aParent)
+  explicit PositionSensorVRDevice(nsISupports* aParent)
     : VRDevice(aParent, VRDevice::PositionSensor)
   { }
 
   virtual ~PositionSensorVRDevice() { }
 };
 
 } // namespace dom
 } // namespace mozilla
--- a/dom/workers/ServiceWorkerClients.h
+++ b/dom/workers/ServiceWorkerClients.h
@@ -23,17 +23,17 @@ namespace workers {
 
 class ServiceWorkerClients MOZ_FINAL : public nsISupports,
                                        public nsWrapperCache
 {
 public:
   NS_DECL_CYCLE_COLLECTING_ISUPPORTS
   NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(ServiceWorkerClients)
 
-  ServiceWorkerClients(ServiceWorkerGlobalScope* aWorkerScope);
+  explicit ServiceWorkerClients(ServiceWorkerGlobalScope* aWorkerScope);
 
   already_AddRefed<Promise> GetServiced(ErrorResult& aRv);
   already_AddRefed<Promise> ReloadAll(ErrorResult& aRv);
 
   JSObject* WrapObject(JSContext* aCx) MOZ_OVERRIDE;
 
   ServiceWorkerGlobalScope* GetParentObject() const
   {