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

Unified Diff: chrome/browser/gpu/gpu_feature_checker.cc

Issue 2666243002: Move GPUFeatureChecker to content layer (Closed)
Patch Set: rebase Created 3 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/gpu/gpu_feature_checker.h ('k') | content/browser/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/gpu/gpu_feature_checker.cc
diff --git a/chrome/browser/gpu/gpu_feature_checker.cc b/chrome/browser/gpu/gpu_feature_checker.cc
deleted file mode 100644
index 3147d4e99a569fe418762ae1b0b2ebe77f69e268..0000000000000000000000000000000000000000
--- a/chrome/browser/gpu/gpu_feature_checker.cc
+++ /dev/null
@@ -1,71 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/browser/gpu/gpu_feature_checker.h"
-
-#include "base/logging.h"
-#include "build/build_config.h"
-#include "content/public/browser/browser_thread.h"
-#include "content/public/browser/gpu_data_manager.h"
-
-namespace {
-
-// A false return value is always valid, but a true one is only valid if full
-// GPU info has been collected in a GPU process.
-bool IsFeatureAllowed(content::GpuDataManager* manager,
- gpu::GpuFeatureType feature) {
- return (manager->GpuAccessAllowed(NULL) &&
- !manager->IsFeatureBlacklisted(feature));
-}
-
-} // namespace
-
-GPUFeatureChecker::GPUFeatureChecker(gpu::GpuFeatureType feature,
- FeatureAvailableCallback callback)
- : feature_(feature),
- callback_(callback) {
-}
-
-GPUFeatureChecker::~GPUFeatureChecker() {
-}
-
-void GPUFeatureChecker::CheckGPUFeatureAvailability() {
- CHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
-
- bool finalized = true;
-#if defined(OS_LINUX)
- // On Windows and Mac, so far we can always make the final WebGL blacklisting
- // decision based on partial GPU info; on Linux, we need to launch the GPU
- // process to collect full GPU info and make the final decision.
- finalized = false;
-#endif
-
- content::GpuDataManager* manager = content::GpuDataManager::GetInstance();
- if (manager->IsEssentialGpuInfoAvailable())
- finalized = true;
-
- bool feature_allowed = IsFeatureAllowed(manager, feature_);
- if (!feature_allowed)
- finalized = true;
-
- if (finalized) {
- callback_.Run(feature_allowed);
- } else {
- // Matched with a Release in OnGpuInfoUpdate.
- AddRef();
-
- manager->AddObserver(this);
- manager->RequestCompleteGpuInfoIfNeeded();
- }
-}
-
-void GPUFeatureChecker::OnGpuInfoUpdate() {
- content::GpuDataManager* manager = content::GpuDataManager::GetInstance();
- manager->RemoveObserver(this);
- bool feature_allowed = IsFeatureAllowed(manager, feature_);
- callback_.Run(feature_allowed);
-
- // Matches the AddRef in HasFeature().
- Release();
-}
« no previous file with comments | « chrome/browser/gpu/gpu_feature_checker.h ('k') | content/browser/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698