summaryrefslogtreecommitdiffstats
path: root/chrome/browser/gpu_performance_stats.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/gpu_performance_stats.cc')
-rw-r--r--chrome/browser/gpu_performance_stats.cc32
1 files changed, 32 insertions, 0 deletions
diff --git a/chrome/browser/gpu_performance_stats.cc b/chrome/browser/gpu_performance_stats.cc
new file mode 100644
index 0000000..93d1932
--- /dev/null
+++ b/chrome/browser/gpu_performance_stats.cc
@@ -0,0 +1,32 @@
+// Copyright (c) 2012 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 "chrome/browser/gpu_performance_stats.h"
+
+#include "base/stringprintf.h"
+
+namespace {
+DictionaryValue* NewDescriptionValuePairFromFloat(const std::string& desc,
+ float value) {
+ DictionaryValue* dict = new DictionaryValue();
+ dict->SetString("description", desc);
+ dict->SetString("value", base::StringPrintf("%.1f", value));
+ return dict;
+}
+} // namespace
+
+#if !defined(OS_WIN)
+// No data for other operating systems yet, just return 0.0s.
+GpuPerformanceStats GpuPerformanceStats::RetrieveGpuPerformanceStats() {
+ return GpuPerformanceStats();
+}
+#endif
+
+base::Value* GpuPerformanceStats::ToValue() const {
+ ListValue* result = new ListValue();
+ result->Append(NewDescriptionValuePairFromFloat("Graphics", graphics));
+ result->Append(NewDescriptionValuePairFromFloat("Gaming", gaming));
+ result->Append(NewDescriptionValuePairFromFloat("Overall", overall));
+ return result;
+}