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 | |
5 | |
6 #include "chrome/renderer/net/mockable_one_shot_timer.h" | |
7 | |
8 MockableOneShotTimer::MockableOneShotTimer() {} | |
9 MockableOneShotTimer::~MockableOneShotTimer() {} | |
10 | |
11 void MockableOneShotTimer::Fired() { | |
12 user_task_.Run(); | |
13 } | |
14 | |
15 void MockableOneShotTimer::Start( | |
16 const tracked_objects::Location& posted_from, base::TimeDelta delay, | |
17 const base::Closure& user_task) { | |
mmenke
2014/02/05 23:31:43
DCHECK(!user_task.is_empty())? (Or is_null, which
Elly Fong-Jones
2014/02/10 21:42:06
I don't think one can do that.
| |
18 user_task_ = user_task; | |
19 timer_.Start(posted_from, delay, | |
20 base::Bind(&MockableOneShotTimer::Fired, | |
21 base::Unretained(this))); | |
22 } | |
23 | |
24 void MockableOneShotTimer::Stop() { | |
25 timer_.Stop(); | |
26 } | |
27 | |
28 bool MockableOneShotTimer::IsRunning() const { | |
29 return timer_.IsRunning(); | |
30 } | |
OLD | NEW |