diff options
author | Steve Block <steveblock@google.com> | 2011-05-25 19:08:45 +0100 |
---|---|---|
committer | Steve Block <steveblock@google.com> | 2011-06-08 13:51:31 +0100 |
commit | 2bde8e466a4451c7319e3a072d118917957d6554 (patch) | |
tree | 28f4a1b869a513e565c7760d0e6a06e7cf1fe95a /Source/WebKit2/WebProcess/Plugins/PluginProxy.cpp | |
parent | 6939c99b71d9372d14a0c74a772108052e8c48c8 (diff) | |
download | external_webkit-2bde8e466a4451c7319e3a072d118917957d6554.zip external_webkit-2bde8e466a4451c7319e3a072d118917957d6554.tar.gz external_webkit-2bde8e466a4451c7319e3a072d118917957d6554.tar.bz2 |
Merge WebKit at r82507: Initial merge by git
Change-Id: I60ce9d780725b58b45e54165733a8ffee23b683e
Diffstat (limited to 'Source/WebKit2/WebProcess/Plugins/PluginProxy.cpp')
-rw-r--r-- | Source/WebKit2/WebProcess/Plugins/PluginProxy.cpp | 50 |
1 files changed, 30 insertions, 20 deletions
diff --git a/Source/WebKit2/WebProcess/Plugins/PluginProxy.cpp b/Source/WebKit2/WebProcess/Plugins/PluginProxy.cpp index f267d9e..fc8f552 100644 --- a/Source/WebKit2/WebProcess/Plugins/PluginProxy.cpp +++ b/Source/WebKit2/WebProcess/Plugins/PluginProxy.cpp @@ -132,7 +132,8 @@ void PluginProxy::paint(GraphicsContext* graphicsContext, const IntRect& dirtyRe // Blit the plug-in backing store into our own backing store. OwnPtr<WebCore::GraphicsContext> graphicsContext = m_backingStore->createGraphicsContext(); - + graphicsContext->setCompositeOperation(CompositeCopy); + m_pluginBackingStore->paint(*graphicsContext, IntPoint(), IntRect(0, 0, m_frameRect.width(), m_frameRect.height())); m_pluginBackingStoreContainsValidData = true; @@ -152,14 +153,20 @@ void PluginProxy::paint(GraphicsContext* graphicsContext, const IntRect& dirtyRe PassRefPtr<ShareableBitmap> PluginProxy::snapshot() { - IntSize bufferSize; - SharedMemory::Handle snapshotStoreHandle; - m_connection->connection()->sendSync(Messages::PluginControllerProxy::Snapshot(), Messages::PluginControllerProxy::Snapshot::Reply(bufferSize, snapshotStoreHandle), m_pluginInstanceID); + ShareableBitmap::Handle snapshotStoreHandle; + m_connection->connection()->sendSync(Messages::PluginControllerProxy::Snapshot(), Messages::PluginControllerProxy::Snapshot::Reply(snapshotStoreHandle), m_pluginInstanceID); - RefPtr<ShareableBitmap> snapshotBuffer = ShareableBitmap::create(bufferSize, snapshotStoreHandle); + RefPtr<ShareableBitmap> snapshotBuffer = ShareableBitmap::create(snapshotStoreHandle); return snapshotBuffer.release(); } +bool PluginProxy::isTransparent() +{ + // This should never be called from the web process. + ASSERT_NOT_REACHED(); + return false; +} + void PluginProxy::geometryDidChange(const IntRect& frameRect, const IntRect& clipRect) { ASSERT(m_isStarted); @@ -167,14 +174,14 @@ void PluginProxy::geometryDidChange(const IntRect& frameRect, const IntRect& cli m_frameRect = frameRect; if (!needsBackingStore()) { - SharedMemory::Handle pluginBackingStoreHandle; - m_connection->connection()->send(Messages::PluginControllerProxy::GeometryDidChange(frameRect, clipRect, pluginBackingStoreHandle), m_pluginInstanceID); + ShareableBitmap::Handle pluginBackingStoreHandle; + m_connection->connection()->send(Messages::PluginControllerProxy::GeometryDidChange(frameRect, clipRect, pluginBackingStoreHandle), m_pluginInstanceID, CoreIPC::DispatchMessageEvenWhenWaitingForSyncReply); return; } bool didUpdateBackingStore = false; if (!m_backingStore) { - m_backingStore = ShareableBitmap::create(frameRect.size()); + m_backingStore = ShareableBitmap::create(frameRect.size(), ShareableBitmap::SupportsAlpha); didUpdateBackingStore = true; } else if (frameRect.size() != m_backingStore->size()) { // The backing store already exists, just resize it. @@ -184,24 +191,24 @@ void PluginProxy::geometryDidChange(const IntRect& frameRect, const IntRect& cli didUpdateBackingStore = true; } - SharedMemory::Handle pluginBackingStoreHandle; + ShareableBitmap::Handle pluginBackingStoreHandle; if (didUpdateBackingStore) { // Create a new plug-in backing store. - m_pluginBackingStore = ShareableBitmap::createShareable(frameRect.size()); + m_pluginBackingStore = ShareableBitmap::createShareable(frameRect.size(), ShareableBitmap::SupportsAlpha); if (!m_pluginBackingStore) return; // Create a handle to the plug-in backing store so we can send it over. if (!m_pluginBackingStore->createHandle(pluginBackingStoreHandle)) { - m_pluginBackingStore.clear(); + m_pluginBackingStore = nullptr; return; } m_pluginBackingStoreContainsValidData = false; } - m_connection->connection()->send(Messages::PluginControllerProxy::GeometryDidChange(frameRect, clipRect, pluginBackingStoreHandle), m_pluginInstanceID); + m_connection->connection()->send(Messages::PluginControllerProxy::GeometryDidChange(frameRect, clipRect, pluginBackingStoreHandle), m_pluginInstanceID, CoreIPC::DispatchMessageEvenWhenWaitingForSyncReply); } void PluginProxy::frameDidFinishLoading(uint64_t requestID) @@ -319,7 +326,7 @@ NPObject* PluginProxy::pluginScriptableNPObject() if (!pluginScriptableNPObjectID) return 0; - return m_connection->npRemoteObjectMap()->createNPObjectProxy(pluginScriptableNPObjectID); + return m_connection->npRemoteObjectMap()->createNPObjectProxy(pluginScriptableNPObjectID, this); } #if PLATFORM(MAC) @@ -388,7 +395,7 @@ void PluginProxy::getWindowScriptNPObject(uint64_t& windowScriptNPObjectID) return; } - windowScriptNPObjectID = m_connection->npRemoteObjectMap()->registerNPObject(windowScriptNPObject); + windowScriptNPObjectID = m_connection->npRemoteObjectMap()->registerNPObject(windowScriptNPObject, this); releaseNPObject(windowScriptNPObject); } @@ -400,7 +407,7 @@ void PluginProxy::getPluginElementNPObject(uint64_t& pluginElementNPObjectID) return; } - pluginElementNPObjectID = m_connection->npRemoteObjectMap()->registerNPObject(pluginElementNPObject); + pluginElementNPObjectID = m_connection->npRemoteObjectMap()->registerNPObject(pluginElementNPObject, this); releaseNPObject(pluginElementNPObject); } @@ -408,16 +415,19 @@ void PluginProxy::evaluate(const NPVariantData& npObjectAsVariantData, const Str { PluginController::PluginDestructionProtector protector(m_pluginController); - NPVariant npObjectAsVariant = m_connection->npRemoteObjectMap()->npVariantDataToNPVariant(npObjectAsVariantData); - ASSERT(NPVARIANT_IS_OBJECT(npObjectAsVariant)); - + NPVariant npObjectAsVariant = m_connection->npRemoteObjectMap()->npVariantDataToNPVariant(npObjectAsVariantData, this); + if (!NPVARIANT_IS_OBJECT(npObjectAsVariant) || !(NPVARIANT_TO_OBJECT(npObjectAsVariant))) { + returnValue = false; + return; + } + NPVariant result; returnValue = m_pluginController->evaluate(NPVARIANT_TO_OBJECT(npObjectAsVariant), scriptString, &result, allowPopups); if (!returnValue) return; // Convert the NPVariant to an NPVariantData. - resultData = m_connection->npRemoteObjectMap()->npVariantToNPVariantData(result); + resultData = m_connection->npRemoteObjectMap()->npVariantToNPVariantData(result, this); // And release the result. releaseNPVariantValue(&result); @@ -458,7 +468,7 @@ void PluginProxy::update(const IntRect& paintedRect) if (m_backingStore) { // Blit the plug-in backing store into our own backing store. OwnPtr<GraphicsContext> graphicsContext = m_backingStore->createGraphicsContext(); - + graphicsContext->setCompositeOperation(CompositeCopy); m_pluginBackingStore->paint(*graphicsContext, paintedRectPluginCoordinates.location(), paintedRectPluginCoordinates); } |