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

Side by Side Diff: chrome/browser/gpu/gpu_feature_checker.cc

Issue 15745014: Move GPU device/driver info related code from content to gpu. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: rebase Created 7 years, 7 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 | « chrome/browser/gpu/gpu_feature_checker.h ('k') | chrome/browser/metrics/metrics_log.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/gpu/gpu_feature_checker.h" 5 #include "chrome/browser/gpu/gpu_feature_checker.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "content/public/browser/browser_thread.h" 8 #include "content/public/browser/browser_thread.h"
9 #include "content/public/browser/gpu_data_manager.h" 9 #include "content/public/browser/gpu_data_manager.h"
10 10
11 namespace { 11 namespace {
12 12
13 // A false return value is always valid, but a true one is only valid if full 13 // A false return value is always valid, but a true one is only valid if full
14 // GPU info has been collected in a GPU process. 14 // GPU info has been collected in a GPU process.
15 bool IsFeatureAllowed(content::GpuDataManager* manager, 15 bool IsFeatureAllowed(content::GpuDataManager* manager,
16 content::GpuFeatureType feature) { 16 gpu::GpuFeatureType feature) {
17 return (manager->GpuAccessAllowed(NULL) && 17 return (manager->GpuAccessAllowed(NULL) &&
18 !manager->IsFeatureBlacklisted(feature)); 18 !manager->IsFeatureBlacklisted(feature));
19 } 19 }
20 20
21 } // namespace 21 } // namespace
22 22
23 GPUFeatureChecker::GPUFeatureChecker(content::GpuFeatureType feature, 23 GPUFeatureChecker::GPUFeatureChecker(gpu::GpuFeatureType feature,
24 FeatureAvailableCallback callback) 24 FeatureAvailableCallback callback)
25 : feature_(feature), 25 : feature_(feature),
26 callback_(callback) { 26 callback_(callback) {
27 } 27 }
28 28
29 GPUFeatureChecker::~GPUFeatureChecker() { 29 GPUFeatureChecker::~GPUFeatureChecker() {
30 } 30 }
31 31
32 void GPUFeatureChecker::CheckGPUFeatureAvailability() { 32 void GPUFeatureChecker::CheckGPUFeatureAvailability() {
33 CHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); 33 CHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
(...skipping 27 matching lines...) Expand all
61 61
62 void GPUFeatureChecker::OnGpuInfoUpdate() { 62 void GPUFeatureChecker::OnGpuInfoUpdate() {
63 content::GpuDataManager* manager = content::GpuDataManager::GetInstance(); 63 content::GpuDataManager* manager = content::GpuDataManager::GetInstance();
64 manager->RemoveObserver(this); 64 manager->RemoveObserver(this);
65 bool feature_allowed = IsFeatureAllowed(manager, feature_); 65 bool feature_allowed = IsFeatureAllowed(manager, feature_);
66 callback_.Run(feature_allowed); 66 callback_.Run(feature_allowed);
67 67
68 // Matches the AddRef in HasFeature(). 68 // Matches the AddRef in HasFeature().
69 Release(); 69 Release();
70 } 70 }
OLDNEW
« no previous file with comments | « chrome/browser/gpu/gpu_feature_checker.h ('k') | chrome/browser/metrics/metrics_log.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698