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

Side by Side Diff: ash/metrics/task_switch_time_tracker.cc

Issue 1867223004: Convert //ash from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address comments Created 4 years, 8 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "ash/metrics/task_switch_time_tracker.h" 5 #include "ash/metrics/task_switch_time_tracker.h"
6 6
7 #include "base/metrics/histogram.h" 7 #include "base/metrics/histogram.h"
8 #include "base/time/default_tick_clock.h" 8 #include "base/time/default_tick_clock.h"
9 9
10 namespace ash { 10 namespace ash {
(...skipping 14 matching lines...) Expand all
25 25
26 } // namespace 26 } // namespace
27 27
28 TaskSwitchTimeTracker::TaskSwitchTimeTracker(const std::string& histogram_name) 28 TaskSwitchTimeTracker::TaskSwitchTimeTracker(const std::string& histogram_name)
29 : histogram_name_(histogram_name), 29 : histogram_name_(histogram_name),
30 tick_clock_(new base::DefaultTickClock()) { 30 tick_clock_(new base::DefaultTickClock()) {
31 } 31 }
32 32
33 TaskSwitchTimeTracker::TaskSwitchTimeTracker( 33 TaskSwitchTimeTracker::TaskSwitchTimeTracker(
34 const std::string& histogram_name, 34 const std::string& histogram_name,
35 scoped_ptr<base::TickClock> tick_clock) 35 std::unique_ptr<base::TickClock> tick_clock)
36 : histogram_name_(histogram_name), tick_clock_(tick_clock.release()) { 36 : histogram_name_(histogram_name), tick_clock_(tick_clock.release()) {}
37 }
38 37
39 TaskSwitchTimeTracker::~TaskSwitchTimeTracker() { 38 TaskSwitchTimeTracker::~TaskSwitchTimeTracker() {
40 } 39 }
41 40
42 void TaskSwitchTimeTracker::OnTaskSwitch() { 41 void TaskSwitchTimeTracker::OnTaskSwitch() {
43 if (!HasLastActionTime()) 42 if (!HasLastActionTime())
44 SetLastActionTime(); 43 SetLastActionTime();
45 else 44 else
46 RecordTimeDelta(); 45 RecordTimeDelta();
47 } 46 }
(...skipping 30 matching lines...) Expand all
78 } 77 }
79 78
80 #if DCHECK_IS_ON() 79 #if DCHECK_IS_ON()
81 histogram_->CheckName(histogram_name_); 80 histogram_->CheckName(histogram_name_);
82 #endif // DCHECK_IS_ON() 81 #endif // DCHECK_IS_ON()
83 82
84 return histogram_; 83 return histogram_;
85 } 84 }
86 85
87 } // namespace ash 86 } // namespace ash
OLDNEW
« no previous file with comments | « ash/metrics/task_switch_time_tracker.h ('k') | ash/metrics/task_switch_time_tracker_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698