Bug 1329467 - Revert bug 1151829 to unbreak non-SPS build after bug 1322553. r?mstange draft
authorJan Beich <jbeich@FreeBSD.org>
Mon, 09 Jan 2017 21:46:56 +0000
changeset 457786 5c01f85c4a3beda9aee1006be9a3ce35d833c7b8
parent 457785 8255f8b17af426d3332151d7e8b5237e8bc564a6
child 457787 73f445510dfe4e6fb58f0f9ee61a970bba837216
child 457788 79e9d56a9608129fbcba9d89c19a96b325a5d6fe
push id40892
push userbmo:jbeich@FreeBSD.org
push dateMon, 09 Jan 2017 22:19:37 +0000
reviewersmstange
bugs1329467, 1151829, 1322553
milestone53.0a1
Bug 1329467 - Revert bug 1151829 to unbreak non-SPS build after bug 1322553. r?mstange MozReview-Commit-ID: 14QL0Unr84G
layout/base/RestyleTracker.cpp
layout/base/RestyleTracker.h
tools/profiler/public/GeckoProfiler.h
tools/profiler/public/GeckoProfilerImpl.h
--- a/layout/base/RestyleTracker.cpp
+++ b/layout/base/RestyleTracker.cpp
@@ -56,19 +56,17 @@ inline nsIDocument*
 RestyleTracker::Document() const {
   return mRestyleManager->PresContext()->Document();
 }
 
 #define RESTYLE_ARRAY_STACKSIZE 128
 
 struct RestyleEnumerateData : RestyleTracker::Hints {
   RefPtr<dom::Element> mElement;
-#if defined(MOZ_ENABLE_PROFILER_SPS)
   UniqueProfilerBacktrace mBacktrace;
-#endif
 };
 
 inline void
 RestyleTracker::ProcessOneRestyle(Element* aElement,
                                   nsRestyleHint aRestyleHint,
                                   nsChangeHint aChangeHint,
                                   const RestyleHintData& aRestyleHintData)
 {
@@ -252,22 +250,20 @@ RestyleTracker::DoProcessRestyles()
         }
 
         if (isTimelineRecording) {
           timelines->AddMarkerForDocShell(docShell, Move(
             MakeUnique<RestyleTimelineMarker>(
               data->mRestyleHint, MarkerTracingType::START)));
         }
 
-#if defined(MOZ_ENABLE_PROFILER_SPS)
         Maybe<GeckoProfilerTracingRAII> profilerRAII;
         if (profiler_feature_active("restyle")) {
           profilerRAII.emplace("Paint", "Styles", Move(data->mBacktrace));
         }
-#endif
         ProcessOneRestyle(element, data->mRestyleHint, data->mChangeHint,
                           data->mRestyleHintData);
         AddRestyleRootsIfAwaitingRestyle(data->mDescendants);
 
         if (isTimelineRecording) {
           timelines->AddMarkerForDocShell(docShell, Move(
             MakeUnique<RestyleTimelineMarker>(
               data->mRestyleHint, MarkerTracingType::END)));
@@ -332,19 +328,17 @@ RestyleTracker::DoProcessRestyles()
                               ConditionalDescendantsBit());
 
           restyle->mElement = element;
           restyle->mRestyleHint = data->mRestyleHint;
           restyle->mChangeHint = data->mChangeHint;
           // We can move data since we'll be clearing mPendingRestyles after
           // we finish enumerating it.
           restyle->mRestyleHintData = Move(data->mRestyleHintData);
-#if defined(MOZ_ENABLE_PROFILER_SPS)
           restyle->mBacktrace = Move(data->mBacktrace);
-#endif
 
 #ifdef RESTYLE_LOGGING
           count++;
 #endif
 
           // Increment to the next slot in the array
           restyle++;
         }
