Bug 1256626: P1. Add NotifyBenchmarkResult ipc methods. r?jimm
This will be used to save video benchmark results. For now only VP9 is handled.
MozReview-Commit-ID: 4aIWQKoGWVQ
--- a/dom/ipc/ContentParent.cpp
+++ b/dom/ipc/ContentParent.cpp
@@ -264,16 +264,19 @@ using namespace mozilla::system;
#endif
#ifdef XP_WIN
#include "mozilla/widget/AudioSession.h"
#endif
#include "VRManagerParent.h" // for VRManagerParent
+// For VP9Benchmark::sBenchmarkFpsPref
+#include "Benchmark.h"
+
static NS_DEFINE_CID(kCClipboardCID, NS_CLIPBOARD_CID);
#if defined(XP_WIN)
// e10s forced enable pref, defined in nsAppRunner.cpp
extern const char* kForceEnableE10sPref;
#endif
using base::ChildPrivileges;
@@ -5706,16 +5709,27 @@ ContentParent::RecvGetAndroidSystemInfo(
nsSystemInfo::GetAndroidSystemInfo(aInfo);
return true;
#else
MOZ_CRASH("wrong platform!");
return false;
#endif
}
+bool
+ContentParent::RecvNotifyBenchmarkResult(const nsString& aCodecName,
+ const uint32_t& aDecodeFPS)
+
+{
+ if (aCodecName.EqualsLiteral("VP9")) {
+ Preferences::SetUint(VP9Benchmark::sBenchmarkFpsPref, aDecodeFPS);
+ }
+ return true;
+}
+
void
ContentParent::StartProfiler(nsIProfilerStartParams* aParams)
{
#ifdef MOZ_ENABLE_PROFILER_SPS
if (NS_WARN_IF(!aParams)) {
return;
}
--- a/dom/ipc/ContentParent.h
+++ b/dom/ipc/ContentParent.h
@@ -1087,16 +1087,19 @@ private:
virtual bool RecvGetDeviceStorageLocation(const nsString& aType,
nsString* aPath) override;
virtual bool RecvGetDeviceStorageLocations(DeviceStorageLocationInfo* info) override;
virtual bool RecvGetAndroidSystemInfo(AndroidSystemInfo* aInfo) override;
+ virtual bool RecvNotifyBenchmarkResult(const nsString& aCodecName,
+ const uint32_t& aDecodeFPS) override;
+
// If you add strong pointers to cycle collected objects here, be sure to
// release these objects in ShutDownProcess. See the comment there for more
// details.
GeckoChildProcessHost* mSubprocess;
ContentParent* mOpener;
ContentParentId mChildID;
--- a/dom/ipc/PContent.ipdl
+++ b/dom/ipc/PContent.ipdl
@@ -1192,15 +1192,22 @@ parent:
* Tells the parent to ungrab the pointer on the default display.
*
* This is for GTK platforms where we have to ensure the pointer ungrab happens in the
* chrome process as that's the process that receives the pointer event.
*/
sync UngrabPointer(uint32_t time);
sync RemovePermission(Principal principal, nsCString permissionType) returns (nsresult rv);
+
+ /**
+ * Tell the parent that a decoder's' benchmark has been completed.
+ * The result can then be stored in permanent storage.
+ */
+ async NotifyBenchmarkResult(nsString aCodecName, uint32_t aDecodeFPS);
+
both:
async AsyncMessage(nsString aMessage, ClonedMessageData aData,
CpowEntry[] aCpows, Principal aPrincipal);
};
}
}