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 #include "chrome/common/gpu_feature_flags.h" |
| 6 |
| 7 #include "base/logging.h" |
| 8 |
| 9 const char GpuFeatureFlags::kGpuFeatureNameAccelerated2dCanvas[] = |
| 10 "accelerated_2d_canvas"; |
| 11 const char GpuFeatureFlags::kGpuFeatureNameAcceleratedCompositing[] = |
| 12 "accelerated_compositing"; |
| 13 const char GpuFeatureFlags::kGpuFeatureNameWebgl[] = "webgl"; |
| 14 |
| 15 GpuFeatureFlags::GpuFeatureFlags() |
| 16 : flags_(0) { |
| 17 } |
| 18 |
| 19 void GpuFeatureFlags::set_flags(uint32 flags) { |
| 20 DCHECK_EQ(flags & (~(kGpuFeatureAccelerated2dCanvas | |
| 21 kGpuFeatureAcceleratedCompositing | |
| 22 kGpuFeatureWebgl)), 0u); |
| 23 flags_ = flags; |
| 24 } |
| 25 |
| 26 uint32 GpuFeatureFlags::flags() const { |
| 27 return flags_; |
| 28 } |
| 29 |
| 30 void GpuFeatureFlags::Combine(const GpuFeatureFlags& other) { |
| 31 flags_ |= other.flags_; |
| 32 } |
| 33 |
| 34 GpuFeatureFlags::GpuFeatureType GpuFeatureFlags::StringToGpuFeatureType( |
| 35 const std::string& feature_string) { |
| 36 if (feature_string == kGpuFeatureNameAccelerated2dCanvas) |
| 37 return kGpuFeatureAccelerated2dCanvas; |
| 38 else if (feature_string == kGpuFeatureNameAcceleratedCompositing) |
| 39 return kGpuFeatureAcceleratedCompositing; |
| 40 else if (feature_string == kGpuFeatureNameWebgl) |
| 41 return kGpuFeatureWebgl; |
| 42 return kGpuFeatureUnknown; |
| 43 } |
| 44 |
OLD | NEW |