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

Side by Side Diff: remoting/host/backoff_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 | « net/websockets/websocket_stream_create_test_base.cc ('k') | remoting/host/mouse_shape_pump.h » ('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 "remoting/host/backoff_timer.h" 5 #include "remoting/host/backoff_timer.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 namespace remoting { 9 namespace remoting {
10 10
11 BackoffTimer::BackoffTimer() : timer_(new base::Timer(false, false)) {} 11 BackoffTimer::BackoffTimer() : timer_(new base::OneShotTimer) {}
12 12
13 BackoffTimer::~BackoffTimer() {} 13 BackoffTimer::~BackoffTimer() {}
14 14
15 void BackoffTimer::Start(const tracked_objects::Location& posted_from, 15 void BackoffTimer::Start(const tracked_objects::Location& posted_from,
16 base::TimeDelta delay, 16 base::TimeDelta delay,
17 base::TimeDelta max_delay, 17 base::TimeDelta max_delay,
18 const base::Closure& user_task) { 18 const base::Closure& user_task) {
19 backoff_policy_.multiply_factor = 2; 19 backoff_policy_.multiply_factor = 2;
20 backoff_policy_.initial_delay_ms = delay.InMilliseconds(); 20 backoff_policy_.initial_delay_ms = delay.InMilliseconds();
21 backoff_policy_.maximum_backoff_ms = max_delay.InMilliseconds(); 21 backoff_policy_.maximum_backoff_ms = max_delay.InMilliseconds();
(...skipping 27 matching lines...) Expand all
49 backoff_entry_->InformOfRequest(false); 49 backoff_entry_->InformOfRequest(false);
50 StartTimer(); 50 StartTimer();
51 51
52 // Running the user task may destroy this object, so don't reference 52 // Running the user task may destroy this object, so don't reference
53 // any fields of this object after running it. 53 // any fields of this object after running it.
54 base::Closure user_task(user_task_); 54 base::Closure user_task(user_task_);
55 user_task.Run(); 55 user_task.Run();
56 } 56 }
57 57
58 } // namespace remoting 58 } // namespace remoting
OLDNEW
« no previous file with comments | « net/websockets/websocket_stream_create_test_base.cc ('k') | remoting/host/mouse_shape_pump.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698