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

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

Issue 1132053002: [WIP]Oilpan: checking for nearly-dead observers. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 void setContext(Context*); 68 void setContext(Context*);
69 69
70 private: 70 private:
71 RawPtrWillBeWeakMember<Context> m_lifecycleContext; 71 RawPtrWillBeWeakMember<Context> m_lifecycleContext;
72 }; 72 };
73 73
74 template<typename T, typename Observer, typename Notifier> 74 template<typename T, typename Observer, typename Notifier>
75 inline void LifecycleObserver<T, Observer, Notifier>::setContext(typename Lifecy cleObserver<T, Observer, Notifier>::Context* context) 75 inline void LifecycleObserver<T, Observer, Notifier>::setContext(typename Lifecy cleObserver<T, Observer, Notifier>::Context* context)
76 { 76 {
77 if (m_lifecycleContext) 77 if (m_lifecycleContext)
78 static_cast<Notifier*>(m_lifecycleContext.get())->removeObserver(static_ cast<Observer*>(this)); 78 static_cast<Notifier*>(m_lifecycleContext.get())->removeObserver(static_ cast<Observer*>(this), IsGarbageCollectedType<T>::value);
79 79
80 m_lifecycleContext = context; 80 m_lifecycleContext = context;
81 81
82 if (m_lifecycleContext) 82 if (m_lifecycleContext)
83 static_cast<Notifier*>(m_lifecycleContext.get())->addObserver(static_cas t<Observer*>(this)); 83 static_cast<Notifier*>(m_lifecycleContext.get())->addObserver(static_cas t<Observer*>(this), IsGarbageCollectedType<T>::value);
84 } 84 }
85 85
86 } // namespace blink 86 } // namespace blink
87 87
88 #endif // LifecycleObserver_h 88 #endif // LifecycleObserver_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698