Index: chrome/common/gpu_feature_flags.cc |
=================================================================== |
--- chrome/common/gpu_feature_flags.cc (revision 0) |
+++ chrome/common/gpu_feature_flags.cc (revision 0) |
@@ -0,0 +1,64 @@ |
+// Copyright (c) 2010 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/common/gpu_feature_flags.h" |
+ |
+const char GpuFeatureFlags::kGpuFeatureNameAccelerated2dCanvas[] = |
+ "accelerated_2d_canvas"; |
+const char GpuFeatureFlags::kGpuFeatureNameAcceleratedCompositing[] = |
+ "accelerated_compositing"; |
+const char GpuFeatureFlags::kGpuFeatureNameWebgl[] = "webgl"; |
+const char GpuFeatureFlags::kGpuFeatureNameAny[] = "any"; |
+ |
+GpuFeatureFlags::GpuFeatureFlags() |
+ : is_accelerated_2d_canvas_blacklisted_(false), |
+ is_accelerated_compositing_blacklisted_(false), |
+ is_webgl_blacklisted_(false) { |
+} |
+ |
+void GpuFeatureFlags::SetFlags(bool is_accelerated_2d_canvas_blacklisted, |
+ bool is_accelerated_compositing_blacklisted, |
+ bool is_webgl_blacklisted) { |
+ is_accelerated_2d_canvas_blacklisted_ = is_accelerated_2d_canvas_blacklisted; |
+ is_accelerated_compositing_blacklisted_ = |
+ is_accelerated_compositing_blacklisted; |
+ is_webgl_blacklisted_ = is_webgl_blacklisted; |
+} |
+ |
+bool GpuFeatureFlags::is_accelerated_2d_canvas_blacklisted() const { |
+ return is_accelerated_2d_canvas_blacklisted_; |
+} |
+ |
+bool GpuFeatureFlags::is_accelerated_compositing_blacklisted() const { |
+ return is_accelerated_compositing_blacklisted_; |
+} |
+ |
+bool GpuFeatureFlags::is_webgl_blacklisted() const { |
+ return is_webgl_blacklisted_; |
+} |
+ |
+void GpuFeatureFlags::Combine(const GpuFeatureFlags& other) { |
+ is_accelerated_2d_canvas_blacklisted_ = |
+ (is_accelerated_2d_canvas_blacklisted_ || |
+ other.is_accelerated_2d_canvas_blacklisted_); |
+ is_accelerated_compositing_blacklisted_ = |
+ (is_accelerated_compositing_blacklisted_ || |
+ other.is_accelerated_compositing_blacklisted_); |
+ is_webgl_blacklisted_ = |
+ (is_webgl_blacklisted_ || other.is_webgl_blacklisted_); |
+} |
+ |
+GpuFeatureFlags::GpuFeatureType GpuFeatureFlags::StringToGpuFeatureType( |
+ const std::string& feature_string) { |
+ if (feature_string == kGpuFeatureNameAccelerated2dCanvas) |
+ return kGpuFeatureAccelerated2dCanvas; |
+ else if (feature_string == kGpuFeatureNameAcceleratedCompositing) |
+ return kGpuFeatureAcceleratedCompositing; |
+ else if (feature_string == kGpuFeatureNameWebgl) |
+ return kGpuFeatureWebgl; |
+ else if (feature_string == kGpuFeatureNameAny) |
+ return kGpuFeatureAny; |
+ return kGpuFeatureUnknown; |
+} |
+ |