Bug 1256626: P2. Use NotifyBenchmarkResult to save VP9 result. r=jimm a=ritu
authorJean-Yves Avenard <jyavenard@mozilla.com>
Thu, 17 Mar 2016 17:20:21 +1100
changeset 323728 f95d91b89e35f199a0fcbff86a8c5cf7ef12f0f3
parent 323727 8e42398732237458819e21a5f254da43eb829a47
child 323729 d549d9ad9c14611fb7c33acb691194e873d7b805
push id5913
push userjlund@mozilla.com
push dateMon, 25 Apr 2016 16:57:49 +0000
treeherdermozilla-beta@dcaf0a6fa115 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjimm, ritu
bugs1256626
milestone47.0a2
Bug 1256626: P2. Use NotifyBenchmarkResult to save VP9 result. r=jimm a=ritu MozReview-Commit-ID: privnKY1zB
dom/media/Benchmark.cpp
--- a/dom/media/Benchmark.cpp
+++ b/dom/media/Benchmark.cpp
@@ -7,16 +7,17 @@
 #include "Benchmark.h"
 #include "BufferMediaResource.h"
 #include "MediaData.h"
 #include "PDMFactory.h"
 #include "WebMDemuxer.h"
 #include "WebMSample.h"
 #include "mozilla/Preferences.h"
 #include "mozilla/Telemetry.h"
+#include "mozilla/dom/ContentChild.h"
 
 namespace mozilla {
 
 const char* VP9Benchmark::sBenchmarkFpsPref = "media.benchmark.vp9.fps";
 bool VP9Benchmark::sHasRunTest = false;
 
 bool
 VP9Benchmark::IsVP9DecodeFast()
@@ -40,17 +41,25 @@ VP9Benchmark::IsVP9DecodeFast()
                       1, // start benchmarking after decoding this frame.
                       8, // loop after decoding that many frames.
                       TimeDuration::FromMilliseconds(
                         Preferences::GetUint("media.benchmark.timeout", 1000))
                     });
     estimiser->Run()->Then(
       AbstractThread::MainThread(), __func__,
       [](uint32_t aDecodeFps) {
-        Preferences::SetUint(sBenchmarkFpsPref, aDecodeFps);
+        if (XRE_IsContentProcess()) {
+          dom::ContentChild* contentChild = dom::ContentChild::GetSingleton();
+          if (contentChild) {
+            contentChild->SendNotifyBenchmarkResult(NS_LITERAL_STRING("VP9"),
+                                                    aDecodeFps);
+          }
+        } else {
+          Preferences::SetUint(sBenchmarkFpsPref, aDecodeFps);
+        }
         Telemetry::Accumulate(Telemetry::ID::VIDEO_VP9_BENCHMARK_FPS, aDecodeFps);
       },
       []() { });
   }
 
   if (!hasPref) {
     return false;
   }