Commit 40057f5f authored by andersca's avatar andersca
Browse files

Reviewed by Geoff.

        Store the root object in a hash set, keyed by the plugin view. This is in preparation for 
        letting plugins invalidate the root object upon destruction

        * page/Frame.cpp:
        (WebCore::Frame::createRootObject):
        (WebCore::Frame::cleanupScriptObjects):
        * page/FramePrivate.h:



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@22071 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 19194d17
2007-06-08 Anders Carlsson <andersca@apple.com>
Reviewed by Geoff.
Store the root object in a hash set, keyed by the plugin view. This is in preparation for
letting plugins invalidate the root object upon destruction
* page/Frame.cpp:
(WebCore::Frame::createRootObject):
(WebCore::Frame::cleanupScriptObjects):
* page/FramePrivate.h:
2007-06-08 Lars Knoll <lars@trolltech.com>
 
Reviewed by Zack.
......@@ -1061,8 +1061,13 @@ KJS::Bindings::RootObject* Frame::bindingRootObject()
PassRefPtr<KJS::Bindings::RootObject> Frame::createRootObject(void* nativeHandle, PassRefPtr<KJS::Interpreter> interpreter)
{
RootObjectMap::iterator it = d->m_rootObjects.find(nativeHandle);
if (it != d->m_rootObjects.end())
return it->second;
RefPtr<KJS::Bindings::RootObject> rootObject = KJS::Bindings::RootObject::create(nativeHandle, interpreter);
d->m_rootObjects.append(rootObject);
d->m_rootObjects.set(nativeHandle, rootObject);
return rootObject.release();
}
......@@ -1091,10 +1096,11 @@ void Frame::cleanupScriptObjects()
{
cleanupPlatformScriptObjects();
JSLock lock;
unsigned count = d->m_rootObjects.size();
for (unsigned i = 0; i < count; i++)
d->m_rootObjects[i]->invalidate();
RootObjectMap::const_iterator end = d->m_rootObjects.end();
for (RootObjectMap::const_iterator it = d->m_rootObjects.begin(); it != end; ++it)
it->second->invalidate();
d->m_rootObjects.clear();
if (d->m_bindingRootObject) {
......
......@@ -63,6 +63,8 @@ namespace WebCore {
class UserStyleSheetLoader;
typedef HashMap<void*, RefPtr<KJS::Bindings::RootObject> > RootObjectMap;
class FramePrivate {
public:
FramePrivate(Page*, Frame* parent, Frame* thisFrame, HTMLFrameOwnerElement*, FrameLoaderClient*);
......@@ -122,7 +124,7 @@ namespace WebCore {
// The root object used for objects bound outside the context of a plugin.
RefPtr<KJS::Bindings::RootObject> m_bindingRootObject;
Vector<RefPtr<KJS::Bindings::RootObject> > m_rootObjects;
RootObjectMap m_rootObjects;
NPObject* m_windowScriptNPObject;
#if PLATFORM(MAC)
WebScriptObject* m_windowScriptObject;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment