Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2276)

Unified Diff: content/common/gpu_feature_flags.cc

Issue 6712048: Implement easy GPU feature status summary. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: First rev Created 9 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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
+}

Powered by Google App Engine
This is Rietveld 408576698