Title: [98795] trunk/Source/WebCore
- Revision
- 98795
- Author
- [email protected]
- Date
- 2011-10-28 22:51:51 -0700 (Fri, 28 Oct 2011)
Log Message
MessagePort should be a ContextDestructionObserver
https://bugs.webkit.org/show_bug.cgi?id=71167
Reviewed by Eric Seidel.
I couldn't quite get rid of all the uses of the
ScriptExecutionContext::m_messagePorts in this patch. I hope to get
rid of them in the future as the "extra data" design for
ScriptExecutionContext emerges.
* dom/ActiveDOMObject.cpp:
(WebCore::ContextDestructionObserver::contextDestroyed):
* dom/MessagePort.cpp:
(WebCore::MessagePort::MessagePort):
(WebCore::MessagePort::contextDestroyed):
* dom/MessagePort.h:
* dom/ScriptExecutionContext.cpp:
(WebCore::ScriptExecutionContext::~ScriptExecutionContext):
(WebCore::ScriptExecutionContext::closeMessagePorts):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (98794 => 98795)
--- trunk/Source/WebCore/ChangeLog 2011-10-29 05:27:07 UTC (rev 98794)
+++ trunk/Source/WebCore/ChangeLog 2011-10-29 05:51:51 UTC (rev 98795)
@@ -1,3 +1,25 @@
+2011-10-28 Adam Barth <[email protected]>
+
+ MessagePort should be a ContextDestructionObserver
+ https://bugs.webkit.org/show_bug.cgi?id=71167
+
+ Reviewed by Eric Seidel.
+
+ I couldn't quite get rid of all the uses of the
+ ScriptExecutionContext::m_messagePorts in this patch. I hope to get
+ rid of them in the future as the "extra data" design for
+ ScriptExecutionContext emerges.
+
+ * dom/ActiveDOMObject.cpp:
+ (WebCore::ContextDestructionObserver::contextDestroyed):
+ * dom/MessagePort.cpp:
+ (WebCore::MessagePort::MessagePort):
+ (WebCore::MessagePort::contextDestroyed):
+ * dom/MessagePort.h:
+ * dom/ScriptExecutionContext.cpp:
+ (WebCore::ScriptExecutionContext::~ScriptExecutionContext):
+ (WebCore::ScriptExecutionContext::closeMessagePorts):
+
2011-10-28 Ryosuke Niwa <[email protected]>
The copy and paste result in nested scrollbars on http://dojotoolkit.org/widgets
Modified: trunk/Source/WebCore/dom/ActiveDOMObject.cpp (98794 => 98795)
--- trunk/Source/WebCore/dom/ActiveDOMObject.cpp 2011-10-29 05:27:07 UTC (rev 98794)
+++ trunk/Source/WebCore/dom/ActiveDOMObject.cpp 2011-10-29 05:51:51 UTC (rev 98795)
@@ -54,6 +54,7 @@
void ContextDestructionObserver::contextDestroyed()
{
+ ASSERT(m_scriptExecutionContext);
m_scriptExecutionContext = 0;
}
Modified: trunk/Source/WebCore/dom/MessagePort.cpp (98794 => 98795)
--- trunk/Source/WebCore/dom/MessagePort.cpp 2011-10-29 05:27:07 UTC (rev 98794)
+++ trunk/Source/WebCore/dom/MessagePort.cpp 2011-10-29 05:51:51 UTC (rev 98795)
@@ -41,9 +41,9 @@
namespace WebCore {
MessagePort::MessagePort(ScriptExecutionContext& scriptExecutionContext)
- : m_started(false)
+ : ContextDestructionObserver(&scriptExecutionContext)
+ , m_started(false)
, m_closed(false)
- , m_scriptExecutionContext(&scriptExecutionContext)
{
m_scriptExecutionContext->createdMessagePort(this);
@@ -152,11 +152,10 @@
void MessagePort::contextDestroyed()
{
- ASSERT(m_scriptExecutionContext);
// Must be closed before blowing away the cached context, to ensure that we get no more calls to messageAvailable().
// ScriptExecutionContext::closeMessagePorts() takes care of that.
ASSERT(m_closed);
- m_scriptExecutionContext = 0;
+ ContextDestructionObserver::contextDestroyed();
}
const AtomicString& MessagePort::interfaceName() const
Modified: trunk/Source/WebCore/dom/MessagePort.h (98794 => 98795)
--- trunk/Source/WebCore/dom/MessagePort.h 2011-10-29 05:27:07 UTC (rev 98794)
+++ trunk/Source/WebCore/dom/MessagePort.h 2011-10-29 05:51:51 UTC (rev 98795)
@@ -27,6 +27,7 @@
#ifndef MessagePort_h
#define MessagePort_h
+#include "ActiveDOMObject.h"
#include "EventListener.h"
#include "EventTarget.h"
#include "MessagePortChannel.h"
@@ -52,7 +53,7 @@
// setPendingActivity / unsetPendingActivity instead of duplicating
// ActiveDOMObject's features and relying on _javascript_ garbage collection
// to get its lifetime right.
- class MessagePort : public RefCounted<MessagePort>, public EventTarget {
+ class MessagePort : public RefCounted<MessagePort>, public EventTarget, public ContextDestructionObserver {
public:
static PassRefPtr<MessagePort> create(ScriptExecutionContext& scriptExecutionContext) { return adoptRef(new MessagePort(scriptExecutionContext)); }
~MessagePort();
@@ -121,7 +122,6 @@
bool m_started;
bool m_closed;
- ScriptExecutionContext* m_scriptExecutionContext;
EventTargetData m_eventTargetData;
};
Modified: trunk/Source/WebCore/dom/ScriptExecutionContext.cpp (98794 => 98795)
--- trunk/Source/WebCore/dom/ScriptExecutionContext.cpp 2011-10-29 05:27:07 UTC (rev 98794)
+++ trunk/Source/WebCore/dom/ScriptExecutionContext.cpp 2011-10-29 05:51:51 UTC (rev 98795)
@@ -112,11 +112,6 @@
observer->contextDestroyed();
}
- HashSet<MessagePort*>::iterator messagePortsEnd = m_messagePorts.end();
- for (HashSet<MessagePort*>::iterator iter = m_messagePorts.begin(); iter != messagePortsEnd; ++iter) {
- ASSERT((*iter)->scriptExecutionContext() == this);
- (*iter)->contextDestroyed();
- }
#if ENABLE(SQL_DATABASE)
if (m_databaseThread) {
ASSERT(m_databaseThread->terminationRequested());
@@ -300,7 +295,8 @@
m_destructionObservers.remove(observer);
}
-void ScriptExecutionContext::closeMessagePorts() {
+void ScriptExecutionContext::closeMessagePorts()
+{
HashSet<MessagePort*>::iterator messagePortsEnd = m_messagePorts.end();
for (HashSet<MessagePort*>::iterator iter = m_messagePorts.begin(); iter != messagePortsEnd; ++iter) {
ASSERT((*iter)->scriptExecutionContext() == this);
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes