Chromium Code Reviews| Index: chrome/common/gpu_feature_flags.h |
| =================================================================== |
| --- chrome/common/gpu_feature_flags.h (revision 0) |
| +++ chrome/common/gpu_feature_flags.h (revision 0) |
| @@ -0,0 +1,59 @@ |
| +// 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. |
| + |
| +#ifndef CHROME_COMMON_GPU_FEATURE_FLAGS_H__ |
| +#define CHROME_COMMON_GPU_FEATURE_FLAGS_H__ |
| +#pragma once |
| + |
| +// Provides flags indicating which gpu features are blacklisted for the system |
| +// on which chrome is currently running. |
| + |
| +#include <string> |
| + |
| +class GpuFeatureFlags { |
| + public: |
| + enum GpuFeatureType { |
| + kGpuFeatureAccelerated2dCanvas, |
| + kGpuFeatureAcceleratedCompositing, |
| + kGpuFeatureWebgl, |
| + kGpuFeatureAny, |
|
vangelis
2010/12/08 00:17:38
it's not clear what kGpuFeatureAny really does and
Zhenyao Mo
2010/12/09 00:06:06
Done.
|
| + kGpuFeatureUnknown |
| + }; |
| + |
| + // All flags initialized to false, i.e., no feature is blacklisted. |
| + GpuFeatureFlags(); |
| + |
| + bool is_accelerated_2d_canvas_blacklisted() const; |
| + bool is_accelerated_compositing_blacklisted() const; |
| + bool is_webgl_blacklisted() const; |
| + |
| + void SetFlags(bool is_accelerated_2d_canvas_blacklisted, |
| + bool is_accelerated_compositing_blacklisted, |
| + bool is_webgl_blacklisted); |
| + |
| + // Resets each flag by OR with the corresponding flag in "other". |
| + void Combine(const GpuFeatureFlags& other); |
| + |
| + // Maps string to GpuFeatureType; returns kGpuFeatureUnknown if none of the |
| + // following is input (case-sensitive): |
| + // "accelerated_2d_canvas" |
| + // "accelerated_compositing" |
| + // "webgl" |
| + // "any" |
| + static GpuFeatureType StringToGpuFeatureType( |
| + const std::string& feature_string); |
| + |
| + private: |
| + static const char kGpuFeatureNameAccelerated2dCanvas[]; |
| + static const char kGpuFeatureNameAcceleratedCompositing[]; |
| + static const char kGpuFeatureNameWebgl[]; |
| + static const char kGpuFeatureNameAny[]; |
| + |
| + bool is_accelerated_2d_canvas_blacklisted_; |
|
vangelis
2010/12/08 00:17:38
It would be cleaner to use a single bitfield (e.g.
Zhenyao Mo
2010/12/09 00:06:06
Done.
|
| + bool is_accelerated_compositing_blacklisted_; |
| + bool is_webgl_blacklisted_; |
| +}; |
| + |
| +#endif // CHROME_COMMON_GPU_FEATURE_FLAGS_H__ |
| + |