Bug 1446568: Move UseCounter stuff and IsSynthesized to nsIDocument. r=smaug
authorEmilio Cobos Álvarez <emilio@crisal.io>
Thu, 15 Mar 2018 19:37:02 +0100
changeset 408684 5d7210ef8a29d0b8eda759c654e6017eabd5c3f7
parent 408683 9f3e5bc6ac993b3d4965c188798744d5e9f80de5
child 408685 3508bdff5806776fa0d8fec916607a479f88c568
push id101003
push userecoal95@gmail.com
push dateSat, 17 Mar 2018 15:23:01 +0000
treeherdermozilla-inbound@e4470b1b5108 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs1446568
milestone61.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 1446568: Move UseCounter stuff and IsSynthesized to nsIDocument. r=smaug MozReview-Commit-ID: IeKzmi31e8d
dom/base/nsDocument.cpp
dom/base/nsDocument.h
dom/base/nsIDocument.h
--- a/dom/base/nsDocument.cpp
+++ b/dom/base/nsDocument.cpp
@@ -2682,17 +2682,17 @@ WarnIfSandboxIneffective(nsIDocShell* aD
                                     parentDocument,
                                     nsContentUtils::eSECURITY_PROPERTIES,
                                     "BothAllowScriptsAndSameOriginPresent",
                                     nullptr, 0, iframeUri);
   }
 }
 
 bool
-nsDocument::IsSynthesized() {
+nsIDocument::IsSynthesized() {
   nsCOMPtr<nsIHttpChannelInternal> internalChan = do_QueryInterface(mChannel);
   bool synthesized = false;
   if (internalChan) {
     DebugOnly<nsresult> rv = internalChan->GetResponseSynthesized(&synthesized);
     MOZ_ASSERT(NS_SUCCEEDED(rv), "GetResponseSynthesized shouldn't fail.");
   }
   return synthesized;
 }
@@ -12245,17 +12245,17 @@ ReportExternalResourceUseCounters(nsIDoc
 {
   const auto reportKind
     = nsDocument::UseCounterReportKind::eIncludeExternalResources;
   static_cast<nsDocument*>(aDocument)->ReportUseCounters(reportKind);
   return true;
 }
 
 void
-nsDocument::ReportUseCounters(UseCounterReportKind aKind)
+nsIDocument::ReportUseCounters(UseCounterReportKind aKind)
 {
   static const bool sDebugUseCounters = false;
   if (mReportedUseCounters) {
     return;
   }
 
   mReportedUseCounters = true;
 
--- a/dom/base/nsDocument.h
+++ b/dom/base/nsDocument.h
@@ -201,32 +201,16 @@ public:
                                        bool aRequiredAdded) override;
   virtual bool GetValueMissingState(const nsAString& aName) const override;
   virtual void SetValueMissingState(const nsAString& aName, bool aValue) override;
 
   // for radio group
   nsRadioGroupStruct* GetRadioGroup(const nsAString& aName) const;
   nsRadioGroupStruct* GetOrCreateRadioGroup(const nsAString& aName);
 
-  enum class UseCounterReportKind {
-    // Flush the document's use counters only; the use counters for any
-    // external resource documents will be flushed when the external
-    // resource documents themselves are destroyed.
-    eDefault,
-
-    // Flush use counters for the document and for its external resource
-    // documents. (Should only be necessary for tests, where we need
-    // flushing to happen synchronously and deterministically.)
-    eIncludeExternalResources,
-  };
-
-  void ReportUseCounters(UseCounterReportKind aKind = UseCounterReportKind::eDefault);
-
-  bool IsSynthesized();
-
   // Check whether shadow DOM is enabled for the global of aObject.
   static bool IsShadowDOMEnabled(JSContext* aCx, JSObject* aObject);
   // Check whether shadow DOM is enabled for the document this node belongs to.
   static bool IsShadowDOMEnabled(const nsINode* aNode);
 
 public:
   // nsIDOMDocument
   NS_DECL_NSIDOMDOCUMENT
--- a/dom/base/nsIDocument.h
+++ b/dom/base/nsIDocument.h
@@ -3483,16 +3483,32 @@ public:
   void MarkUserFontSetDirty();
   mozilla::dom::FontFaceSet* GetFonts() { return mFontFaceSet; }
 
   // FontFaceSource
   mozilla::dom::FontFaceSet* Fonts();
 
   bool DidFireDOMContentLoaded() const { return mDidFireDOMContentLoaded; }
 
+  bool IsSynthesized();
+
+  enum class UseCounterReportKind {
+    // Flush the document's use counters only; the use counters for any
+    // external resource documents will be flushed when the external
+    // resource documents themselves are destroyed.
+    eDefault,
+
+    // Flush use counters for the document and for its external resource
+    // documents. (Should only be necessary for tests, where we need
+    // flushing to happen synchronously and deterministically.)
+    eIncludeExternalResources,
+  };
+
+  void ReportUseCounters(UseCounterReportKind aKind = UseCounterReportKind::eDefault);
+
   void SetDocumentUseCounter(mozilla::UseCounter aUseCounter)
   {
     if (!mUseCounters[aUseCounter]) {
       mUseCounters[aUseCounter] = true;
     }
   }
 
   void SetPageUseCounter(mozilla::UseCounter aUseCounter);