Index: content/common/gpu_feature_flags.cc |
diff --git a/content/common/gpu_feature_flags.cc b/content/common/gpu_feature_flags.cc |
index 479718dafc9b47e63c2cb1043f7229d2a2b01470..73b42b9788d2bd13ffa6898d03ae3ce2d084cf4a 100644 |
--- a/content/common/gpu_feature_flags.cc |
+++ b/content/common/gpu_feature_flags.cc |
@@ -1,10 +1,12 @@ |
-// Copyright (c) 2010 The Chromium Authors. All rights reserved. |
+// Copyright (c) 2011 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 "content/common/gpu_feature_flags.h" |
#include "base/logging.h" |
+#include "base/string_util.h" |
+#include <vector> |
jam
2011/04/12 17:55:49
nit: this should go on line 7, and have a blank li
|
const char GpuFeatureFlags::kGpuFeatureNameAccelerated2dCanvas[] = |
"accelerated_2d_canvas"; |
@@ -13,6 +15,7 @@ const char GpuFeatureFlags::kGpuFeatureNameAcceleratedCompositing[] = |
const char GpuFeatureFlags::kGpuFeatureNameWebgl[] = "webgl"; |
const char GpuFeatureFlags::kGpuFeatureNameMultisampling[] = "multisampling"; |
const char GpuFeatureFlags::kGpuFeatureNameAll[] = "all"; |
+const char GpuFeatureFlags::kGpuFeatureNameUnknown[] = "unknown"; |
GpuFeatureFlags::GpuFeatureFlags() |
: flags_(0) { |
@@ -31,6 +34,7 @@ void GpuFeatureFlags::Combine(const GpuFeatureFlags& other) { |
flags_ |= other.flags_; |
} |
+// static |
GpuFeatureFlags::GpuFeatureType GpuFeatureFlags::StringToGpuFeatureType( |
const std::string& feature_string) { |
if (feature_string == kGpuFeatureNameAccelerated2dCanvas) |
@@ -46,3 +50,23 @@ GpuFeatureFlags::GpuFeatureType GpuFeatureFlags::StringToGpuFeatureType( |
return kGpuFeatureUnknown; |
} |
+// static |
+std::string GpuFeatureFlags::GpuFeatureTypeToString( |
+ GpuFeatureFlags::GpuFeatureType type) { |
+ std::vector<std::string> matches; |
+ if (type == kGpuFeatureAll) { |
+ matches.push_back(kGpuFeatureNameAll); |
+ } else { |
+ if (kGpuFeatureAccelerated2dCanvas & type) |
+ matches.push_back(kGpuFeatureNameAccelerated2dCanvas); |
+ if (kGpuFeatureAcceleratedCompositing & type) |
+ matches.push_back(kGpuFeatureNameAcceleratedCompositing); |
+ if (kGpuFeatureWebgl & type) |
+ matches.push_back(kGpuFeatureNameWebgl); |
+ if (kGpuFeatureMultisampling & type) |
+ matches.push_back(kGpuFeatureNameMultisampling); |
+ if (!matches.size()) |
+ matches.push_back(kGpuFeatureNameUnknown); |
+ } |
+ return JoinString(matches, ','); |
+} |