| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2012 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 "content/browser/gpu/gpu_performance_stats.h" | |
| 6 | |
| 7 #include "base/stringprintf.h" | |
| 8 | |
| 9 namespace { | |
| 10 DictionaryValue* NewDescriptionValuePairFromFloat(const std::string& desc, | |
| 11 float value) { | |
| 12 DictionaryValue* dict = new DictionaryValue(); | |
| 13 dict->SetString("description", desc); | |
| 14 dict->SetString("value", base::StringPrintf("%.1f", value)); | |
| 15 return dict; | |
| 16 } | |
| 17 } // namespace | |
| 18 | |
| 19 #if !defined(OS_WIN) | |
| 20 // No data for other operating systems yet, just return 0.0s. | |
| 21 GpuPerformanceStats GpuPerformanceStats::RetrieveGpuPerformanceStats() { | |
| 22 return GpuPerformanceStats(); | |
| 23 } | |
| 24 #endif | |
| 25 | |
| 26 base::Value* GpuPerformanceStats::ToValue() const { | |
| 27 ListValue* result = new ListValue(); | |
| 28 result->Append(NewDescriptionValuePairFromFloat("Graphics", graphics)); | |
| 29 result->Append(NewDescriptionValuePairFromFloat("Gaming", gaming)); | |
| 30 result->Append(NewDescriptionValuePairFromFloat("Overall", overall)); | |
| 31 return result; | |
| 32 } | |
| OLD | NEW |