@@ -360,22 +354,20 @@ RestyleTracker::DoProcessRestyles()
         for (RestyleEnumerateData* currentRestyle = restylesToProcess;
              currentRestyle != lastRestyle;
              ++currentRestyle) {
           LOG_RESTYLE("processing pending restyle %s at index %d/%d",
                       FrameTagToString(currentRestyle->mElement).get(),
                       index++, count);
           LOG_RESTYLE_INDENT();
 
-#if defined(MOZ_ENABLE_PROFILER_SPS)
           Maybe<GeckoProfilerTracingRAII> profilerRAII;
           if (profiler_feature_active("restyle")) {
             profilerRAII.emplace("Paint", "Styles", Move(currentRestyle->mBacktrace));
           }
-#endif
           if (isTimelineRecording) {
             timelines->AddMarkerForDocShell(docShell, Move(
               MakeUnique<RestyleTimelineMarker>(
                 currentRestyle->mRestyleHint, MarkerTracingType::START)));
           }
 
           ProcessOneRestyle(currentRestyle->mElement,
                             currentRestyle->mRestyleHint,
--- a/layout/base/RestyleTracker.h
+++ b/layout/base/RestyleTracker.h
@@ -17,20 +17,16 @@
 #include "nsClassHashtable.h"
 #include "nsContainerFrame.h"
 #include "nsIContentInlines.h"
 #include "mozilla/SplayTree.h"
 #include "mozilla/RestyleLogging.h"
 #include "GeckoProfiler.h"
 #include "mozilla/Maybe.h"
 
-#if defined(MOZ_ENABLE_PROFILER_SPS)
-#include "ProfilerBacktrace.h"
-#endif
-
 namespace mozilla {
 
 class RestyleManager;
 class ElementRestyler;
 
 class RestyleTracker {
 public:
   typedef mozilla::dom::Element Element;
@@ -123,19 +119,17 @@ public:
       }
     }
 
     // Descendant elements we must check that we ended up restyling, ordered
     // with the same invariant as mRestyleRoots.  The elements here are those
     // that we called AddPendingRestyle for and found the element this is
     // the RestyleData for as its nearest restyle root.
     nsTArray<RefPtr<Element>> mDescendants;
-#if defined(MOZ_ENABLE_PROFILER_SPS)
     UniqueProfilerBacktrace mBacktrace;
-#endif
   };
 
   /**
    * If the given Element has a restyle pending for it, return the
    * relevant restyle data.  This function will clear everything other
    * than a possible eRestyle_LaterSiblings hint for aElement out of
    * our hashtable.  The returned aData will never have an
    * eRestyle_LaterSiblings hint in it.
@@ -260,21 +254,19 @@ RestyleTracker::AddPendingRestyleToTable
                  "why are we getting eRestyle_SomeDescendants in an "
                  "animation-only restyle?");
     aElement->SetFlags(ConditionalDescendantsBit());
   }
 
   if (!existingData) {
     RestyleData* rd =
       new RestyleData(aRestyleHint, aMinChangeHint, aRestyleHintData);
-#if defined(MOZ_ENABLE_PROFILER_SPS)
     if (profiler_feature_active("restyle")) {
       rd->mBacktrace = profiler_get_backtrace();
     }
-#endif
     mPendingRestyles.Put(aElement, rd);
     return false;
   }
 
   bool hadRestyleLaterSiblings =
     (existingData->mRestyleHint & eRestyle_LaterSiblings) != 0;
   existingData->mRestyleHint =
     nsRestyleHint(existingData->mRestyleHint | aRestyleHint);
--- a/tools/profiler/public/GeckoProfiler.h
+++ b/tools/profiler/public/GeckoProfiler.h
@@ -49,16 +49,17 @@
 #ifndef SAMPLER_H
 #define SAMPLER_H
 
 #include "mozilla/Assertions.h"
 #include "mozilla/Attributes.h"
 #ifndef SPS_STANDALONE
 #include "js/TypeDecls.h"
 #endif
+#include "mozilla/GuardObjects.h"
 #include "mozilla/UniquePtr.h"
 #include "mozilla/Vector.h"
 #include "GeckoProfilerTypes.h"
 
 namespace mozilla {
 class TimeStamp;
 
 namespace dom {
@@ -303,9 +304,44 @@ public:
       MOZ_ASSERT(!profiler_is_sleeping());
       profiler_sleep_start();
     }
   }
 private:
   bool mIssuedWake;
 };
 
+namespace mozilla {
+
+class MOZ_RAII GeckoProfilerTracingRAII {
+public:
+  GeckoProfilerTracingRAII(const char* aCategory, const char* aInfo,
+                           UniqueProfilerBacktrace aBacktrace
+                           MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
+    : mCategory(aCategory)
+    , mInfo(aInfo)
+  {
+    MOZ_GUARD_OBJECT_NOTIFIER_INIT;
+    profiler_tracing(mCategory, mInfo, Move(aBacktrace), TRACING_INTERVAL_START);
+  }
+
+  GeckoProfilerTracingRAII(const char* aCategory, const char* aInfo
+                           MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
+    : mCategory(aCategory)
+    , mInfo(aInfo)
+  {
+    MOZ_GUARD_OBJECT_NOTIFIER_INIT;
+    profiler_tracing(mCategory, mInfo, TRACING_INTERVAL_START);
+  }
+
+  ~GeckoProfilerTracingRAII() {
+    profiler_tracing(mCategory, mInfo, TRACING_INTERVAL_END);
+  }
+
+protected:
+  MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
+  const char* mCategory;
+  const char* mInfo;
+};
+
+} // namespace mozilla
+
 #endif // ifndef SAMPLER_H
--- a/tools/profiler/public/GeckoProfilerImpl.h
+++ b/tools/profiler/public/GeckoProfilerImpl.h
@@ -377,47 +377,16 @@ static inline void profiler_tracing(cons
 #else
 #define PROFILE_DEFAULT_INTERVAL 1
 #endif
 #define PROFILE_DEFAULT_FEATURES NULL
 #define PROFILE_DEFAULT_FEATURE_COUNT 0
 
 namespace mozilla {
 
-class MOZ_RAII GeckoProfilerTracingRAII {
-public:
-  GeckoProfilerTracingRAII(const char* aCategory, const char* aInfo,
-                           UniqueProfilerBacktrace aBacktrace
-                           MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
-    : mCategory(aCategory)
-    , mInfo(aInfo)
-  {
-    MOZ_GUARD_OBJECT_NOTIFIER_INIT;
-    profiler_tracing(mCategory, mInfo, Move(aBacktrace), TRACING_INTERVAL_START);
-  }
-
-  GeckoProfilerTracingRAII(const char* aCategory, const char* aInfo
-                           MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
-    : mCategory(aCategory)
-    , mInfo(aInfo)
-  {
-    MOZ_GUARD_OBJECT_NOTIFIER_INIT;
-    profiler_tracing(mCategory, mInfo, TRACING_INTERVAL_START);
-  }
-
-  ~GeckoProfilerTracingRAII() {
-    profiler_tracing(mCategory, mInfo, TRACING_INTERVAL_END);
-  }
-
-protected:
-  MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
-  const char* mCategory;
-  const char* mInfo;
-};
-
 class MOZ_RAII SamplerStackFrameRAII {
 public:
   // we only copy the strings at save time, so to take multiple parameters we'd need to copy them then.
   SamplerStackFrameRAII(const char *aInfo,
     js::ProfileEntry::Category aCategory, uint32_t line
     MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
   {
     MOZ_GUARD_OBJECT_NOTIFIER_INIT;