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

Side by Side Diff: chrome/browser/ui/webui/chromeos/power_ui.cc

Issue 2853863002: Add parser for new cpu freq file (Closed)
Patch Set: Add parser for new cpu freq file Created 3 years, 7 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/webui/chromeos/power_ui.h" 5 #include "chrome/browser/ui/webui/chromeos/power_ui.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <memory> 9 #include <memory>
10 #include <utility> 10 #include <utility>
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 const CpuDataCollector::StateOccupancySample& sample = sample_deque[i]; 169 const CpuDataCollector::StateOccupancySample& sample = sample_deque[i];
170 std::unique_ptr<base::DictionaryValue> js_sample( 170 std::unique_ptr<base::DictionaryValue> js_sample(
171 new base::DictionaryValue); 171 new base::DictionaryValue);
172 js_sample->SetDouble("time", sample.time.ToJsTime()); 172 js_sample->SetDouble("time", sample.time.ToJsTime());
173 js_sample->SetBoolean("cpuOnline", sample.cpu_online); 173 js_sample->SetBoolean("cpuOnline", sample.cpu_online);
174 174
175 std::unique_ptr<base::DictionaryValue> state_dict( 175 std::unique_ptr<base::DictionaryValue> state_dict(
176 new base::DictionaryValue); 176 new base::DictionaryValue);
177 for (size_t index = 0; index < sample.time_in_state.size(); ++index) { 177 for (size_t index = 0; index < sample.time_in_state.size(); ++index) {
178 state_dict->SetDouble(state_names[index], 178 state_dict->SetDouble(state_names[index],
179 static_cast<double>(sample.time_in_state[index])); 179 sample.time_in_state[index].InMillisecondsF());
180 } 180 }
181 js_sample->Set("timeInState", std::move(state_dict)); 181 js_sample->Set("timeInState", std::move(state_dict));
182 182
183 js_sample_list->Append(std::move(js_sample)); 183 js_sample_list->Append(std::move(js_sample));
184 } 184 }
185 js_data->Append(std::move(js_sample_list)); 185 js_data->Append(std::move(js_sample_list));
186 } 186 }
187 } 187 }
188 188
189 } // namespace 189 } // namespace
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 html->SetDefaultResource(IDR_ABOUT_POWER_HTML); 239 html->SetDefaultResource(IDR_ABOUT_POWER_HTML);
240 240
241 Profile* profile = Profile::FromWebUI(web_ui); 241 Profile* profile = Profile::FromWebUI(web_ui);
242 content::WebUIDataSource::Add(profile, html); 242 content::WebUIDataSource::Add(profile, html);
243 } 243 }
244 244
245 PowerUI::~PowerUI() { 245 PowerUI::~PowerUI() {
246 } 246 }
247 247
248 } // namespace chromeos 248 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698