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

Side by Side Diff: components/component_updater/timer.cc

Issue 2837863004: Use base::OneShotTimer instead of base::Timer(false, false)
Patch Set: rebase 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
« no previous file with comments | « components/component_updater/timer.h ('k') | components/cryptauth/sync_scheduler_impl.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 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 "components/component_updater/timer.h" 5 #include "components/component_updater/timer.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/location.h" 9 #include "base/location.h"
10 10
11 namespace component_updater { 11 namespace component_updater {
12 12
13 Timer::Timer() : timer_(false, false) { 13 Timer::Timer() {}
14 }
15 14
16 Timer::~Timer() { 15 Timer::~Timer() {
17 DCHECK(thread_checker_.CalledOnValidThread()); 16 DCHECK(thread_checker_.CalledOnValidThread());
18 Stop(); 17 Stop();
19 } 18 }
20 19
21 void Timer::Start(base::TimeDelta initial_delay, 20 void Timer::Start(base::TimeDelta initial_delay,
22 base::TimeDelta delay, 21 base::TimeDelta delay,
23 const base::Closure& user_task) { 22 const base::Closure& user_task) {
24 DCHECK(thread_checker_.CalledOnValidThread()); 23 DCHECK(thread_checker_.CalledOnValidThread());
(...skipping 13 matching lines...) Expand all
38 void Timer::OnDelay() { 37 void Timer::OnDelay() {
39 DCHECK(thread_checker_.CalledOnValidThread()); 38 DCHECK(thread_checker_.CalledOnValidThread());
40 39
41 user_task_.Run(); 40 user_task_.Run();
42 41
43 timer_.Start(FROM_HERE, delay_, 42 timer_.Start(FROM_HERE, delay_,
44 base::Bind(&Timer::OnDelay, base::Unretained(this))); 43 base::Bind(&Timer::OnDelay, base::Unretained(this)));
45 } 44 }
46 45
47 } // namespace component_updater 46 } // namespace component_updater
OLDNEW
« no previous file with comments | « components/component_updater/timer.h ('k') | components/cryptauth/sync_scheduler_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698