New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add app.getGPUFeatureStatus #9623

Merged
merged 4 commits into from May 31, 2017

Conversation

Projects
None yet
2 participants
@miniak
Contributor

miniak commented May 30, 2017

This method returns the Graphics Feature Status from chrome://gpu/ as JSON.
It allows detecting the status of GPU acceleration without having to open a hidden BrowserWindow and parsing the data from HTML.

Example output:

{  
   "2d_canvas":"enabled",
   "flash_3d":"enabled",
   "flash_stage3d":"enabled",
   "flash_stage3d_baseline":"enabled",
   "gpu_compositing":"enabled",
   "multiple_raster_threads":"enabled_on",
   "native_gpu_memory_buffers":"enabled",
   "rasterization":"enabled",
   "video_decode":"enabled",
   "video_encode":"enabled",
   "vpx_decode":"enabled",
   "webgl":"enabled",
   "webgl2":"enabled"
}"

The list of possible values can be found in chrome://gpu/gpu_internals.js (statusMap).

@miniak

This comment has been minimized.

Contributor

miniak commented May 30, 2017

@kevinsawicki, should I name it getGPUFeatureStatus or getGpuFeatureStatus?

@kevinsawicki

This comment has been minimized.

Contributor

kevinsawicki commented May 30, 2017

should I name it getGPUFeatureStatus or getGpuFeatureStatus?

I'm thinking getGPUFeatureStatus, since we have getCPUUsage and getIOCounters APIs.

@miniak miniak changed the title from Add app.getGpuFeatureStatus to Add app.getGPUFeatureStatus May 30, 2017

@miniak

This comment has been minimized.

Contributor

miniak commented May 30, 2017

@kevinsawicki renamed & added docs.

mate::Dictionary App::GetGPUFeatureStatus(v8::Isolate* isolate) {
auto result = mate::Dictionary::CreateEmpty(isolate);
if (auto status = content::GetFeatureStatus()) {

This comment has been minimized.

@kevinsawicki

kevinsawicki May 30, 2017

Contributor

There should already be a converter setup for base::DictionaryValue.

Would this work here?

return mate::ConvertToV8(isolate, status);

Then you wouldn't need the ConvertDictionary helper.

This comment has been minimized.

@miniak

miniak May 30, 2017

Contributor

I'll try that

This comment has been minimized.

@miniak

miniak May 30, 2017

Contributor

It does not work. There does not seem to be a converter from base::DictionaryValue. In generic case the values can have different types. In this case it can only be a string.

This comment has been minimized.

@kevinsawicki

kevinsawicki May 30, 2017

Contributor

@miniak I pushed up a spec and commit that uses the converter, please let me know if you are okay with that approach.

@@ -1095,7 +1126,8 @@ void App::BuildPrototype(
.SetMethod("getFileIcon", &App::GetFileIcon)
.SetMethod("getAppMetrics", &App::GetAppMetrics)
// TODO(juturu): Remove in 2.0, deprecate before then with warnings
.SetMethod("getAppMemoryInfo", &App::GetAppMetrics);
.SetMethod("getAppMemoryInfo", &App::GetAppMetrics)
.SetMethod("getGPUFeatureStatus", &App::GetGPUFeatureStatus);

This comment has been minimized.

@kevinsawicki

kevinsawicki May 30, 2017

Contributor

Mind moving this above the // TODO comment so we don't think it is marked for deprecation like getAppMemoryInfo is?

This comment has been minimized.

@miniak

miniak May 30, 2017

Contributor

done

Milan Burda and others added some commits May 30, 2017

@@ -558,4 +558,14 @@ describe('app module', function () {
assert.ok(types.includes('Tab'))
})
})
describe('getGPUFeatureStatus() API', function () {
if (process.platform !== 'darwin') return

This comment has been minimized.

@miniak

miniak May 31, 2017

Contributor

@kevinsawicki Do we need to check for Mac? It should work on all platforms.

This comment has been minimized.

@kevinsawicki

kevinsawicki May 31, 2017

Contributor

Okay, wasn't sure, will remove this line 👍

@kevinsawicki kevinsawicki merged commit 9250b55 into electron:master May 31, 2017

0 of 2 checks passed

continuous-integration/appveyor/pr Waiting for AppVeyor build to complete
Details
continuous-integration/travis-ci/pr The Travis CI build is in progress
Details
@kevinsawicki

This comment has been minimized.

Contributor

kevinsawicki commented May 31, 2017

Thanks for this @miniak 👍

@miniak

This comment has been minimized.

Contributor

miniak commented May 31, 2017

@kevinsawicki thanks for merging

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment