| 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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 // Iteration state is recorded while iterating the observer set, | 74 // Iteration state is recorded while iterating the observer set, |
| 75 // optionally barring add or remove mutations. | 75 // optionally barring add or remove mutations. |
| 76 IterationState iteration_state_; | 76 IterationState iteration_state_; |
| 77 ObserverSet observers_; | 77 ObserverSet observers_; |
| 78 }; | 78 }; |
| 79 | 79 |
| 80 template <typename T, typename Observer> | 80 template <typename T, typename Observer> |
| 81 inline LifecycleNotifier<T, Observer>::~LifecycleNotifier() { | 81 inline LifecycleNotifier<T, Observer>::~LifecycleNotifier() { |
| 82 // FIXME: Enable the following ASSERT. Also see a FIXME in | 82 // FIXME: Enable the following ASSERT. Also see a FIXME in |
| 83 // Document::detachLayoutTree(). | 83 // Document::detachLayoutTree(). |
| 84 // ASSERT(!m_observers.size()); | 84 // DCHECK(!m_observers.size()); |
| 85 } | 85 } |
| 86 | 86 |
| 87 // Determine if |contextDestroyed(Observer*) is a public method on | 87 // Determine if |contextDestroyed(Observer*) is a public method on |
| 88 // class type |Observer|, or any of the class types it derives from. | 88 // class type |Observer|, or any of the class types it derives from. |
| 89 template <typename Observer, typename T> | 89 template <typename Observer, typename T> |
| 90 class HasContextDestroyed { | 90 class HasContextDestroyed { |
| 91 using YesType = char; | 91 using YesType = char; |
| 92 using NoType = int; | 92 using NoType = int; |
| 93 | 93 |
| 94 template <typename V> | 94 template <typename V> |
| (...skipping 61 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 |