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

Side by Side Diff: Source/platform/LifecycleContext.h

Issue 463543002: Oilpan: Ensure that classes with virtual trace methods always have vtables for their left-most base… (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 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 | Annotate | Revision Log
OLDNEW
1 1
2 /* 2 /*
3 * Copyright (C) 2013 Google Inc. All Rights Reserved. 3 * Copyright (C) 2013 Google Inc. All Rights Reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 12 matching lines...) Expand all
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 * 25 *
26 */ 26 */
27 27
28 #ifndef LifecycleContext_h 28 #ifndef LifecycleContext_h
29 #define LifecycleContext_h 29 #define LifecycleContext_h
30 30
31 #include "platform/LifecycleNotifier.h" 31 #include "platform/LifecycleNotifier.h"
32 #include "platform/LifecycleObserver.h" 32 #include "platform/LifecycleObserver.h"
33 #include "platform/heap/Handle.h"
Mads Ager (chromium) 2014/08/12 06:07:04 Forward declare instead of include?
33 #include "wtf/HashSet.h" 34 #include "wtf/HashSet.h"
34 #include "wtf/OwnPtr.h" 35 #include "wtf/OwnPtr.h"
35 #include "wtf/PassOwnPtr.h" 36 #include "wtf/PassOwnPtr.h"
36 37
37 namespace blink { 38 namespace blink {
38 39
39 template <typename T> 40 template <typename T>
40 class LifecycleContext { 41 class LifecycleContext {
41 public: 42 public:
42 typedef LifecycleNotifier<T> Notifier; 43 typedef LifecycleNotifier<T> Notifier;
43 typedef LifecycleObserver<T> Observer; 44 typedef LifecycleObserver<T> Observer;
44 45
45 LifecycleContext() { } 46 LifecycleContext() { }
46 virtual ~LifecycleContext() { } 47 virtual ~LifecycleContext() { }
47 48
48 virtual bool isContextThread() const { return true; } 49 virtual bool isContextThread() const { return true; }
49 50
50 // Called from the constructor of observers. 51 // Called from the constructor of observers.
51 void wasObservedBy(Observer*); 52 void wasObservedBy(Observer*);
52 53
53 // Called from the destructor of observers. 54 // Called from the destructor of observers.
54 void wasUnobservedBy(Observer*); 55 void wasUnobservedBy(Observer*);
55 56
57 virtual void trace(Visitor*) { }
58
56 protected: 59 protected:
57 Notifier& lifecycleNotifier(); 60 Notifier& lifecycleNotifier();
58 61
59 private: 62 private:
60 PassOwnPtr<Notifier> createLifecycleNotifier(); 63 PassOwnPtr<Notifier> createLifecycleNotifier();
61 64
62 OwnPtr<Notifier> m_lifecycleNotifier; 65 OwnPtr<Notifier> m_lifecycleNotifier;
63 }; 66 };
64 67
65 template<typename T> 68 template<typename T>
(...skipping 20 matching lines...) Expand all
86 89
87 template<typename T> 90 template<typename T>
88 inline PassOwnPtr<typename LifecycleContext<T>::Notifier> LifecycleContext<T>::c reateLifecycleNotifier() 91 inline PassOwnPtr<typename LifecycleContext<T>::Notifier> LifecycleContext<T>::c reateLifecycleNotifier()
89 { 92 {
90 return LifecycleContext<T>::Notifier::create(static_cast<T*>(this)); 93 return LifecycleContext<T>::Notifier::create(static_cast<T*>(this));
91 } 94 }
92 95
93 } // namespace blink 96 } // namespace blink
94 97
95 #endif // LifecycleContext_h 98 #endif // LifecycleContext_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698