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

Side by Side Diff: components/scheduler/base/cancelable_closure_holder.h

Issue 2118903002: scheduler: Move the Blink scheduler into Blink (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 4 years, 4 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/scheduler/base/DEPS ('k') | components/scheduler/base/cancelable_closure_holder.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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
5 #ifndef COMPONENTS_SCHEDULER_BASE_CANCELABLE_CLOSURE_HOLDER_H_
6 #define COMPONENTS_SCHEDULER_BASE_CANCELABLE_CLOSURE_HOLDER_H_
7
8 #include "base/cancelable_callback.h"
9 #include "base/macros.h"
10
11 namespace scheduler {
12
13 // A CancelableClosureHolder is a CancelableCallback which resets its wrapped
14 // callback with a cached closure whenever it is canceled.
15 class CancelableClosureHolder {
16 public:
17 CancelableClosureHolder();
18 ~CancelableClosureHolder();
19
20 // Resets the closure to be wrapped by the cancelable callback. Cancels any
21 // outstanding callbacks.
22 void Reset(const base::Closure& callback);
23
24 // Cancels any outstanding closures returned by callback().
25 void Cancel();
26
27 // Returns a callback that will be disabled by calling Cancel(). Callback
28 // must have been set using Reset() before calling this function.
29 const base::Closure& callback() const;
30
31 private:
32 base::Closure callback_;
33 base::CancelableClosure cancelable_callback_;
34
35 DISALLOW_COPY_AND_ASSIGN(CancelableClosureHolder);
36 };
37
38 } // namespace scheduler
39
40 #endif // COMPONENTS_SCHEDULER_BASE_CANCELABLE_CLOSURE_HOLDER_H_
OLDNEW
« no previous file with comments | « components/scheduler/base/DEPS ('k') | components/scheduler/base/cancelable_closure_holder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698