Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(642)

Side by Side Diff: content/browser/gpu/gpu_performance_stats_win.cc

Issue 9959085: Make it possible to blacklist gpu's based on the Windows experience index. (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1025/src/
Patch Set: Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « content/browser/gpu/gpu_performance_stats.cc ('k') | content/common/gpu/gpu_messages.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "content/browser/gpu/gpu_performance_stats.h"
6
7 #include <winsatcominterfacei.h>
8
9 static float GetComponentScore(IProvideWinSATAssessmentInfo* subcomponent) {
10 float score;
11 HRESULT hr = subcomponent->get_Score(&score);
12 if (FAILED(hr))
13 return 0.0;
14 return score;
15 }
16
17 GpuPerformanceStats GpuPerformanceStats::RetrieveGpuPerformanceStats() {
18 HRESULT hr = S_OK;
19 IQueryRecentWinSATAssessment* assessment = NULL;
20 IProvideWinSATResultsInfo* results = NULL;
21 IProvideWinSATAssessmentInfo* subcomponent = NULL;
22 GpuPerformanceStats stats;
23
24 hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
25 if (FAILED(hr))
26 goto cleanup;
27
28 hr = CoCreateInstance(__uuidof(CQueryWinSAT),
29 NULL,
30 CLSCTX_INPROC_SERVER,
31 __uuidof(IQueryRecentWinSATAssessment),
32 reinterpret_cast<void**>(&assessment));
33 if (FAILED(hr))
34 goto cleanup;
35
36 hr = assessment->get_Info(&results);
37 if (FAILED(hr))
38 goto cleanup;
39
40 hr = results->get_SystemRating(&stats.overall);
41 if (FAILED(hr))
42 goto cleanup;
43
44 hr = results->GetAssessmentInfo(WINSAT_ASSESSMENT_D3D, &subcomponent);
45 if (FAILED(hr))
46 goto cleanup;
47 stats.gaming = GetComponentScore(subcomponent);
48 subcomponent->Release();
49 subcomponent = NULL;
50
51 hr = results->GetAssessmentInfo(WINSAT_ASSESSMENT_GRAPHICS, &subcomponent);
52 if (FAILED(hr))
53 goto cleanup;
54 stats.graphics = GetComponentScore(subcomponent);
55 subcomponent->Release();
56 subcomponent = NULL;
57
58 cleanup:
59 if (assessment)
60 assessment->Release();
61 if (results)
62 results->Release();
63 if (subcomponent)
64 subcomponent->Release();
65 CoUninitialize();
66
67 return stats;
68 }
OLDNEW
« no previous file with comments | « content/browser/gpu/gpu_performance_stats.cc ('k') | content/common/gpu/gpu_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698