| 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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 inline LifecycleNotifier<T, Observer>::~LifecycleNotifier() | 87 inline LifecycleNotifier<T, Observer>::~LifecycleNotifier() |
| 88 { | 88 { |
| 89 // FIXME: Enable the following ASSERT. Also see a FIXME in Document::detach(
). | 89 // FIXME: Enable the following ASSERT. Also see a FIXME in Document::detach(
). |
| 90 // ASSERT(!m_observers.size()); | 90 // ASSERT(!m_observers.size()); |
| 91 } | 91 } |
| 92 | 92 |
| 93 template<typename T, typename Observer> | 93 template<typename T, typename Observer> |
| 94 inline void LifecycleNotifier<T, Observer>::notifyContextDestroyed() | 94 inline void LifecycleNotifier<T, Observer>::notifyContextDestroyed() |
| 95 { | 95 { |
| 96 // Observer unregistration is allowed, but effectively a no-op. | 96 // Observer unregistration is allowed, but effectively a no-op. |
| 97 TemporaryChange<IterationState> scope(m_iterationState, AllowingRemoval); | 97 TemporaryChange<IterationState> scope(&m_iterationState, AllowingRemoval); |
| 98 ObserverSet observers; | 98 ObserverSet observers; |
| 99 m_observers.swap(observers); | 99 m_observers.swap(observers); |
| 100 for (Observer* observer : observers) { | 100 for (Observer* observer : observers) { |
| 101 ASSERT(observer->lifecycleContext() == context()); | 101 ASSERT(observer->lifecycleContext() == context()); |
| 102 observer->contextDestroyed(); | 102 observer->contextDestroyed(); |
| 103 } | 103 } |
| 104 } | 104 } |
| 105 | 105 |
| 106 template<typename T, typename Observer> | 106 template<typename T, typename Observer> |
| 107 inline void LifecycleNotifier<T, Observer>::addObserver(Observer* observer) | 107 inline void LifecycleNotifier<T, Observer>::addObserver(Observer* observer) |
| (...skipping 23 matching lines...) Expand all Loading... |
| 131 // the table is likely to become garbage soon. | 131 // the table is likely to become garbage soon. |
| 132 ThreadState::NoAllocationScope scope(ThreadState::current()); | 132 ThreadState::NoAllocationScope scope(ThreadState::current()); |
| 133 observers.removeAll(m_observers); | 133 observers.removeAll(m_observers); |
| 134 } | 134 } |
| 135 m_observers.swap(observers); | 135 m_observers.swap(observers); |
| 136 } | 136 } |
| 137 | 137 |
| 138 } // namespace blink | 138 } // namespace blink |
| 139 | 139 |
| 140 #endif // LifecycleNotifier_h | 140 #endif // LifecycleNotifier_h |
| OLD | NEW |