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

Side by Side Diff: third_party/WebKit/Source/core/dom/ContextLifecycleNotifier.cpp

Issue 2151933003: Change WTF::TemporaryChange to be an alias for AutoReset (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: TemporaryChange -> AutoReset Created 4 years, 5 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 * 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
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 27
28 #include "core/dom/ContextLifecycleNotifier.h" 28 #include "core/dom/ContextLifecycleNotifier.h"
29 29
30 #include "core/dom/ActiveDOMObject.h" 30 #include "core/dom/ActiveDOMObject.h"
31 #include "wtf/TemporaryChange.h" 31 #include "wtf/AutoReset.h"
32 32
33 namespace blink { 33 namespace blink {
34 34
35 void ContextLifecycleNotifier::notifyResumingActiveDOMObjects() 35 void ContextLifecycleNotifier::notifyResumingActiveDOMObjects()
36 { 36 {
37 TemporaryChange<IterationState> scope(m_iterationState, AllowingNone); 37 AutoReset<IterationState> scope(&m_iterationState, AllowingNone);
38 for (ContextLifecycleObserver* observer : m_observers) { 38 for (ContextLifecycleObserver* observer : m_observers) {
39 if (observer->observerType() != ContextLifecycleObserver::ActiveDOMObjec tType) 39 if (observer->observerType() != ContextLifecycleObserver::ActiveDOMObjec tType)
40 continue; 40 continue;
41 ActiveDOMObject* activeDOMObject = static_cast<ActiveDOMObject*>(observe r); 41 ActiveDOMObject* activeDOMObject = static_cast<ActiveDOMObject*>(observe r);
42 #if DCHECK_IS_ON() 42 #if DCHECK_IS_ON()
43 DCHECK_EQ(activeDOMObject->getExecutionContext(), context()); 43 DCHECK_EQ(activeDOMObject->getExecutionContext(), context());
44 DCHECK(activeDOMObject->suspendIfNeededCalled()); 44 DCHECK(activeDOMObject->suspendIfNeededCalled());
45 #endif 45 #endif
46 activeDOMObject->resume(); 46 activeDOMObject->resume();
47 } 47 }
48 } 48 }
49 49
50 void ContextLifecycleNotifier::notifySuspendingActiveDOMObjects() 50 void ContextLifecycleNotifier::notifySuspendingActiveDOMObjects()
51 { 51 {
52 TemporaryChange<IterationState> scope(m_iterationState, AllowingNone); 52 AutoReset<IterationState> scope(&m_iterationState, AllowingNone);
53 for (ContextLifecycleObserver* observer : m_observers) { 53 for (ContextLifecycleObserver* observer : m_observers) {
54 if (observer->observerType() != ContextLifecycleObserver::ActiveDOMObjec tType) 54 if (observer->observerType() != ContextLifecycleObserver::ActiveDOMObjec tType)
55 continue; 55 continue;
56 ActiveDOMObject* activeDOMObject = static_cast<ActiveDOMObject*>(observe r); 56 ActiveDOMObject* activeDOMObject = static_cast<ActiveDOMObject*>(observe r);
57 #if DCHECK_IS_ON() 57 #if DCHECK_IS_ON()
58 DCHECK_EQ(activeDOMObject->getExecutionContext(), context()); 58 DCHECK_EQ(activeDOMObject->getExecutionContext(), context());
59 DCHECK(activeDOMObject->suspendIfNeededCalled()); 59 DCHECK(activeDOMObject->suspendIfNeededCalled());
60 #endif 60 #endif
61 activeDOMObject->suspend(); 61 activeDOMObject->suspend();
62 } 62 }
63 } 63 }
64 64
65 void ContextLifecycleNotifier::notifyStoppingActiveDOMObjects() 65 void ContextLifecycleNotifier::notifyStoppingActiveDOMObjects()
66 { 66 {
67 // Observers may be removed, but handled after iteration has completed. 67 // Observers may be removed, but handled after iteration has completed.
68 TemporaryChange<IterationState> scope(m_iterationState, AllowPendingRemoval) ; 68 AutoReset<IterationState> scope(&m_iterationState, AllowPendingRemoval);
69 ObserverSet observers; 69 ObserverSet observers;
70 m_observers.swap(observers); 70 m_observers.swap(observers);
71 for (ContextLifecycleObserver* observer : observers) { 71 for (ContextLifecycleObserver* observer : observers) {
72 if (observer->observerType() != ContextLifecycleObserver::ActiveDOMObjec tType) 72 if (observer->observerType() != ContextLifecycleObserver::ActiveDOMObjec tType)
73 continue; 73 continue;
74 ActiveDOMObject* activeDOMObject = static_cast<ActiveDOMObject*>(observe r); 74 ActiveDOMObject* activeDOMObject = static_cast<ActiveDOMObject*>(observe r);
75 #if DCHECK_IS_ON() 75 #if DCHECK_IS_ON()
76 DCHECK_EQ(activeDOMObject->getExecutionContext(), context()); 76 DCHECK_EQ(activeDOMObject->getExecutionContext(), context());
77 DCHECK(activeDOMObject->suspendIfNeededCalled()); 77 DCHECK(activeDOMObject->suspendIfNeededCalled());
78 #endif 78 #endif
(...skipping 23 matching lines...) Expand all
102 continue; 102 continue;
103 ActiveDOMObject* activeDOMObject = static_cast<ActiveDOMObject*>(observe r); 103 ActiveDOMObject* activeDOMObject = static_cast<ActiveDOMObject*>(observe r);
104 if (activeDOMObject == object) 104 if (activeDOMObject == object)
105 return true; 105 return true;
106 } 106 }
107 return false; 107 return false;
108 } 108 }
109 #endif 109 #endif
110 110
111 } // namespace blink 111 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/css/SelectorChecker.cpp ('k') | third_party/WebKit/Source/core/dom/DOMURL.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698