Bug 1061060 - Fix more bad implicit constructors in parser; r=hsivonen
authorEhsan Akhgari <ehsan@mozilla.com>
Mon, 01 Sep 2014 18:04:52 -0400
changeset 224552 118399d457685f5368da09f20cf647308a869175
parent 224551 4165ed00dc3b0b73dbb846a2f13f693cca043ca7
child 224553 232ad77a5d5abb90be4aabc0a397178fdf315f6e
push id3979
push userraliiev@mozilla.com
push dateMon, 13 Oct 2014 16:35:44 +0000
treeherdermozilla-beta@30f2cc610691 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewershsivonen
bugs1061060
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 1061060 - Fix more bad implicit constructors in parser; r=hsivonen
parser/html/nsHtml5Atom.h
parser/html/nsHtml5DependentUTF16Buffer.h
parser/html/nsHtml5Highlighter.h
parser/html/nsHtml5Module.cpp
parser/html/nsHtml5ReleasableElementName.h
parser/html/nsHtml5SVGLoadDispatcher.h
parser/html/nsHtml5StreamParser.cpp
parser/html/nsHtml5TreeBuilderHSupplement.h
parser/html/nsHtml5TreeOpExecutor.cpp
parser/htmlparser/nsParser.cpp
parser/htmlparser/nsScanner.h
parser/htmlparser/nsScannerString.h
--- a/parser/html/nsHtml5Atom.h
+++ b/parser/html/nsHtml5Atom.h
@@ -16,13 +16,13 @@
  * Usage is documented in nsHtml5AtomTable and nsIAtom.
  */
 class nsHtml5Atom MOZ_FINAL : public nsIAtom
 {
   public:
     NS_DECL_ISUPPORTS
     NS_DECL_NSIATOM
 
-    nsHtml5Atom(const nsAString& aString);
+    explicit nsHtml5Atom(const nsAString& aString);
     ~nsHtml5Atom();
 };
 
 #endif // nsHtml5Atom_h
