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

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

Issue 203393002: Revert of Explicit notification and removal of lifecycle observers. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 9 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
« no previous file with comments | « Source/core/dom/ContextLifecycleNotifier.h ('k') | Source/core/dom/ExecutionContext.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 { 57 {
58 LifecycleNotifier<ExecutionContext>::removeObserver(observer); 58 LifecycleNotifier<ExecutionContext>::removeObserver(observer);
59 59
60 RELEASE_ASSERT(m_iterating != IteratingOverContextObservers); 60 RELEASE_ASSERT(m_iterating != IteratingOverContextObservers);
61 if (observer->observerType() == Observer::ActiveDOMObjectType) { 61 if (observer->observerType() == Observer::ActiveDOMObjectType) {
62 RELEASE_ASSERT(m_iterating != IteratingOverActiveDOMObjects); 62 RELEASE_ASSERT(m_iterating != IteratingOverActiveDOMObjects);
63 m_activeDOMObjects.remove(static_cast<ActiveDOMObject*>(observer)); 63 m_activeDOMObjects.remove(static_cast<ActiveDOMObject*>(observer));
64 } 64 }
65 } 65 }
66 66
67 void ContextLifecycleNotifier::removeAndNotifyAllObservers()
68 {
69 LifecycleNotifier<ExecutionContext>::removeAndNotifyAllObservers();
70 m_activeDOMObjects.clear();
71 }
72
73 void ContextLifecycleNotifier::notifyResumingActiveDOMObjects() 67 void ContextLifecycleNotifier::notifyResumingActiveDOMObjects()
74 { 68 {
75 TemporaryChange<IterationType> scope(this->m_iterating, IteratingOverActiveD OMObjects); 69 TemporaryChange<IterationType> scope(this->m_iterating, IteratingOverActiveD OMObjects);
76 ActiveDOMObjectSet::iterator activeObjectsEnd = m_activeDOMObjects.end(); 70 ActiveDOMObjectSet::iterator activeObjectsEnd = m_activeDOMObjects.end();
77 for (ActiveDOMObjectSet::iterator iter = m_activeDOMObjects.begin(); iter != activeObjectsEnd; ++iter) { 71 for (ActiveDOMObjectSet::iterator iter = m_activeDOMObjects.begin(); iter != activeObjectsEnd; ++iter) {
78 ASSERT((*iter)->executionContext() == context()); 72 ASSERT((*iter)->executionContext() == context());
79 ASSERT((*iter)->suspendIfNeededCalled()); 73 ASSERT((*iter)->suspendIfNeededCalled());
80 (*iter)->resume(); 74 (*iter)->resume();
81 } 75 }
82 } 76 }
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 ActiveDOMObjectSet::const_iterator activeObjectsEnd = activeDOMObjects().end (); 113 ActiveDOMObjectSet::const_iterator activeObjectsEnd = activeDOMObjects().end ();
120 for (ActiveDOMObjectSet::const_iterator iter = activeDOMObjects().begin(); i ter != activeObjectsEnd; ++iter) { 114 for (ActiveDOMObjectSet::const_iterator iter = activeDOMObjects().begin(); i ter != activeObjectsEnd; ++iter) {
121 if ((*iter)->hasPendingActivity()) 115 if ((*iter)->hasPendingActivity())
122 return true; 116 return true;
123 } 117 }
124 118
125 return false; 119 return false;
126 } 120 }
127 121
128 } // namespace WebCore 122 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/dom/ContextLifecycleNotifier.h ('k') | Source/core/dom/ExecutionContext.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698