| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. | 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. |
| 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 10 matching lines...) Expand all Loading... |
| 21 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | 21 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
| 22 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 22 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 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 #ifndef LifecycleNotifier_h | 27 #ifndef LifecycleNotifier_h |
| 28 #define LifecycleNotifier_h | 28 #define LifecycleNotifier_h |
| 29 | 29 |
| 30 #include "platform/heap/Handle.h" | 30 #include "platform/heap/Handle.h" |
| 31 #include "wtf/AutoReset.h" | 31 #include "platform/wtf/AutoReset.h" |
| 32 #include "wtf/HashSet.h" | 32 #include "platform/wtf/HashSet.h" |
| 33 | 33 |
| 34 namespace blink { | 34 namespace blink { |
| 35 | 35 |
| 36 template <typename T, typename Observer> | 36 template <typename T, typename Observer> |
| 37 class LifecycleNotifier : public virtual GarbageCollectedMixin { | 37 class LifecycleNotifier : public virtual GarbageCollectedMixin { |
| 38 public: | 38 public: |
| 39 virtual ~LifecycleNotifier(); | 39 virtual ~LifecycleNotifier(); |
| 40 | 40 |
| 41 void AddObserver(Observer*); | 41 void AddObserver(Observer*); |
| 42 void RemoveObserver(Observer*); | 42 void RemoveObserver(Observer*); |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 observers_.insert(observer); | 156 observers_.insert(observer); |
| 157 return; | 157 return; |
| 158 } | 158 } |
| 159 RELEASE_ASSERT(iteration_state_ & kAllowingRemoval); | 159 RELEASE_ASSERT(iteration_state_ & kAllowingRemoval); |
| 160 observers_.erase(observer); | 160 observers_.erase(observer); |
| 161 } | 161 } |
| 162 | 162 |
| 163 } // namespace blink | 163 } // namespace blink |
| 164 | 164 |
| 165 #endif // LifecycleNotifier_h | 165 #endif // LifecycleNotifier_h |
| OLD | NEW |