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

Side by Side Diff: cc/base/delayed_unique_notifier.h

Issue 683113005: Update from chromium https://crrev.com/302282 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 1 month 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 | « cc/BUILD.gn ('k') | cc/base/delayed_unique_notifier.cc » ('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 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 CC_BASE_DELAYED_UNIQUE_NOTIFIER_H_ 5 #ifndef CC_BASE_DELAYED_UNIQUE_NOTIFIER_H_
6 #define CC_BASE_DELAYED_UNIQUE_NOTIFIER_H_ 6 #define CC_BASE_DELAYED_UNIQUE_NOTIFIER_H_
7 7
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/memory/weak_ptr.h" 9 #include "base/memory/weak_ptr.h"
10 #include "cc/base/cc_export.h" 10 #include "cc/base/cc_export.h"
(...skipping 19 matching lines...) Expand all
30 // Schedule a notification to be run. If another notification is already 30 // Schedule a notification to be run. If another notification is already
31 // pending, then it will happen in (at least) given delay from now. That is, 31 // pending, then it will happen in (at least) given delay from now. That is,
32 // if delay is 16ms and a notification has been scheduled 10ms ago (ie, it 32 // if delay is 16ms and a notification has been scheduled 10ms ago (ie, it
33 // should trigger in no less than 6ms), then calling schedule will ensure that 33 // should trigger in no less than 6ms), then calling schedule will ensure that
34 // the only notification that arrives will happen in (at least) 16ms from now. 34 // the only notification that arrives will happen in (at least) 16ms from now.
35 void Schedule(); 35 void Schedule();
36 36
37 // Cancel any previously scheduled runs. 37 // Cancel any previously scheduled runs.
38 void Cancel(); 38 void Cancel();
39 39
40 // Cancel previously scheduled runs and prevent any new runs from starting.
41 // After calling this the DelayedUniqueNotifier will have no outstanding
42 // WeakPtrs.
43 void Shutdown();
44
40 // Returns true if a notification is currently scheduled to run. 45 // Returns true if a notification is currently scheduled to run.
41 bool HasPendingNotification() const; 46 bool HasPendingNotification() const;
42 47
43 protected: 48 protected:
44 // Virtual for testing. 49 // Virtual for testing.
45 virtual base::TimeTicks Now() const; 50 virtual base::TimeTicks Now() const;
46 51
47 private: 52 private:
48 void NotifyIfTime(); 53 void NotifyIfTime();
49 54
50 base::SequencedTaskRunner* task_runner_; 55 base::SequencedTaskRunner* task_runner_;
51 base::Closure closure_; 56 base::Closure closure_;
52 base::TimeDelta delay_; 57 base::TimeDelta delay_;
53 base::TimeTicks next_notification_time_; 58 base::TimeTicks next_notification_time_;
54 bool notification_pending_; 59 bool notification_pending_;
55 60
56 base::WeakPtrFactory<DelayedUniqueNotifier> weak_ptr_factory_; 61 base::WeakPtrFactory<DelayedUniqueNotifier> weak_ptr_factory_;
57 62
58 DISALLOW_COPY_AND_ASSIGN(DelayedUniqueNotifier); 63 DISALLOW_COPY_AND_ASSIGN(DelayedUniqueNotifier);
59 }; 64 };
60 65
61 } // namespace cc 66 } // namespace cc
62 67
63 #endif // CC_BASE_DELAYED_UNIQUE_NOTIFIER_H_ 68 #endif // CC_BASE_DELAYED_UNIQUE_NOTIFIER_H_
OLDNEW
« no previous file with comments | « cc/BUILD.gn ('k') | cc/base/delayed_unique_notifier.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698