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..a16446570792bc47f77aa5645e5a5dc9214d678a 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> |
const char GpuFeatureFlags::kGpuFeatureNameAccelerated2dCanvas[] = |
"accelerated_2d_canvas"; |
@@ -31,6 +33,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 +49,23 @@ GpuFeatureFlags::GpuFeatureType GpuFeatureFlags::StringToGpuFeatureType( |
return kGpuFeatureUnknown; |
} |
+// static |
+std::string GpuFeatureFlags::GpuFeatureTypeToUserFriendlyString( |
+ GpuFeatureFlags::GpuFeatureType type) { |
+ std::vector<std::string> matches; |
+ if (type == kGpuFeatureAll) { |
+ matches.push_back("All GPU features"); |
zmo
2011/04/07 20:46:06
If you don't care about the difference between "ac
|
+ } else { |
+ if (kGpuFeatureAccelerated2dCanvas & type) |
+ matches.push_back("Accelerated 2D Canvas"); |
+ if (kGpuFeatureAcceleratedCompositing & type) |
+ matches.push_back("Accelerated Compositing"); |
+ if (kGpuFeatureWebgl & type) |
+ matches.push_back("WebGL"); |
+ if (kGpuFeatureMultisampling & type) |
+ matches.push_back("WebGL + Canvas Multisampling"); |
zmo
2011/04/07 20:46:06
I think only WebGL has Multisampling
|
+ if (!matches.size()) |
+ matches.push_back("Unknown feature"); |
Avi (use Gerrit)
2011/04/07 00:28:20
Gah. No, no, no. All user-visible text must go thr
|
+ } |
+ return JoinString(matches, ','); |
zmo
2011/04/07 20:46:06
There is no loop here, so why do you need a vector
|
+} |