[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc
andersca at apple.com
andersca at apple.com
Wed Dec 22 15:23:37 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit b803de586b55bdeef190cc49608337ca83c6fd09
Author: andersca at apple.com <andersca at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Tue Nov 2 18:39:05 2010 +0000
Invalidate the NPRemoteObjectMap
https://bugs.webkit.org/show_bug.cgi?id=48856
Reviewed by John Sullivan.
* Shared/Plugins/NPObjectMessageReceiver.cpp:
(WebKit::NPObjectMessageReceiver::~NPObjectMessageReceiver):
Remove FIXME. The NPRemoteObjectMap always outlives the NPObjectMessageReceiver.
* Shared/Plugins/NPObjectProxy.cpp:
(WebKit::NPObjectProxy::~NPObjectProxy):
Call npObjectProxyDestroyed here.
(WebKit::NPObjectProxy::invalidate):
Null out m_npRemoteObjectMap.
* Shared/Plugins/NPRemoteObjectMap.cpp:
(WebKit::NPRemoteObjectMap::~NPRemoteObjectMap):
Add assertions.
(WebKit::NPRemoteObjectMap::createNPObjectProxy):
Keep track of the NPObjectProxy by adding it to the m_npObjectProxies set.
(WebKit::NPRemoteObjectMap::npObjectProxyDestroyed):
Remove the NPObjectProxy from the m_npObjectProxies set.
(WebKit::NPRemoteObjectMap::invalidate):
Delete all NPObjectMessageReceivers. Iterate over all NPObjectProxy objects and invalidate them.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@71140 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebKit2/ChangeLog b/WebKit2/ChangeLog
index 6283733..1f03f3e 100644
--- a/WebKit2/ChangeLog
+++ b/WebKit2/ChangeLog
@@ -1,3 +1,34 @@
+2010-11-02 Anders Carlsson <andersca at apple.com>
+
+ Reviewed by John Sullivan.
+
+ Invalidate the NPRemoteObjectMap
+ https://bugs.webkit.org/show_bug.cgi?id=48856
+
+ * Shared/Plugins/NPObjectMessageReceiver.cpp:
+ (WebKit::NPObjectMessageReceiver::~NPObjectMessageReceiver):
+ Remove FIXME. The NPRemoteObjectMap always outlives the NPObjectMessageReceiver.
+
+ * Shared/Plugins/NPObjectProxy.cpp:
+ (WebKit::NPObjectProxy::~NPObjectProxy):
+ Call npObjectProxyDestroyed here.
+
+ (WebKit::NPObjectProxy::invalidate):
+ Null out m_npRemoteObjectMap.
+
+ * Shared/Plugins/NPRemoteObjectMap.cpp:
+ (WebKit::NPRemoteObjectMap::~NPRemoteObjectMap):
+ Add assertions.
+
+ (WebKit::NPRemoteObjectMap::createNPObjectProxy):
+ Keep track of the NPObjectProxy by adding it to the m_npObjectProxies set.
+
+ (WebKit::NPRemoteObjectMap::npObjectProxyDestroyed):
+ Remove the NPObjectProxy from the m_npObjectProxies set.
+
+ (WebKit::NPRemoteObjectMap::invalidate):
+ Delete all NPObjectMessageReceivers. Iterate over all NPObjectProxy objects and invalidate them.
+
2010-11-02 Mike Thole <mthole at apple.com>
Reviewed by Anders Carlsson.
diff --git a/WebKit2/Shared/Plugins/NPObjectMessageReceiver.cpp b/WebKit2/Shared/Plugins/NPObjectMessageReceiver.cpp
index db3d178..6df0fd9 100644
--- a/WebKit2/Shared/Plugins/NPObjectMessageReceiver.cpp
+++ b/WebKit2/Shared/Plugins/NPObjectMessageReceiver.cpp
@@ -50,7 +50,6 @@ NPObjectMessageReceiver::NPObjectMessageReceiver(NPRemoteObjectMap* npRemoteObje
NPObjectMessageReceiver::~NPObjectMessageReceiver()
{
- // FIXME: The remote object map might be destroyed here.
m_npRemoteObjectMap->unregisterNPObject(m_npObjectID);
releaseNPObject(m_npObject);
diff --git a/WebKit2/Shared/Plugins/NPObjectProxy.cpp b/WebKit2/Shared/Plugins/NPObjectProxy.cpp
index 126189d..036392c 100644
--- a/WebKit2/Shared/Plugins/NPObjectProxy.cpp
+++ b/WebKit2/Shared/Plugins/NPObjectProxy.cpp
@@ -56,6 +56,7 @@ NPObjectProxy::~NPObjectProxy()
if (!m_npRemoteObjectMap)
return;
+ m_npRemoteObjectMap->npObjectProxyDestroyed(this);
m_npRemoteObjectMap->connection()->sendSync(Messages::NPObjectMessageReceiver::Deallocate(), Messages::NPObjectMessageReceiver::Deallocate::Reply(), m_npObjectID);
}
@@ -63,6 +64,13 @@ bool NPObjectProxy::isNPObjectProxy(NPObject* npObject)
{
return npObject->_class == npClass();
}
+
+void NPObjectProxy::invalidate()
+{
+ ASSERT(m_npRemoteObjectMap);
+
+ m_npRemoteObjectMap = 0;
+}
void NPObjectProxy::initialize(NPRemoteObjectMap* npRemoteObjectMap, uint64_t npObjectID)
{
diff --git a/WebKit2/Shared/Plugins/NPObjectProxy.h b/WebKit2/Shared/Plugins/NPObjectProxy.h
index a793ee0..6bc5c49 100644
--- a/WebKit2/Shared/Plugins/NPObjectProxy.h
+++ b/WebKit2/Shared/Plugins/NPObjectProxy.h
@@ -48,7 +48,9 @@ public:
ASSERT(isNPObjectProxy(npObject));
return static_cast<NPObjectProxy*>(npObject);
}
-
+
+ void invalidate();
+
private:
NPObjectProxy();
~NPObjectProxy();
diff --git a/WebKit2/Shared/Plugins/NPRemoteObjectMap.cpp b/WebKit2/Shared/Plugins/NPRemoteObjectMap.cpp
index 04e42b7..5f0879a 100644
--- a/WebKit2/Shared/Plugins/NPRemoteObjectMap.cpp
+++ b/WebKit2/Shared/Plugins/NPRemoteObjectMap.cpp
@@ -53,11 +53,25 @@ NPRemoteObjectMap::NPRemoteObjectMap(CoreIPC::Connection* connection)
NPRemoteObjectMap::~NPRemoteObjectMap()
{
+ ASSERT(m_npObjectProxies.isEmpty());
+ ASSERT(m_registeredNPObjects.isEmpty());
}
NPObject* NPRemoteObjectMap::createNPObjectProxy(uint64_t remoteObjectID)
{
- return NPObjectProxy::create(this, remoteObjectID);
+ NPObjectProxy* npObjectProxy = NPObjectProxy::create(this, remoteObjectID);
+
+ m_npObjectProxies.add(npObjectProxy);
+
+ return npObjectProxy;
+}
+
+void NPRemoteObjectMap::npObjectProxyDestroyed(NPObject* npObject)
+{
+ ASSERT(NPObjectProxy::isNPObjectProxy(npObject));
+ ASSERT(m_npObjectProxies.contains(npObject));
+
+ m_npObjectProxies.remove(npObject);
}
uint64_t NPRemoteObjectMap::registerNPObject(NPObject* npObject)
@@ -118,8 +132,17 @@ NPVariant NPRemoteObjectMap::npVariantDataToNPVariant(const NPVariantData& npVar
void NPRemoteObjectMap::invalidate()
{
- // FIXME: Invalidate NPObjectProxy and NPObjectMessageReceiver objects.
- notImplemented();
+ Vector<NPObjectMessageReceiver*> messageReceivers;
+ copyValuesToVector(m_registeredNPObjects, messageReceivers);
+
+ // Now delete all the receivers.
+ deleteAllValues(messageReceivers);
+
+ ASSERT(m_registeredNPObjects.isEmpty());
+
+ for (HashSet<NPObject*>::const_iterator it = m_npObjectProxies.begin(), end = m_npObjectProxies.end(); it != end; ++it)
+ NPObjectProxy::toNPObjectProxy(*it)->invalidate();
+ m_npObjectProxies.clear();
}
CoreIPC::SyncReplyMode NPRemoteObjectMap::didReceiveSyncMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* arguments, CoreIPC::ArgumentEncoder* reply)
diff --git a/WebKit2/Shared/Plugins/NPRemoteObjectMap.h b/WebKit2/Shared/Plugins/NPRemoteObjectMap.h
index 535ecd4..1a731ea 100644
--- a/WebKit2/Shared/Plugins/NPRemoteObjectMap.h
+++ b/WebKit2/Shared/Plugins/NPRemoteObjectMap.h
@@ -31,6 +31,7 @@
#include "Connection.h"
#include <WebCore/npruntime.h>
#include <wtf/HashMap.h>
+#include <wtf/HashSet.h>
#include <wtf/RefCounted.h>
namespace WebKit {
@@ -46,6 +47,7 @@ public:
// Creates an NPObjectProxy wrapper for the remote object with the given remote object ID.
NPObject* createNPObjectProxy(uint64_t remoteObjectID);
+ void npObjectProxyDestroyed(NPObject*);
// Expose the given NPObject as a remote object. Returns the objectID.
uint64_t registerNPObject(NPObject*);
@@ -70,6 +72,9 @@ private:
// A map of NPObjectMessageReceiver classes, wrapping objects that we export to the
// other end of the connection.
HashMap<uint64_t, NPObjectMessageReceiver*> m_registeredNPObjects;
+
+ // A set of NPObjectProxy objects associated with this map.
+ HashSet<NPObject*> m_npObjectProxies;
};
} // namespace WebKit
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list