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

Side by Side Diff: third_party/WebKit/Source/platform/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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 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 #ifndef COMPONENTS_SCHEDULER_BASE_CANCELABLE_CLOSURE_HOLDER_H_ 5 #ifndef THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_BASE_CANCELABLE_CLOSURE_HOL DER_H_
6 #define COMPONENTS_SCHEDULER_BASE_CANCELABLE_CLOSURE_HOLDER_H_ 6 #define THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_BASE_CANCELABLE_CLOSURE_HOL DER_H_
7 7
8 #include "base/cancelable_callback.h" 8 #include "base/cancelable_callback.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 10
11 namespace blink {
11 namespace scheduler { 12 namespace scheduler {
12 13
13 // A CancelableClosureHolder is a CancelableCallback which resets its wrapped 14 // A CancelableClosureHolder is a CancelableCallback which resets its wrapped
14 // callback with a cached closure whenever it is canceled. 15 // callback with a cached closure whenever it is canceled.
15 class CancelableClosureHolder { 16 class CancelableClosureHolder {
16 public: 17 public:
17 CancelableClosureHolder(); 18 CancelableClosureHolder();
18 ~CancelableClosureHolder(); 19 ~CancelableClosureHolder();
19 20
20 // Resets the closure to be wrapped by the cancelable callback. Cancels any 21 // Resets the closure to be wrapped by the cancelable callback. Cancels any
21 // outstanding callbacks. 22 // outstanding callbacks.
22 void Reset(const base::Closure& callback); 23 void Reset(const base::Closure& callback);
23 24
24 // Cancels any outstanding closures returned by callback(). 25 // Cancels any outstanding closures returned by callback().
25 void Cancel(); 26 void Cancel();
26 27
27 // Returns a callback that will be disabled by calling Cancel(). Callback 28 // Returns a callback that will be disabled by calling Cancel(). Callback
28 // must have been set using Reset() before calling this function. 29 // must have been set using Reset() before calling this function.
29 const base::Closure& callback() const; 30 const base::Closure& callback() const;
30 31
31 private: 32 private:
32 base::Closure callback_; 33 base::Closure callback_;
33 base::CancelableClosure cancelable_callback_; 34 base::CancelableClosure cancelable_callback_;
34 35
35 DISALLOW_COPY_AND_ASSIGN(CancelableClosureHolder); 36 DISALLOW_COPY_AND_ASSIGN(CancelableClosureHolder);
36 }; 37 };
37 38
38 } // namespace scheduler 39 } // namespace scheduler
40 } // namespace blink
39 41
40 #endif // COMPONENTS_SCHEDULER_BASE_CANCELABLE_CLOSURE_HOLDER_H_ 42 #endif // THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_BASE_CANCELABLE_CLOSURE_ HOLDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698