Skip to content
Permalink
Browse files
2011-04-12 Anders Carlsson <andersca@apple.com>
        Reviewed by Sam Weinig.

        Cache the window and plug-in element NPObjects
        https://bugs.webkit.org/show_bug.cgi?id=58355

        * PluginProcess/PluginControllerProxy.cpp:
        (WebKit::PluginControllerProxy::PluginControllerProxy):
        (WebKit::PluginControllerProxy::~PluginControllerProxy):
        (WebKit::PluginControllerProxy::windowScriptNPObject):
        (WebKit::PluginControllerProxy::pluginElementNPObject):
        * PluginProcess/PluginControllerProxy.h:


Canonical link: https://commits.webkit.org/73382@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@83622 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
Anders Carlsson committed Apr 12, 2011
1 parent 7888c15 commit d9e887fc8134d44e256635cb3329f9544622b7fe
Showing 3 changed files with 52 additions and 12 deletions.
@@ -1,3 +1,17 @@
2011-04-12 Anders Carlsson <andersca@apple.com>

Reviewed by Sam Weinig.

Cache the window and plug-in element NPObjects
https://bugs.webkit.org/show_bug.cgi?id=58355

* PluginProcess/PluginControllerProxy.cpp:
(WebKit::PluginControllerProxy::PluginControllerProxy):
(WebKit::PluginControllerProxy::~PluginControllerProxy):
(WebKit::PluginControllerProxy::windowScriptNPObject):
(WebKit::PluginControllerProxy::pluginElementNPObject):
* PluginProcess/PluginControllerProxy.h:

2011-04-12 Alejandro G. Castro <alex@igalia.com>

Fixed GTK compilation after r83454.
@@ -65,12 +65,20 @@ PluginControllerProxy::PluginControllerProxy(WebProcessConnection* connection, u
#if PLATFORM(MAC)
, m_isComplexTextInputEnabled(false)
#endif
, m_windowNPObject(0)
, m_pluginElementNPObject(0)
{
}

PluginControllerProxy::~PluginControllerProxy()
{
ASSERT(!m_plugin);

if (m_windowNPObject)
releaseNPObject(m_windowNPObject);

if (m_pluginElementNPObject)
releaseNPObject(m_pluginElementNPObject);
}

bool PluginControllerProxy::initialize(const Plugin::Parameters& parameters)
@@ -210,28 +218,40 @@ void PluginControllerProxy::cancelManualStreamLoad()

NPObject* PluginControllerProxy::windowScriptNPObject()
{
uint64_t windowScriptNPObjectID = 0;
if (!m_windowNPObject) {
uint64_t windowScriptNPObjectID = 0;

if (!m_connection->connection()->sendSync(Messages::PluginProxy::GetWindowScriptNPObject(), Messages::PluginProxy::GetWindowScriptNPObject::Reply(windowScriptNPObjectID), m_pluginInstanceID))
return 0;

if (!m_connection->connection()->sendSync(Messages::PluginProxy::GetWindowScriptNPObject(), Messages::PluginProxy::GetWindowScriptNPObject::Reply(windowScriptNPObjectID), m_pluginInstanceID))
return 0;
if (!windowScriptNPObjectID)
return 0;

if (!windowScriptNPObjectID)
return 0;
m_windowNPObject = m_connection->npRemoteObjectMap()->createNPObjectProxy(windowScriptNPObjectID, m_plugin.get());
ASSERT(m_windowNPObject);
}

return m_connection->npRemoteObjectMap()->createNPObjectProxy(windowScriptNPObjectID, m_plugin.get());
retainNPObject(m_windowNPObject);
return m_windowNPObject;
}

NPObject* PluginControllerProxy::pluginElementNPObject()
{
uint64_t pluginElementNPObjectID = 0;
if (!m_pluginElementNPObject) {
uint64_t pluginElementNPObjectID = 0;

if (!m_connection->connection()->sendSync(Messages::PluginProxy::GetPluginElementNPObject(), Messages::PluginProxy::GetPluginElementNPObject::Reply(pluginElementNPObjectID), m_pluginInstanceID))
return 0;

if (!m_connection->connection()->sendSync(Messages::PluginProxy::GetPluginElementNPObject(), Messages::PluginProxy::GetPluginElementNPObject::Reply(pluginElementNPObjectID), m_pluginInstanceID))
return 0;
if (!pluginElementNPObjectID)
return 0;

if (!pluginElementNPObjectID)
return 0;
m_pluginElementNPObject = m_connection->npRemoteObjectMap()->createNPObjectProxy(pluginElementNPObjectID, m_plugin.get());
ASSERT(m_pluginElementNPObject);
}

return m_connection->npRemoteObjectMap()->createNPObjectProxy(pluginElementNPObjectID, m_plugin.get());
retainNPObject(m_pluginElementNPObject);
return m_pluginElementNPObject;
}

bool PluginControllerProxy::evaluate(NPObject* npObject, const String& scriptString, NPVariant* result, bool allowPopups)
@@ -182,6 +182,12 @@ class PluginControllerProxy : PluginController {

// The backing store that this plug-in draws into.
RefPtr<ShareableBitmap> m_backingStore;

// The window NPObject.
NPObject* m_windowNPObject;

// The plug-in element NPObject.
NPObject* m_pluginElementNPObject;
};

} // namespace WebKit

0 comments on commit d9e887f

Please sign in to comment.