Merge pull request #9623 from miniak/gpu-info

Add app.getGPUFeatureStatus
This commit is contained in:
Kevin Sawicki 2017-05-31 08:11:50 -07:00 committed by GitHub
commit 9250b559f9
5 changed files with 50 additions and 0 deletions

View file

@ -34,6 +34,7 @@
#include "chrome/browser/browser_process.h"
#include "chrome/browser/icon_manager.h"
#include "chrome/common/chrome_paths.h"
#include "content/browser/gpu/compositor_util.h"
#include "content/public/browser/browser_accessibility_state.h"
#include "content/public/browser/browser_child_process_host.h"
#include "content/public/browser/child_process_data.h"
@ -1021,6 +1022,12 @@ std::vector<mate::Dictionary> App::GetAppMetrics(v8::Isolate* isolate) {
return result;
}
v8::Local<v8::Value> App::GetGPUFeatureStatus(v8::Isolate* isolate) {
auto status = content::GetFeatureStatus();
return mate::ConvertToV8(isolate,
status ? *status : base::DictionaryValue());
}
// static
mate::Handle<App> App::Create(v8::Isolate* isolate) {
return mate::CreateHandle(isolate, new App(isolate));
@ -1094,6 +1101,7 @@ void App::BuildPrototype(
&App::DisableHardwareAcceleration)
.SetMethod("getFileIcon", &App::GetFileIcon)
.SetMethod("getAppMetrics", &App::GetAppMetrics)
.SetMethod("getGPUFeatureStatus", &App::GetGPUFeatureStatus)
// TODO(juturu): Remove in 2.0, deprecate before then with warnings
.SetMethod("getAppMemoryInfo", &App::GetAppMetrics);
}

View file

@ -177,6 +177,7 @@ class App : public AtomBrowserClient::Delegate,
mate::Arguments* args);
std::vector<mate::Dictionary> GetAppMetrics(v8::Isolate* isolate);
v8::Local<v8::Value> GetGPUFeatureStatus(v8::Isolate* isolate);
#if defined(OS_WIN)
// Get the current Jump List settings.

View file

@ -771,6 +771,10 @@ Returns [`ProcessMetric[]`](structures/process-metric.md): Array of `ProcessMet
Returns [`ProcessMetric[]`](structures/process-metric.md): Array of `ProcessMetric` objects that correspond to memory and cpu usage statistics of all the processes associated with the app.
### `app.getGpuFeatureStatus()`
Returns [`GPUFeatureStatus`](structures/gpu-feature-status.md) - The Graphics Feature Status from `chrome://gpu/`.
### `app.setBadgeCount(count)` _Linux_ _macOS_
* `count` Integer

View file

@ -0,0 +1,29 @@
# GPUFeatureStatus Object
* `2d_canvas` String - Canvas
* `flash_3d` String - Flash
* `flash_stage3d` String - Flash Stage3D
* `flash_stage3d_baseline` String - Flash Stage3D Baseline profile
* `gpu_compositing` String - Compositing
* `multiple_raster_threads` String - Multiple Raster Threads
* `native_gpu_memory_buffers` String - Native GpuMemoryBuffers
* `rasterization` String - Rasterization
* `video_decode` String - Video Decode
* `video_encode` String - Video Encode
* `vpx_decode` String - VPx Video Decode
* `webgl` String - WebGL
* `webgl2` String - WebGL2
Possible values:
* `disabled_software` - Software only. Hardware acceleration disabled (yellow)
* `disabled_off` - Disabled (red)
* `disabled_off_ok` - Disabled (yellow)
* `unavailable_software` - Software only, hardware acceleration unavailable (yellow)
* `unavailable_off` - Unavailable (red)
* `unavailable_off_ok` - Unavailable (yellow)
* `enabled_readback` - Hardware accelerated but at reduced performance (yellow)
* `enabled_force` - Hardware accelerated on all pages (green)
* `enabled` - Hardware accelerated (green)
* `enabled_on` - Enabled (green)
* `enabled_force_on` - Force enabled (green)

View file

@ -558,4 +558,12 @@ describe('app module', function () {
assert.ok(types.includes('Tab'))
})
})
describe('getGPUFeatureStatus() API', function () {
it('returns the graphic features statuses', function () {
const features = app.getGPUFeatureStatus()
assert.equal(typeof features.webgl, 'string')
assert.equal(typeof features.gpu_compositing, 'string')
})
})
})