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

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

Issue 248523003: Remove ActiveDOMObject::willStop, and introduce WorkerGlobalScope::TerminationObserver. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 8 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 | Annotate | Revision Log
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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 { 79 {
80 TemporaryChange<IterationType> scope(this->m_iterating, IteratingOverActiveD OMObjects); 80 TemporaryChange<IterationType> scope(this->m_iterating, IteratingOverActiveD OMObjects);
81 ActiveDOMObjectSet::iterator activeObjectsEnd = m_activeDOMObjects.end(); 81 ActiveDOMObjectSet::iterator activeObjectsEnd = m_activeDOMObjects.end();
82 for (ActiveDOMObjectSet::iterator iter = m_activeDOMObjects.begin(); iter != activeObjectsEnd; ++iter) { 82 for (ActiveDOMObjectSet::iterator iter = m_activeDOMObjects.begin(); iter != activeObjectsEnd; ++iter) {
83 ASSERT((*iter)->executionContext() == context()); 83 ASSERT((*iter)->executionContext() == context());
84 ASSERT((*iter)->suspendIfNeededCalled()); 84 ASSERT((*iter)->suspendIfNeededCalled());
85 (*iter)->suspend(); 85 (*iter)->suspend();
86 } 86 }
87 } 87 }
88 88
89 void ContextLifecycleNotifier::notifyWillStopActiveDOMObjects()
90 {
91 TemporaryChange<IterationType> scope(this->m_iterating, IteratingOverActiveD OMObjects);
92 ActiveDOMObjectSet::iterator activeObjectsEnd = m_activeDOMObjects.end();
93 for (ActiveDOMObjectSet::iterator iter = m_activeDOMObjects.begin(); iter != activeObjectsEnd; ++iter) {
94 ASSERT((*iter)->executionContext() == context());
95 ASSERT((*iter)->suspendIfNeededCalled());
96 (*iter)->willStop();
97 }
98 }
99
100 void ContextLifecycleNotifier::notifyStoppingActiveDOMObjects() 89 void ContextLifecycleNotifier::notifyStoppingActiveDOMObjects()
101 { 90 {
102 TemporaryChange<IterationType> scope(this->m_iterating, IteratingOverActiveD OMObjects); 91 TemporaryChange<IterationType> scope(this->m_iterating, IteratingOverActiveD OMObjects);
103 ActiveDOMObjectSet::iterator activeObjectsEnd = m_activeDOMObjects.end(); 92 ActiveDOMObjectSet::iterator activeObjectsEnd = m_activeDOMObjects.end();
104 for (ActiveDOMObjectSet::iterator iter = m_activeDOMObjects.begin(); iter != activeObjectsEnd; ++iter) { 93 for (ActiveDOMObjectSet::iterator iter = m_activeDOMObjects.begin(); iter != activeObjectsEnd; ++iter) {
105 ASSERT((*iter)->executionContext() == context()); 94 ASSERT((*iter)->executionContext() == context());
106 ASSERT((*iter)->suspendIfNeededCalled()); 95 ASSERT((*iter)->suspendIfNeededCalled());
107 (*iter)->stop(); 96 (*iter)->stop();
108 } 97 }
109 } 98 }
110 99
111 bool ContextLifecycleNotifier::hasPendingActivity() const 100 bool ContextLifecycleNotifier::hasPendingActivity() const
112 { 101 {
113 ActiveDOMObjectSet::const_iterator activeObjectsEnd = activeDOMObjects().end (); 102 ActiveDOMObjectSet::const_iterator activeObjectsEnd = activeDOMObjects().end ();
114 for (ActiveDOMObjectSet::const_iterator iter = activeDOMObjects().begin(); i ter != activeObjectsEnd; ++iter) { 103 for (ActiveDOMObjectSet::const_iterator iter = activeDOMObjects().begin(); i ter != activeObjectsEnd; ++iter) {
115 if ((*iter)->hasPendingActivity()) 104 if ((*iter)->hasPendingActivity())
116 return true; 105 return true;
117 } 106 }
118 107
119 return false; 108 return false;
120 } 109 }
121 110
122 } // namespace WebCore 111 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698