Add a usingGPUProcess property to nsIGfxInfo. (bug 1317441 part 1, r=mattwoodrow)
authorDavid Anderson <danderson@mozilla.com>
Mon, 14 Nov 2016 15:02:02 -0800
changeset 369779 cbd1bb57ffd00d0085db591d94e522acb3503dc5
parent 369778 313d7a1c1bbc34caba2687230f2c90848bccfc9d
child 369780 ef98320218dcaacf693b9b96d6f347c1432352c5
push id1419
push userjlund@mozilla.com
push dateMon, 10 Apr 2017 20:44:07 +0000
treeherdermozilla-release@5e6801b73ef6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmattwoodrow
bugs1317441
milestone52.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
Add a usingGPUProcess property to nsIGfxInfo. (bug 1317441 part 1, r=mattwoodrow)
widget/GfxInfoBase.cpp
widget/GfxInfoBase.h
widget/nsIGfxInfo.idl
--- a/widget/GfxInfoBase.cpp
+++ b/widget/GfxInfoBase.cpp
@@ -25,16 +25,17 @@
 #include "nsIDOMNode.h"
 #include "nsIDOMNodeList.h"
 #include "nsTArray.h"
 #include "nsXULAppAPI.h"
 #include "nsIXULAppInfo.h"
 #include "mozilla/Preferences.h"
 #include "mozilla/dom/ContentChild.h"
 #include "mozilla/gfx/2D.h"
+#include "mozilla/gfx/GPUProcessManager.h"
 #include "mozilla/gfx/Logging.h"
 #include "MediaPrefs.h"
 #include "gfxPrefs.h"
 #include "gfxPlatform.h"
 #include "gfxConfig.h"
 #include "DriverCrashGuard.h"
 
 #if defined(MOZ_CRASHREPORTER)
@@ -1422,16 +1423,29 @@ GfxInfoBase::GetContentBackend(nsAString
   default:
     return NS_ERROR_FAILURE;
   }
 
   aContentBackend.Assign(outStr);
   return NS_OK;
 }
 
+NS_IMETHODIMP
+GfxInfoBase::GetUsingGPUProcess(bool *aOutValue)
+{
+  GPUProcessManager* gpu = GPUProcessManager::Get();
+  if (!gpu) {
+    // Not supported in content processes.
+    return NS_ERROR_FAILURE;
+  }
+
+  *aOutValue = !!gpu->GetGPUChild();
+  return NS_OK;
+}
+
 GfxInfoCollectorBase::GfxInfoCollectorBase()
 {
   GfxInfoBase::AddCollector(this);
 }
 
 GfxInfoCollectorBase::~GfxInfoCollectorBase()
 {
   GfxInfoBase::RemoveCollector(this);
--- a/widget/GfxInfoBase.h
+++ b/widget/GfxInfoBase.h
@@ -54,16 +54,17 @@ public:
   NS_IMETHOD GetMonitors(JSContext* cx, JS::MutableHandleValue _retval) override;
   NS_IMETHOD GetFailures(uint32_t *failureCount, int32_t** indices, char ***failures) override;
   NS_IMETHOD_(void) LogFailure(const nsACString &failure) override;
   NS_IMETHOD GetInfo(JSContext*, JS::MutableHandle<JS::Value>) override;
   NS_IMETHOD GetFeatures(JSContext*, JS::MutableHandle<JS::Value>) override;
   NS_IMETHOD GetFeatureLog(JSContext*, JS::MutableHandle<JS::Value>) override;
   NS_IMETHOD GetActiveCrashGuards(JSContext*, JS::MutableHandle<JS::Value>) override;
   NS_IMETHOD GetContentBackend(nsAString & aContentBackend) override;
+  NS_IMETHOD GetUsingGPUProcess(bool *aOutValue) override;
 
   // Initialization function. If you override this, you must call this class's
   // version of Init first.
   // We need Init to be called separately from the constructor so we can
   // register as an observer after all derived classes have been constructed
   // and we know we have a non-zero refcount.
   // Ideally, Init() would be void-return, but the rules of
   // NS_GENERIC_FACTORY_CONSTRUCTOR_INIT require it be nsresult return.
--- a/widget/nsIGfxInfo.idl
+++ b/widget/nsIGfxInfo.idl
@@ -10,16 +10,17 @@
 [scriptable, uuid(1accd618-4c80-4703-9d29-ecf257d397c8)]
 interface nsIGfxInfo : nsISupports
 {
   /*
    * These are win32-specific
    */
   readonly attribute boolean D2DEnabled;
   readonly attribute boolean DWriteEnabled;
+  readonly attribute boolean usingGPUProcess;
   readonly attribute DOMString DWriteVersion;
   readonly attribute DOMString cleartypeParameters;
 
   /*
    * These are valid across all platforms.
    */
   readonly attribute DOMString ContentBackend;