OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2010 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 #ifndef CHROME_COMMON_GPU_FEATURE_FLAGS_H__ |
| 6 #define CHROME_COMMON_GPU_FEATURE_FLAGS_H__ |
| 7 #pragma once |
| 8 |
| 9 // Provides flags indicating which gpu features are blacklisted for the system |
| 10 // on which chrome is currently running. |
| 11 |
| 12 #include <string> |
| 13 |
| 14 class GpuFeatureFlags { |
| 15 public: |
| 16 enum GpuFeatureType { |
| 17 kGpuFeatureAccelerated2dCanvas, |
| 18 kGpuFeatureAcceleratedCompositing, |
| 19 kGpuFeatureWebgl, |
| 20 kGpuFeatureAny, |
| 21 kGpuFeatureUnknown |
| 22 }; |
| 23 |
| 24 // All flags initialized to false, i.e., no feature is blacklisted. |
| 25 GpuFeatureFlags(); |
| 26 |
| 27 bool is_accelerated_2d_canvas_blacklisted() const; |
| 28 bool is_accelerated_compositing_blacklisted() const; |
| 29 bool is_webgl_blacklisted() const; |
| 30 |
| 31 void SetFlags(bool is_accelerated_2d_canvas_blacklisted, |
| 32 bool is_accelerated_compositing_blacklisted, |
| 33 bool is_webgl_blacklisted); |
| 34 |
| 35 // Resets each flag by OR with the corresponding flag in "other". |
| 36 void Combine(const GpuFeatureFlags& other); |
| 37 |
| 38 // Maps string to GpuFeatureType; returns kGpuFeatureUnknown if none of the |
| 39 // following is input (case-sensitive): |
| 40 // "accelerated_2d_canvas" |
| 41 // "accelerated_compositing" |
| 42 // "webgl" |
| 43 // "any" |
| 44 static GpuFeatureType StringToGpuFeatureType( |
| 45 const std::string& feature_string); |
| 46 |
| 47 private: |
| 48 static const char kGpuFeatureNameAccelerated2dCanvas[]; |
| 49 static const char kGpuFeatureNameAcceleratedCompositing[]; |
| 50 static const char kGpuFeatureNameWebgl[]; |
| 51 static const char kGpuFeatureNameAny[]; |
| 52 |
| 53 bool is_accelerated_2d_canvas_blacklisted_; |
| 54 bool is_accelerated_compositing_blacklisted_; |
| 55 bool is_webgl_blacklisted_; |
| 56 }; |
| 57 |
| 58 #endif // CHROME_COMMON_GPU_FEATURE_FLAGS_H__ |
OLD | NEW |