Changeset 98795 in webkit
- Timestamp:
- Oct 28, 2011, 10:51:51 PM (15 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 5 edited
-
ChangeLog (modified) (1 diff)
-
dom/ActiveDOMObject.cpp (modified) (1 diff)
-
dom/MessagePort.cpp (modified) (2 diffs)
-
dom/MessagePort.h (modified) (3 diffs)
-
dom/ScriptExecutionContext.cpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r98794 r98795 1 2011-10-28 Adam Barth <abarth@webkit.org> 2 3 MessagePort should be a ContextDestructionObserver 4 https://bugs.webkit.org/show_bug.cgi?id=71167 5 6 Reviewed by Eric Seidel. 7 8 I couldn't quite get rid of all the uses of the 9 ScriptExecutionContext::m_messagePorts in this patch. I hope to get 10 rid of them in the future as the "extra data" design for 11 ScriptExecutionContext emerges. 12 13 * dom/ActiveDOMObject.cpp: 14 (WebCore::ContextDestructionObserver::contextDestroyed): 15 * dom/MessagePort.cpp: 16 (WebCore::MessagePort::MessagePort): 17 (WebCore::MessagePort::contextDestroyed): 18 * dom/MessagePort.h: 19 * dom/ScriptExecutionContext.cpp: 20 (WebCore::ScriptExecutionContext::~ScriptExecutionContext): 21 (WebCore::ScriptExecutionContext::closeMessagePorts): 22 1 23 2011-10-28 Ryosuke Niwa <rniwa@webkit.org> 2 24 -
trunk/Source/WebCore/dom/ActiveDOMObject.cpp
r98784 r98795 55 55 void ContextDestructionObserver::contextDestroyed() 56 56 { 57 ASSERT(m_scriptExecutionContext); 57 58 m_scriptExecutionContext = 0; 58 59 } -
trunk/Source/WebCore/dom/MessagePort.cpp
r98388 r98795 42 42 43 43 MessagePort::MessagePort(ScriptExecutionContext& scriptExecutionContext) 44 : m_started(false) 44 : ContextDestructionObserver(&scriptExecutionContext) 45 , m_started(false) 45 46 , m_closed(false) 46 , m_scriptExecutionContext(&scriptExecutionContext)47 47 { 48 48 m_scriptExecutionContext->createdMessagePort(this); … … 153 153 void MessagePort::contextDestroyed() 154 154 { 155 ASSERT(m_scriptExecutionContext);156 155 // Must be closed before blowing away the cached context, to ensure that we get no more calls to messageAvailable(). 157 156 // ScriptExecutionContext::closeMessagePorts() takes care of that. 158 157 ASSERT(m_closed); 159 m_scriptExecutionContext = 0;158 ContextDestructionObserver::contextDestroyed(); 160 159 } 161 160 -
trunk/Source/WebCore/dom/MessagePort.h
r98388 r98795 28 28 #define MessagePort_h 29 29 30 #include "ActiveDOMObject.h" 30 31 #include "EventListener.h" 31 32 #include "EventTarget.h" … … 53 54 // ActiveDOMObject's features and relying on JavaScript garbage collection 54 55 // to get its lifetime right. 55 class MessagePort : public RefCounted<MessagePort>, public EventTarget {56 class MessagePort : public RefCounted<MessagePort>, public EventTarget, public ContextDestructionObserver { 56 57 public: 57 58 static PassRefPtr<MessagePort> create(ScriptExecutionContext& scriptExecutionContext) { return adoptRef(new MessagePort(scriptExecutionContext)); } … … 122 123 bool m_closed; 123 124 124 ScriptExecutionContext* m_scriptExecutionContext;125 125 EventTargetData m_eventTargetData; 126 126 }; -
trunk/Source/WebCore/dom/ScriptExecutionContext.cpp
r98787 r98795 113 113 } 114 114 115 HashSet<MessagePort*>::iterator messagePortsEnd = m_messagePorts.end();116 for (HashSet<MessagePort*>::iterator iter = m_messagePorts.begin(); iter != messagePortsEnd; ++iter) {117 ASSERT((*iter)->scriptExecutionContext() == this);118 (*iter)->contextDestroyed();119 }120 115 #if ENABLE(SQL_DATABASE) 121 116 if (m_databaseThread) { … … 301 296 } 302 297 303 void ScriptExecutionContext::closeMessagePorts() { 298 void ScriptExecutionContext::closeMessagePorts() 299 { 304 300 HashSet<MessagePort*>::iterator messagePortsEnd = m_messagePorts.end(); 305 301 for (HashSet<MessagePort*>::iterator iter = m_messagePorts.begin(); iter != messagePortsEnd; ++iter) {
Note:
See TracChangeset
for help on using the changeset viewer.