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

Side by Side Diff: content/browser/power_usage_monitor_impl.cc

Issue 1417673009: base: SysInfo::Uptime() returns a TimeDelta (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update perf_provider_chromeos.cc (just updated in another CL) Created 5 years, 1 month 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
« no previous file with comments | « components/startup_metric_utils/browser/startup_metric_utils.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "content/browser/power_usage_monitor_impl.h" 5 #include "content/browser/power_usage_monitor_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/lazy_instance.h" 8 #include "base/lazy_instance.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 NOTIFICATION_RENDERER_PROCESS_CREATED, 129 NOTIFICATION_RENDERER_PROCESS_CREATED,
130 NotificationService::AllBrowserContextsAndSources()); 130 NotificationService::AllBrowserContextsAndSources());
131 registrar_.Add(this, 131 registrar_.Add(this,
132 NOTIFICATION_RENDERER_PROCESS_CLOSED, 132 NOTIFICATION_RENDERER_PROCESS_CLOSED,
133 NotificationService::AllBrowserContextsAndSources()); 133 NotificationService::AllBrowserContextsAndSources());
134 subscription_ = 134 subscription_ =
135 device::BatteryStatusService::GetInstance()->AddCallback(callback_); 135 device::BatteryStatusService::GetInstance()->AddCallback(callback_);
136 136
137 // Delay initialization until the system has been up for a while. 137 // Delay initialization until the system has been up for a while.
138 // This is to mitigate the effect of increased power draw during system start. 138 // This is to mitigate the effect of increased power draw during system start.
139 base::TimeDelta uptime = 139 base::TimeDelta uptime = base::SysInfo::Uptime();
140 base::TimeDelta::FromMilliseconds(base::SysInfo::Uptime());
141 base::TimeDelta min_uptime = base::TimeDelta::FromMinutes(kMinUptimeMinutes); 140 base::TimeDelta min_uptime = base::TimeDelta::FromMinutes(kMinUptimeMinutes);
142 if (uptime < min_uptime) { 141 if (uptime < min_uptime) {
143 base::TimeDelta delay = min_uptime - uptime; 142 base::TimeDelta delay = min_uptime - uptime;
144 BrowserThread::PostDelayedTask( 143 BrowserThread::PostDelayedTask(
145 BrowserThread::UI, 144 BrowserThread::UI,
146 FROM_HERE, 145 FROM_HERE,
147 base::Bind(&PowerUsageMonitor::StartInternal, base::Unretained(this)), 146 base::Bind(&PowerUsageMonitor::StartInternal, base::Unretained(this)),
148 delay); 147 delay);
149 } else { 148 } else {
150 StartInternal(); 149 StartInternal();
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 RenderProcessHost* rph = Source<RenderProcessHost>(source).ptr(); 266 RenderProcessHost* rph = Source<RenderProcessHost>(source).ptr();
268 OnRenderProcessNotification(type, rph->GetID()); 267 OnRenderProcessNotification(type, rph->GetID());
269 } 268 }
270 269
271 void PowerUsageMonitor::CancelPendingHistogramReporting() { 270 void PowerUsageMonitor::CancelPendingHistogramReporting() {
272 // Cancel any in-progress histogram reports and reporting of discharge UMA. 271 // Cancel any in-progress histogram reports and reporting of discharge UMA.
273 system_interface_->CancelPendingHistogramReports(); 272 system_interface_->CancelPendingHistogramReports();
274 } 273 }
275 274
276 } // namespace content 275 } // namespace content
OLDNEW
« no previous file with comments | « components/startup_metric_utils/browser/startup_metric_utils.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698