Bug 1315850 - Rename DetailedPromise Status enum. r=gerald
authorChris Pearce <cpearce@mozilla.com>
Mon, 13 Mar 2017 10:42:36 +1300
changeset 349371 98c87d2f85b3d0c5ef906bf4791bb90d5c445fb7
parent 349370 2a6e91518a674f5e25d83403c49966631562afc9
child 349372 596260b13532101c1415d5d9a292602e7dcb084b
push id88407
push usercpearce@mozilla.com
push dateFri, 24 Mar 2017 03:07:56 +0000
treeherdermozilla-inbound@b5c478da01df [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgerald
bugs1315850
milestone55.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 1315850 - Rename DetailedPromise Status enum. r=gerald X11.h #defines 'Status' and 'Failed' and 'Succeeded' which conflicts with the enum in DetailedPromise. So rename the 'Status' enum in DetailedPromise so that the build works on Linux. Some of my changes here caused DetailedPromise to be included in more places that it was before, which caused build failures on Linux. MozReview-Commit-ID: KV5xKixXR3J
dom/media/eme/DetailedPromise.cpp
dom/media/eme/DetailedPromise.h
--- a/dom/media/eme/DetailedPromise.cpp
+++ b/dom/media/eme/DetailedPromise.cpp
@@ -31,27 +31,27 @@ DetailedPromise::DetailedPromise(nsIGlob
 }
 
 DetailedPromise::~DetailedPromise()
 {
   // It would be nice to assert that mResponded is identical to
   // GetPromiseState() == PromiseState::Rejected.  But by now we've been
   // unlinked, so don't have a reference to our actual JS Promise object
   // anymore.
-  MaybeReportTelemetry(Failed);
+  MaybeReportTelemetry(kFailed);
 }
 
 void
 DetailedPromise::MaybeReject(nsresult aArg, const nsACString& aReason)
 {
   nsPrintfCString msg("%s promise rejected 0x%" PRIx32 " '%s'", mName.get(),
                       static_cast<uint32_t>(aArg), PromiseFlatCString(aReason).get());
   EME_LOG("%s", msg.get());
 
-  MaybeReportTelemetry(Failed);
+  MaybeReportTelemetry(kFailed);
 
   LogToBrowserConsole(NS_ConvertUTF8toUTF16(msg));
 
   ErrorResult rv;
   rv.ThrowDOMException(aArg, aReason);
   Promise::MaybeReject(rv);
 }
 
@@ -79,27 +79,27 @@ DetailedPromise::Create(nsIGlobalObject*
                         Telemetry::HistogramID aFailureLatencyProbe)
 {
   RefPtr<DetailedPromise> promise = new DetailedPromise(aGlobal, aName, aSuccessLatencyProbe, aFailureLatencyProbe);
   promise->CreateWrapper(nullptr, aRv);
   return aRv.Failed() ? nullptr : promise.forget();
 }
 
 void
-DetailedPromise::MaybeReportTelemetry(Status aStatus)
+DetailedPromise::MaybeReportTelemetry(eStatus aStatus)
 {
   if (mResponded) {
     return;
   }
   mResponded = true;
   if (!mSuccessLatencyProbe.WasPassed() || !mFailureLatencyProbe.WasPassed()) {
     return;
   }
   uint32_t latency = (TimeStamp::Now() - mStartTime).ToMilliseconds();
   EME_LOG("%s %s latency %ums reported via telemetry", mName.get(),
-          ((aStatus == Succeeded) ? "succcess" : "failure"), latency);
-  Telemetry::HistogramID tid = (aStatus == Succeeded) ? mSuccessLatencyProbe.Value()
+          ((aStatus == kSucceeded) ? "succcess" : "failure"), latency);
+  Telemetry::HistogramID tid = (aStatus == kSucceeded) ? mSuccessLatencyProbe.Value()
                                                       : mFailureLatencyProbe.Value();
   Telemetry::Accumulate(tid, latency);
 }
 
 } // namespace dom
 } // namespace mozilla
--- a/dom/media/eme/DetailedPromise.h
+++ b/dom/media/eme/DetailedPromise.h
@@ -32,17 +32,17 @@ public:
          const nsACString& aName,
          Telemetry::HistogramID aSuccessLatencyProbe,
          Telemetry::HistogramID aFailureLatencyProbe);
 
   template <typename T>
   void MaybeResolve(const T& aArg)
   {
     EME_LOG("%s promise resolved", mName.get());
-    MaybeReportTelemetry(Succeeded);
+    MaybeReportTelemetry(eStatus::kSucceeded);
     Promise::MaybeResolve<T>(aArg);
   }
 
   void MaybeReject(nsresult aArg) = delete;
   void MaybeReject(nsresult aArg, const nsACString& aReason);
 
   void MaybeReject(ErrorResult& aArg) = delete;
   void MaybeReject(ErrorResult&, const nsACString& aReason);
@@ -52,18 +52,18 @@ private:
                            const nsACString& aName);
 
   explicit DetailedPromise(nsIGlobalObject* aGlobal,
                            const nsACString& aName,
                            Telemetry::HistogramID aSuccessLatencyProbe,
                            Telemetry::HistogramID aFailureLatencyProbe);
   virtual ~DetailedPromise();
 
-  enum Status { Succeeded, Failed };
-  void MaybeReportTelemetry(Status aStatus);
+  enum eStatus { kSucceeded, kFailed };
+  void MaybeReportTelemetry(eStatus aStatus);
 
   nsCString mName;
   bool mResponded;
   TimeStamp mStartTime;
   Optional<Telemetry::HistogramID> mSuccessLatencyProbe;
   Optional<Telemetry::HistogramID> mFailureLatencyProbe;
 };