--- a/parser/html/nsHtml5DependentUTF16Buffer.h
+++ b/parser/html/nsHtml5DependentUTF16Buffer.h
@@ -10,17 +10,17 @@
 
 class MOZ_STACK_CLASS nsHtml5DependentUTF16Buffer : public nsHtml5UTF16Buffer
 {
   public:
     /**
      * Wraps a string without taking ownership of the buffer. aToWrap MUST NOT
      * go away or be shortened while nsHtml5DependentUTF16Buffer is in use.
      */
-    nsHtml5DependentUTF16Buffer(const nsAString& aToWrap);
+    explicit nsHtml5DependentUTF16Buffer(const nsAString& aToWrap);
 
     ~nsHtml5DependentUTF16Buffer();
 
     /**
      * Copies the currently unconsumed part of this buffer into a new
      * heap-allocated nsHtml5OwningUTF16Buffer. The new object is allocated
      * with a fallible allocator. If the allocation fails, nullptr is returned.
      * @return heap-allocated copy or nullptr if memory allocation failed
--- a/parser/html/nsHtml5Highlighter.h
+++ b/parser/html/nsHtml5Highlighter.h
@@ -19,17 +19,17 @@
 class nsHtml5Highlighter
 {
   public:
     /**
      * The constructor.
      *
      * @param aOpSink the sink for the tree ops generated by this highlighter
      */
-    nsHtml5Highlighter(nsAHtml5TreeOpSink* aOpSink);
+    explicit nsHtml5Highlighter(nsAHtml5TreeOpSink* aOpSink);
 
     /**
      * The destructor.
      */
     ~nsHtml5Highlighter();
 
     /**
      * Starts the generated document.
--- a/parser/html/nsHtml5Module.cpp
+++ b/parser/html/nsHtml5Module.cpp
@@ -84,17 +84,17 @@ nsHtml5Module::Initialize(nsIParser* aPa
   nsHtml5Parser* parser = static_cast<nsHtml5Parser*> (aParser);
   return parser->Initialize(aDoc, aURI, aContainer, aChannel);
 }
 
 class nsHtml5ParserThreadTerminator MOZ_FINAL : public nsIObserver
 {
   public:
     NS_DECL_ISUPPORTS
-    nsHtml5ParserThreadTerminator(nsIThread* aThread)
+    explicit nsHtml5ParserThreadTerminator(nsIThread* aThread)
       : mThread(aThread)
     {}
     NS_IMETHODIMP Observe(nsISupports *, const char *topic, const char16_t *)
     {
       NS_ASSERTION(!strcmp(topic, "xpcom-shutdown-threads"), 
                    "Unexpected topic");
       if (mThread) {
         mThread->Shutdown();
--- a/parser/html/nsHtml5ReleasableElementName.h
+++ b/parser/html/nsHtml5ReleasableElementName.h
@@ -6,14 +6,14 @@
 #define nsHtml5ReleasableElementName_h
 
 #include "nsHtml5ElementName.h"
 #include "mozilla/Attributes.h"
 
 class nsHtml5ReleasableElementName MOZ_FINAL : public nsHtml5ElementName
 {
   public:
-    nsHtml5ReleasableElementName(nsIAtom* name);
+    explicit nsHtml5ReleasableElementName(nsIAtom* name);
     virtual void release();
     virtual nsHtml5ElementName* cloneElementName(nsHtml5AtomTable* interner);
 };
 
 #endif // nsHtml5ReleasableElementName_h
--- a/parser/html/nsHtml5SVGLoadDispatcher.h
+++ b/parser/html/nsHtml5SVGLoadDispatcher.h
@@ -9,13 +9,13 @@
 #include "nsIContent.h"
 
 class nsHtml5SVGLoadDispatcher : public nsRunnable
 {
   private:
     nsCOMPtr<nsIContent> mElement;
     nsCOMPtr<nsIDocument> mDocument;
   public:
-    nsHtml5SVGLoadDispatcher(nsIContent* aElement);
+    explicit nsHtml5SVGLoadDispatcher(nsIContent* aElement);
     NS_IMETHOD Run();
 };
 
 #endif // nsHtml5SVGLoadDispatcher_h
--- a/parser/html/nsHtml5StreamParser.cpp
+++ b/parser/html/nsHtml5StreamParser.cpp
@@ -112,34 +112,34 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(
   }
 NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
 
 class nsHtml5ExecutorFlusher : public nsRunnable
 {
   private:
     nsRefPtr<nsHtml5TreeOpExecutor> mExecutor;
   public:
-    nsHtml5ExecutorFlusher(nsHtml5TreeOpExecutor* aExecutor)
+    explicit nsHtml5ExecutorFlusher(nsHtml5TreeOpExecutor* aExecutor)
       : mExecutor(aExecutor)
     {}
     NS_IMETHODIMP Run()
     {
       if (!mExecutor->isInList()) {
         mExecutor->RunFlushLoop();
       }
       return NS_OK;
     }
 };
 
 class nsHtml5LoadFlusher : public nsRunnable
 {
   private:
     nsRefPtr<nsHtml5TreeOpExecutor> mExecutor;
   public:
-    nsHtml5LoadFlusher(nsHtml5TreeOpExecutor* aExecutor)
+    explicit nsHtml5LoadFlusher(nsHtml5TreeOpExecutor* aExecutor)
       : mExecutor(aExecutor)
     {}
     NS_IMETHODIMP Run()
     {
       mExecutor->FlushSpeculativeLoads();
       return NS_OK;
     }
 };
@@ -1019,17 +1019,17 @@ nsHtml5StreamParser::DoStopRequest()
   ParseAvailableData(); 
 }
 
 class nsHtml5RequestStopper : public nsRunnable
 {
   private:
     nsHtml5RefPtr<nsHtml5StreamParser> mStreamParser;
   public:
-    nsHtml5RequestStopper(nsHtml5StreamParser* aStreamParser)
+    explicit nsHtml5RequestStopper(nsHtml5StreamParser* aStreamParser)
       : mStreamParser(aStreamParser)
     {}
     NS_IMETHODIMP Run()
     {
       mozilla::MutexAutoLock autoLock(mStreamParser->mTokenizerMutex);
       mStreamParser->DoStopRequest();
       return NS_OK;
     }
@@ -1405,17 +1405,17 @@ nsHtml5StreamParser::ParseAvailableData(
   }
 }
 
 class nsHtml5StreamParserContinuation : public nsRunnable
 {
 private:
   nsHtml5RefPtr<nsHtml5StreamParser> mStreamParser;
 public:
-  nsHtml5StreamParserContinuation(nsHtml5StreamParser* aStreamParser)
+  explicit nsHtml5StreamParserContinuation(nsHtml5StreamParser* aStreamParser)
     : mStreamParser(aStreamParser)
   {}
   NS_IMETHODIMP Run()
   {
     mozilla::MutexAutoLock autoLock(mStreamParser->mTokenizerMutex);
     mStreamParser->Uninterrupt();
     mStreamParser->ParseAvailableData();
     return NS_OK;
@@ -1570,17 +1570,17 @@ nsHtml5StreamParser::ContinueAfterFailed
   }
 }
 
 class nsHtml5TimerKungFu : public nsRunnable
 {
 private:
   nsHtml5RefPtr<nsHtml5StreamParser> mStreamParser;
 public:
-  nsHtml5TimerKungFu(nsHtml5StreamParser* aStreamParser)
+  explicit nsHtml5TimerKungFu(nsHtml5StreamParser* aStreamParser)
     : mStreamParser(aStreamParser)
   {}
   NS_IMETHODIMP Run()
   {
     if (mStreamParser->mFlushTimer) {
       mStreamParser->mFlushTimer->Cancel();
       mStreamParser->mFlushTimer = nullptr;
     }
--- a/parser/html/nsHtml5TreeBuilderHSupplement.h
+++ b/parser/html/nsHtml5TreeBuilderHSupplement.h
@@ -67,17 +67,17 @@
     void MarkAsBrokenAndRequestSuspension(nsresult aRv)
     {
       mBuilder->MarkAsBroken(aRv);
       requestSuspension();
     }
 
   public:
 
-    nsHtml5TreeBuilder(nsHtml5OplessBuilder* aBuilder);
+    explicit nsHtml5TreeBuilder(nsHtml5OplessBuilder* aBuilder);
 
     nsHtml5TreeBuilder(nsAHtml5TreeOpSink* aOpSink,
                        nsHtml5TreeOpStage* aStage);
 
     ~nsHtml5TreeBuilder();
     
     void StartPlainTextViewSource(const nsAutoString& aTitle);
 
--- a/parser/html/nsHtml5TreeOpExecutor.cpp
+++ b/parser/html/nsHtml5TreeOpExecutor.cpp
@@ -41,17 +41,17 @@ NS_IMPL_ADDREF_INHERITED(nsHtml5TreeOpEx
 
 NS_IMPL_RELEASE_INHERITED(nsHtml5TreeOpExecutor, nsContentSink)
 
 class nsHtml5ExecutorReflusher : public nsRunnable
 {
   private:
     nsRefPtr<nsHtml5TreeOpExecutor> mExecutor;
   public:
-    nsHtml5ExecutorReflusher(nsHtml5TreeOpExecutor* aExecutor)
+    explicit nsHtml5ExecutorReflusher(nsHtml5TreeOpExecutor* aExecutor)
       : mExecutor(aExecutor)
     {}
     NS_IMETHODIMP Run()
     {
       mExecutor->RunFlushLoop();
       return NS_OK;
     }
 };
@@ -300,17 +300,17 @@ nsHtml5TreeOpExecutor::FlushSpeculativeL
 class nsHtml5FlushLoopGuard
 {
   private:
     nsRefPtr<nsHtml5TreeOpExecutor> mExecutor;
     #ifdef DEBUG_NS_HTML5_TREE_OP_EXECUTOR_FLUSH
     uint32_t mStartTime;
     #endif
   public:
-    nsHtml5FlushLoopGuard(nsHtml5TreeOpExecutor* aExecutor)
+    explicit nsHtml5FlushLoopGuard(nsHtml5TreeOpExecutor* aExecutor)
       : mExecutor(aExecutor)
     #ifdef DEBUG_NS_HTML5_TREE_OP_EXECUTOR_FLUSH
       , mStartTime(PR_IntervalToMilliseconds(PR_IntervalNow()))
     #endif
     {
       mExecutor->mRunFlushLoopOnStack = true;
     }
     ~nsHtml5FlushLoopGuard()
--- a/parser/htmlparser/nsParser.cpp
+++ b/parser/htmlparser/nsParser.cpp
@@ -108,17 +108,17 @@ For more details @see bugzilla bug 76722
 */
 
 
 class nsParserContinueEvent : public nsRunnable
 {
 public:
   nsRefPtr<nsParser> mParser;
 
-  nsParserContinueEvent(nsParser* aParser)
+  explicit nsParserContinueEvent(nsParser* aParser)
     : mParser(aParser)
   {}
 
   NS_IMETHOD Run()
   {
     mParser->HandleParserContinueEvent(this);
     return NS_OK;
   }
--- a/parser/htmlparser/nsScanner.h
+++ b/parser/htmlparser/nsScanner.h
@@ -38,17 +38,17 @@ private:
 };
 
 class nsScanner {
   public:
 
       /**
        *  Use this constructor for the XML fragment parsing case
        */
-      nsScanner(const nsAString& anHTMLString);
+      explicit nsScanner(const nsAString& anHTMLString);
 
       /**
        *  Use this constructor if you want i/o to be based on 
        *  a file (therefore a stream) or just data you provide via Append().
        */
       nsScanner(nsString& aFilename, bool aCreateStream);
 
       ~nsScanner();
--- a/parser/htmlparser/nsScannerString.h
+++ b/parser/htmlparser/nsScannerString.h
@@ -105,31 +105,31 @@ class nsScannerBufferList
             Position() {}
             
             Position( Buffer* buffer, char16_t* position )
               : mBuffer(buffer)
               , mPosition(position)
               {}
             
             inline
-            Position( const nsScannerIterator& aIter );
+            explicit Position( const nsScannerIterator& aIter );
 
             inline
             Position& operator=( const nsScannerIterator& aIter );
 
             static size_t Distance( const Position& p1, const Position& p2 );
 
             Buffer*    mBuffer;
             char16_t* mPosition;
         };
 
       static Buffer* AllocBufferFromString( const nsAString& );
       static Buffer* AllocBuffer( uint32_t capacity ); // capacity = number of chars
 
-      nsScannerBufferList( Buffer* buf )
+      explicit nsScannerBufferList( Buffer* buf )
         : mRefCnt(0)
         {
           mBuffers.insertBack(buf);
         }
 
       void  AddRef()  { ++mRefCnt; }
       void  Release() { if (--mRefCnt == 0) delete this; }
 
@@ -179,17 +179,17 @@ struct nsScannerFragment
 class nsScannerSubstring
   {
     public:
       typedef nsScannerBufferList::Buffer      Buffer;
       typedef nsScannerBufferList::Position    Position;
       typedef uint32_t                         size_type;
 
       nsScannerSubstring();
-      nsScannerSubstring( const nsAString& s );
+      explicit nsScannerSubstring( const nsAString& s );
 
       ~nsScannerSubstring();
 
       nsScannerIterator& BeginReading( nsScannerIterator& iter ) const;
       nsScannerIterator& EndReading( nsScannerIterator& iter ) const;
 
       size_type Length() const { return mLength; }
 
@@ -250,17 +250,17 @@ class nsScannerSubstring
 
   /**
    * nsScannerString provides methods to grow and modify a buffer list.
    */
 class nsScannerString : public nsScannerSubstring
   {
     public:
 
-      nsScannerString( Buffer* );
+      explicit nsScannerString( Buffer* );
 
         // you are giving ownership to the string, it takes and keeps your
         // buffer, deleting it when done.
         // Use AllocBuffer or AllocBufferFromString to create a Buffer object
         // for use with this function.
       void AppendBuffer( Buffer* );
 
       void DiscardPrefix( const nsScannerIterator& );