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 20 matching lines...) Expand all Loading... | |
31 #include "core/dom/ActiveDOMObject.h" | 31 #include "core/dom/ActiveDOMObject.h" |
32 #include "wtf/TemporaryChange.h" | 32 #include "wtf/TemporaryChange.h" |
33 | 33 |
34 namespace blink { | 34 namespace blink { |
35 | 35 |
36 ContextLifecycleNotifier::ContextLifecycleNotifier(ExecutionContext* context) | 36 ContextLifecycleNotifier::ContextLifecycleNotifier(ExecutionContext* context) |
37 : LifecycleNotifier<ExecutionContext, ContextLifecycleObserver>(context) | 37 : LifecycleNotifier<ExecutionContext, ContextLifecycleObserver>(context) |
38 { | 38 { |
39 } | 39 } |
40 | 40 |
41 void ContextLifecycleNotifier::addObserver(ContextLifecycleObserver* observer) | 41 void ContextLifecycleNotifier::addObserver(ContextLifecycleObserver* observer) |
haraken
2015/03/09 10:47:45
Do we still need this?
sof
2015/03/09 10:51:44
I'd argue that we still want that RELEASE_ASSERT()
| |
42 { | 42 { |
43 LifecycleNotifier<ExecutionContext, ContextLifecycleObserver>::addObserver(o bserver); | 43 LifecycleNotifier<ExecutionContext, ContextLifecycleObserver>::addObserver(o bserver); |
44 if (observer->observerType() == ContextLifecycleObserver::ActiveDOMObjectTyp e) | 44 if (observer->observerType() == ContextLifecycleObserver::ActiveDOMObjectTyp e) |
45 RELEASE_ASSERT(m_iterating != IteratingOverActiveDOMObjects); | 45 RELEASE_ASSERT(m_iterating != IteratingOverActiveDOMObjects); |
46 } | 46 } |
47 | 47 |
48 void ContextLifecycleNotifier::removeObserver(ContextLifecycleObserver* observer ) | |
49 { | |
50 LifecycleNotifier<ExecutionContext, ContextLifecycleObserver>::removeObserve r(observer); | |
51 } | |
52 | |
53 void ContextLifecycleNotifier::notifyResumingActiveDOMObjects() | 48 void ContextLifecycleNotifier::notifyResumingActiveDOMObjects() |
54 { | 49 { |
55 TemporaryChange<IterationType> scope(m_iterating, IteratingOverActiveDOMObje cts); | 50 TemporaryChange<IterationType> scope(m_iterating, IteratingOverActiveDOMObje cts); |
56 Vector<ContextLifecycleObserver*> snapshotOfObservers; | 51 Vector<ContextLifecycleObserver*> snapshotOfObservers; |
57 copyToVector(m_observers, snapshotOfObservers); | 52 copyToVector(m_observers, snapshotOfObservers); |
58 for (ContextLifecycleObserver* observer : snapshotOfObservers) { | 53 for (ContextLifecycleObserver* observer : snapshotOfObservers) { |
59 // FIXME: Oilpan: At the moment, it's possible that a ActiveDOMObject | 54 // FIXME: Oilpan: At the moment, it's possible that a ActiveDOMObject |
60 // observer is destructed while iterating. Once we enable Oilpan by defa ult | 55 // observer is destructed while iterating. Once we enable Oilpan by defa ult |
61 // for all LifecycleObserver<T>s, we can remove the hack by making m_obs ervers | 56 // for all LifecycleObserver<T>s, we can remove the hack by making m_obs ervers |
62 // a HeapHashSet<WeakMember<LifecycleObserver<T>>>. | 57 // a HeapHashSet<WeakMember<LifecycleObserver<T>>>. |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
142 continue; | 137 continue; |
143 ActiveDOMObject* activeDOMObject = static_cast<ActiveDOMObject*>(observe r); | 138 ActiveDOMObject* activeDOMObject = static_cast<ActiveDOMObject*>(observe r); |
144 if (activeDOMObject == object) | 139 if (activeDOMObject == object) |
145 return true; | 140 return true; |
146 } | 141 } |
147 return false; | 142 return false; |
148 } | 143 } |
149 #endif | 144 #endif |
150 | 145 |
151 } // namespace blink | 146 } // namespace blink |
OLD | NEW |