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

Side by Side Diff: chrome/browser/power/process_power_collector.cc

Issue 1551503002: Convert Pass()→std::move() in //chrome (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 12 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/power/process_power_collector.h" 5 #include "chrome/browser/power/process_power_collector.h"
6 6
7 #include <utility>
8
7 #include "base/process/process_handle.h" 9 #include "base/process/process_handle.h"
8 #include "base/process/process_metrics.h" 10 #include "base/process/process_metrics.h"
9 #include "build/build_config.h" 11 #include "build/build_config.h"
10 #include "chrome/browser/browser_process.h" 12 #include "chrome/browser/browser_process.h"
11 #include "chrome/browser/profiles/profile.h" 13 #include "chrome/browser/profiles/profile.h"
12 #include "chrome/browser/profiles/profile_manager.h" 14 #include "chrome/browser/profiles/profile_manager.h"
13 #include "chrome/browser/ui/tab_contents/tab_contents_iterator.h" 15 #include "chrome/browser/ui/tab_contents/tab_contents_iterator.h"
14 #include "components/power/origin_power_map.h" 16 #include "components/power/origin_power_map.h"
15 #include "components/power/origin_power_map_factory.h" 17 #include "components/power/origin_power_map_factory.h"
16 #include "content/public/browser/browser_context.h" 18 #include "content/public/browser/browser_context.h"
17 #include "content/public/browser/render_process_host.h" 19 #include "content/public/browser/render_process_host.h"
18 #include "content/public/browser/web_contents.h" 20 #include "content/public/browser/web_contents.h"
19 #include "extensions/browser/app_window/app_window.h" 21 #include "extensions/browser/app_window/app_window.h"
20 #include "extensions/browser/app_window/app_window_registry.h" 22 #include "extensions/browser/app_window/app_window_registry.h"
21 #include "url/gurl.h" 23 #include "url/gurl.h"
22 24
23 #if defined(OS_CHROMEOS) 25 #if defined(OS_CHROMEOS)
24 #include "chromeos/dbus/dbus_thread_manager.h" 26 #include "chromeos/dbus/dbus_thread_manager.h"
25 #include "chromeos/dbus/power_manager/power_supply_properties.pb.h" 27 #include "chromeos/dbus/power_manager/power_supply_properties.pb.h"
26 #endif 28 #endif
27 29
28 namespace { 30 namespace {
29 const int kSecondsPerSample = 30; 31 const int kSecondsPerSample = 30;
30 } 32 }
31 33
32 ProcessPowerCollector::PerProcessData::PerProcessData( 34 ProcessPowerCollector::PerProcessData::PerProcessData(
33 scoped_ptr<base::ProcessMetrics> metrics, 35 scoped_ptr<base::ProcessMetrics> metrics,
34 const GURL& origin, 36 const GURL& origin,
35 Profile* profile) 37 Profile* profile)
36 : metrics_(metrics.Pass()), 38 : metrics_(std::move(metrics)),
37 profile_(profile), 39 profile_(profile),
38 last_origin_(origin), 40 last_origin_(origin),
39 last_cpu_percent_(0), 41 last_cpu_percent_(0),
40 seen_this_cycle_(true) { 42 seen_this_cycle_(true) {}
41 }
42 43
43 ProcessPowerCollector::PerProcessData::PerProcessData() 44 ProcessPowerCollector::PerProcessData::PerProcessData()
44 : profile_(NULL), 45 : profile_(NULL),
45 last_cpu_percent_(0.0), 46 last_cpu_percent_(0.0),
46 seen_this_cycle_(false) { 47 seen_this_cycle_(false) {
47 } 48 }
48 49
49 ProcessPowerCollector::PerProcessData::~PerProcessData() { 50 ProcessPowerCollector::PerProcessData::~PerProcessData() {
50 } 51 }
51 52
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 origin, 210 origin,
210 Profile::FromBrowserContext(rph->GetBrowserContext()))); 211 Profile::FromBrowserContext(rph->GetBrowserContext())));
211 } 212 }
212 213
213 linked_ptr<PerProcessData>& process_data = metrics_map_[handle]; 214 linked_ptr<PerProcessData>& process_data = metrics_map_[handle];
214 process_data->set_last_cpu_percent(std::max(0.0, 215 process_data->set_last_cpu_percent(std::max(0.0,
215 cpu_usage_callback_.is_null() ? process_data->metrics()->GetCPUUsage() 216 cpu_usage_callback_.is_null() ? process_data->metrics()->GetCPUUsage()
216 : cpu_usage_callback_.Run(handle))); 217 : cpu_usage_callback_.Run(handle)));
217 process_data->set_seen_this_cycle(true); 218 process_data->set_seen_this_cycle(true);
218 } 219 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698