OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 // MockableOneShotTimer implementation in terms of base::OneShotTimer | |
mmenke
2014/02/14 17:56:10
nit: Comments like this should generally go above
Elly Fong-Jones
2014/02/25 19:19:52
Done.
| |
5 | |
6 #include "chrome/renderer/net/mockable_one_shot_timer.h" | |
7 | |
8 MockableOneShotTimer::MockableOneShotTimer() {} | |
9 MockableOneShotTimer::~MockableOneShotTimer() {} | |
10 | |
11 void MockableOneShotTimer::Fired() { | |
12 task_.Run(); | |
13 } | |
14 | |
15 void MockableOneShotTimer::Start( | |
16 const tracked_objects::Location& posted_from, base::TimeDelta delay, | |
17 const base::Closure& task) { | |
18 DCHECK(!task.is_null()); | |
19 task_ = task; | |
20 timer_.Start(posted_from, delay, | |
21 base::Bind(&MockableOneShotTimer::Fired, | |
22 base::Unretained(this))); | |
mmenke
2014/02/14 17:56:10
nit: Think you can merge these two lines.
Elly Fong-Jones
2014/02/25 19:19:52
Done.
| |
23 } | |
24 | |
25 void MockableOneShotTimer::Stop() { | |
26 timer_.Stop(); | |
27 } | |
28 | |
29 bool MockableOneShotTimer::IsRunning() const { | |
30 return timer_.IsRunning(); | |
31 } | |
OLD | NEW |