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

Side by Side Diff: components/timers/alarm_timer_chromeos.cc

Issue 1921923002: Convert //components/[o-t]* from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 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
« no previous file with comments | « components/timers/alarm_timer_chromeos.h ('k') | components/timers/alarm_timer_unittest.cc » ('j') | 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 "components/timers/alarm_timer_chromeos.h" 5 #include "components/timers/alarm_timer_chromeos.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 #include <sys/timerfd.h> 8 #include <sys/timerfd.h>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 scoped_refptr<base::SingleThreadTaskRunner> origin_task_runner_; 138 scoped_refptr<base::SingleThreadTaskRunner> origin_task_runner_;
139 139
140 // Callback that should be run when the timer fires. 140 // Callback that should be run when the timer fires.
141 base::Closure on_timer_fired_callback_; 141 base::Closure on_timer_fired_callback_;
142 142
143 // Hook used by tests to be notified when the timer has fired and a task has 143 // Hook used by tests to be notified when the timer has fired and a task has
144 // been queued in the MessageLoop. 144 // been queued in the MessageLoop.
145 base::Closure on_timer_fired_callback_for_test_; 145 base::Closure on_timer_fired_callback_for_test_;
146 146
147 // Manages watching file descriptors. 147 // Manages watching file descriptors.
148 scoped_ptr<base::MessageLoopForIO::FileDescriptorWatcher> fd_watcher_; 148 std::unique_ptr<base::MessageLoopForIO::FileDescriptorWatcher> fd_watcher_;
149 149
150 // The sequence numbers of the last Reset() call handled respectively on 150 // The sequence numbers of the last Reset() call handled respectively on
151 // |origin_task_runner_| and on the MessageLoopForIO used for watching the 151 // |origin_task_runner_| and on the MessageLoopForIO used for watching the
152 // timer file descriptor. Note that these can be the same MessageLoop. 152 // timer file descriptor. Note that these can be the same MessageLoop.
153 // OnTimerFired() runs |on_timer_fired_callback_| only if the sequence number 153 // OnTimerFired() runs |on_timer_fired_callback_| only if the sequence number
154 // it receives from the MessageLoopForIO matches 154 // it receives from the MessageLoopForIO matches
155 // |origin_reset_sequence_number_|. 155 // |origin_reset_sequence_number_|.
156 int origin_reset_sequence_number_; 156 int origin_reset_sequence_number_;
157 int io_reset_sequence_number_; 157 int io_reset_sequence_number_;
158 158
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
419 } 419 }
420 420
421 void AlarmTimer::OnTimerFired() { 421 void AlarmTimer::OnTimerFired() {
422 if (!base::Timer::IsRunning()) 422 if (!base::Timer::IsRunning())
423 return; 423 return;
424 424
425 DCHECK(pending_task_.get()); 425 DCHECK(pending_task_.get());
426 426
427 // Take ownership of the pending user task, which is going to be cleared by 427 // Take ownership of the pending user task, which is going to be cleared by
428 // the Stop() or Reset() functions below. 428 // the Stop() or Reset() functions below.
429 scoped_ptr<base::PendingTask> pending_user_task(std::move(pending_task_)); 429 std::unique_ptr<base::PendingTask> pending_user_task(
430 std::move(pending_task_));
430 431
431 // Re-schedule or stop the timer as requested. 432 // Re-schedule or stop the timer as requested.
432 if (base::Timer::is_repeating()) 433 if (base::Timer::is_repeating())
433 Reset(); 434 Reset();
434 else 435 else
435 Stop(); 436 Stop();
436 437
437 TRACE_TASK_EXECUTION("AlarmTimer::OnTimerFired", *pending_user_task); 438 TRACE_TASK_EXECUTION("AlarmTimer::OnTimerFired", *pending_user_task);
438 439
439 // Now run the user task. 440 // Now run the user task.
(...skipping 26 matching lines...) Expand all
466 SimpleAlarmTimer::SimpleAlarmTimer(const tracked_objects::Location& posted_from, 467 SimpleAlarmTimer::SimpleAlarmTimer(const tracked_objects::Location& posted_from,
467 base::TimeDelta delay, 468 base::TimeDelta delay,
468 const base::Closure& user_task) 469 const base::Closure& user_task)
469 : AlarmTimer(posted_from, delay, user_task, false) { 470 : AlarmTimer(posted_from, delay, user_task, false) {
470 } 471 }
471 472
472 SimpleAlarmTimer::~SimpleAlarmTimer() { 473 SimpleAlarmTimer::~SimpleAlarmTimer() {
473 } 474 }
474 475
475 } // namespace timers 476 } // namespace timers
OLDNEW
« no previous file with comments | « components/timers/alarm_timer_chromeos.h ('k') | components/timers/alarm_timer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698