| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 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 | 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 #ifndef CHROME_COMMON_GPU_FEATURE_FLAGS_H__ | 5 #ifndef CHROME_COMMON_GPU_FEATURE_FLAGS_H__ |
| 6 #define CHROME_COMMON_GPU_FEATURE_FLAGS_H__ | 6 #define CHROME_COMMON_GPU_FEATURE_FLAGS_H__ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 // Provides flags indicating which gpu features are blacklisted for the system | 9 // Provides flags indicating which gpu features are blacklisted for the system |
| 10 // on which chrome is currently running. | 10 // on which chrome is currently running. |
| 11 | 11 |
| 12 #include <string> | 12 #include <string> |
| 13 | 13 |
| 14 #include "base/basictypes.h" | 14 #include "base/basictypes.h" |
| 15 | 15 |
| 16 class GpuFeatureFlags { | 16 class GpuFeatureFlags { |
| 17 public: | 17 public: |
| 18 enum GpuFeatureType { | 18 enum GpuFeatureType { |
| 19 kGpuFeatureAccelerated2dCanvas = 1 << 0, | 19 kGpuFeatureAccelerated2dCanvas = 1 << 0, |
| 20 kGpuFeatureAcceleratedCompositing = 1 << 1, | 20 kGpuFeatureAcceleratedCompositing = 1 << 1, |
| 21 kGpuFeatureWebgl = 1 << 2, | 21 kGpuFeatureWebgl = 1 << 2, |
| 22 kGpuFeatureMultisampling = 1 << 3, |
| 22 kGpuFeatureAll = kGpuFeatureAccelerated2dCanvas | | 23 kGpuFeatureAll = kGpuFeatureAccelerated2dCanvas | |
| 23 kGpuFeatureAcceleratedCompositing | | 24 kGpuFeatureAcceleratedCompositing | |
| 24 kGpuFeatureWebgl, | 25 kGpuFeatureWebgl | |
| 26 kGpuFeatureMultisampling, |
| 25 kGpuFeatureUnknown = 0 | 27 kGpuFeatureUnknown = 0 |
| 26 }; | 28 }; |
| 27 | 29 |
| 28 // All flags initialized to false, i.e., no feature is blacklisted. | 30 // All flags initialized to false, i.e., no feature is blacklisted. |
| 29 GpuFeatureFlags(); | 31 GpuFeatureFlags(); |
| 30 | 32 |
| 31 // flags are OR combination of GpuFeatureType. | 33 // flags are OR combination of GpuFeatureType. |
| 32 void set_flags(uint32 flags); | 34 void set_flags(uint32 flags); |
| 33 | 35 |
| 34 uint32 flags() const; | 36 uint32 flags() const; |
| 35 | 37 |
| 36 // Resets each flag by OR with the corresponding flag in "other". | 38 // Resets each flag by OR with the corresponding flag in "other". |
| 37 void Combine(const GpuFeatureFlags& other); | 39 void Combine(const GpuFeatureFlags& other); |
| 38 | 40 |
| 39 // Maps string to GpuFeatureType; returns kGpuFeatureUnknown if none of the | 41 // Maps string to GpuFeatureType; returns kGpuFeatureUnknown if none of the |
| 40 // following is input (case-sensitive): | 42 // following is input (case-sensitive): |
| 41 // "accelerated_2d_canvas" | 43 // "accelerated_2d_canvas" |
| 42 // "accelerated_compositing" | 44 // "accelerated_compositing" |
| 43 // "webgl" | 45 // "webgl" |
| 46 // "multisampling" |
| 44 static GpuFeatureType StringToGpuFeatureType( | 47 static GpuFeatureType StringToGpuFeatureType( |
| 45 const std::string& feature_string); | 48 const std::string& feature_string); |
| 46 | 49 |
| 47 private: | 50 private: |
| 48 static const char kGpuFeatureNameAccelerated2dCanvas[]; | 51 static const char kGpuFeatureNameAccelerated2dCanvas[]; |
| 49 static const char kGpuFeatureNameAcceleratedCompositing[]; | 52 static const char kGpuFeatureNameAcceleratedCompositing[]; |
| 50 static const char kGpuFeatureNameWebgl[]; | 53 static const char kGpuFeatureNameWebgl[]; |
| 54 static const char kGpuFeatureNameMultisampling[]; |
| 51 static const char kGpuFeatureNameAll[]; | 55 static const char kGpuFeatureNameAll[]; |
| 52 | 56 |
| 53 // If a bit is set to 1, corresponding feature is blacklisted. | 57 // If a bit is set to 1, corresponding feature is blacklisted. |
| 54 uint32 flags_; | 58 uint32 flags_; |
| 55 }; | 59 }; |
| 56 | 60 |
| 57 #endif // CHROME_COMMON_GPU_FEATURE_FLAGS_H__ | 61 #endif // CHROME_COMMON_GPU_FEATURE_FLAGS_H__ |
| 58 | 62 |
| OLD | NEW |