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

Side by Side Diff: trunk/src/chrome/browser/policy/cloud/rate_limiter.cc

Issue 14985007: Revert 198844 "Move sequenced_task_runner to base/task" (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 "chrome/browser/policy/cloud/rate_limiter.h" 5 #include "chrome/browser/policy/cloud/rate_limiter.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 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/task/sequenced_task_runner.h" 11 #include "base/sequenced_task_runner.h"
12 #include "base/time/tick_clock.h" 12 #include "base/time/tick_clock.h"
13 13
14 namespace policy { 14 namespace policy {
15 15
16 RateLimiter::RateLimiter(size_t max_requests, 16 RateLimiter::RateLimiter(size_t max_requests,
17 const base::TimeDelta& duration, 17 const base::TimeDelta& duration,
18 const base::Closure& callback, 18 const base::Closure& callback,
19 scoped_refptr<base::SequencedTaskRunner> task_runner, 19 scoped_refptr<base::SequencedTaskRunner> task_runner,
20 scoped_ptr<base::TickClock> clock) 20 scoped_ptr<base::TickClock> clock)
21 : max_requests_(max_requests), 21 : max_requests_(max_requests),
(...skipping 27 matching lines...) Expand all
49 const base::TimeDelta time_until_next_callback = 49 const base::TimeDelta time_until_next_callback =
50 invocation_times_.front() - period_start; 50 invocation_times_.front() - period_start;
51 delayed_callback_.Reset( 51 delayed_callback_.Reset(
52 base::Bind(&RateLimiter::PostRequest, base::Unretained(this))); 52 base::Bind(&RateLimiter::PostRequest, base::Unretained(this)));
53 task_runner_->PostDelayedTask( 53 task_runner_->PostDelayedTask(
54 FROM_HERE, delayed_callback_.callback(), time_until_next_callback); 54 FROM_HERE, delayed_callback_.callback(), time_until_next_callback);
55 } 55 }
56 } 56 }
57 57
58 } // namespace policy 58 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698