summaryrefslogtreecommitdiff
path: root/Source/WebKit2/WebProcess/Plugins/PluginProxy.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebKit2/WebProcess/Plugins/PluginProxy.cpp')
-rw-r--r--Source/WebKit2/WebProcess/Plugins/PluginProxy.cpp104
1 files changed, 63 insertions, 41 deletions
diff --git a/Source/WebKit2/WebProcess/Plugins/PluginProxy.cpp b/Source/WebKit2/WebProcess/Plugins/PluginProxy.cpp
index 0f7ec36a2..6b4ddfcc9 100644
--- a/Source/WebKit2/WebProcess/Plugins/PluginProxy.cpp
+++ b/Source/WebKit2/WebProcess/Plugins/PluginProxy.cpp
@@ -43,7 +43,6 @@
#include "WebProcess.h"
#include "WebProcessConnectionMessages.h"
#include <WebCore/GraphicsContext.h>
-#include <WebCore/NotImplemented.h>
#include <WebCore/SharedBuffer.h>
using namespace WebCore;
@@ -56,13 +55,14 @@ static uint64_t generatePluginInstanceID()
return ++uniquePluginInstanceID;
}
-PassRefPtr<PluginProxy> PluginProxy::create(uint64_t pluginProcessToken, bool isRestartedProcess)
+Ref<PluginProxy> PluginProxy::create(uint64_t pluginProcessToken, bool isRestartedProcess)
{
- return adoptRef(new PluginProxy(pluginProcessToken, isRestartedProcess));
+ return adoptRef(*new PluginProxy(pluginProcessToken, isRestartedProcess));
}
PluginProxy::PluginProxy(uint64_t pluginProcessToken, bool isRestartedProcess)
- : m_pluginProcessToken(pluginProcessToken)
+ : Plugin(PluginProxyType)
+ , m_pluginProcessToken(pluginProcessToken)
, m_pluginInstanceID(generatePluginInstanceID())
, m_pluginBackingStoreContainsValidData(false)
, m_isStarted(false)
@@ -86,7 +86,7 @@ void PluginProxy::pluginProcessCrashed()
bool PluginProxy::initialize(const Parameters& parameters)
{
ASSERT(!m_connection);
- m_connection = WebProcess::shared().pluginProcessConnectionManager().getPluginProcessConnection(m_pluginProcessToken);
+ m_connection = WebProcess::singleton().pluginProcessConnectionManager().getPluginProcessConnection(m_pluginProcessToken);
if (!m_connection)
return false;
@@ -96,7 +96,7 @@ bool PluginProxy::initialize(const Parameters& parameters)
m_connection->addPluginProxy(this);
// Ask the plug-in process to create a plug-in.
- m_pendingPluginCreationParameters = adoptPtr(new PluginCreationParameters);
+ m_pendingPluginCreationParameters = std::make_unique<PluginCreationParameters>();
m_pendingPluginCreationParameters->pluginInstanceID = m_pluginInstanceID;
m_pendingPluginCreationParameters->windowNPObjectID = windowNPObjectID();
@@ -104,11 +104,9 @@ bool PluginProxy::initialize(const Parameters& parameters)
m_pendingPluginCreationParameters->userAgent = controller()->userAgent();
m_pendingPluginCreationParameters->contentsScaleFactor = contentsScaleFactor();
m_pendingPluginCreationParameters->isPrivateBrowsingEnabled = controller()->isPrivateBrowsingEnabled();
+ m_pendingPluginCreationParameters->isMuted = controller()->isMuted();
m_pendingPluginCreationParameters->artificialPluginInitializationDelayEnabled = controller()->artificialPluginInitializationDelayEnabled();
-
-#if USE(ACCELERATED_COMPOSITING)
m_pendingPluginCreationParameters->isAcceleratedCompositingEnabled = controller()->isAcceleratedCompositingEnabled();
-#endif
if (!canInitializeAsynchronously())
return initializeSynchronously();
@@ -173,7 +171,7 @@ void PluginProxy::didCreatePluginInternal(bool wantsWheelEvents, uint32_t remote
// Whether synchronously or asynchronously, this plug-in was created and we shouldn't need to remember
// anything about how.
- m_pendingPluginCreationParameters.clear();
+ m_pendingPluginCreationParameters = nullptr;
m_waitingOnAsynchronousInitialization = false;
}
@@ -187,7 +185,7 @@ void PluginProxy::didFailToCreatePluginInternal()
// Whether synchronously or asynchronously, this plug-in failed to create and we shouldn't need to remember
// anything about how.
- m_pendingPluginCreationParameters.clear();
+ m_pendingPluginCreationParameters = nullptr;
m_waitingOnAsynchronousInitialization = false;
}
@@ -202,7 +200,7 @@ void PluginProxy::destroy()
m_connection->removePluginProxy(this);
}
-void PluginProxy::paint(GraphicsContext* graphicsContext, const IntRect& dirtyRect)
+void PluginProxy::paint(GraphicsContext& graphicsContext, const IntRect& dirtyRect)
{
if (!needsBackingStore() || !m_backingStore)
return;
@@ -220,12 +218,11 @@ void PluginProxy::paint(GraphicsContext* graphicsContext, const IntRect& dirtyRe
m_pluginBackingStoreContainsValidData = true;
}
- m_backingStore->paint(*graphicsContext, contentsScaleFactor(), dirtyRect.location(), dirtyRect);
+ m_backingStore->paint(graphicsContext, contentsScaleFactor(), dirtyRect.location(), dirtyRect);
if (m_waitingForPaintInResponseToUpdate) {
m_waitingForPaintInResponseToUpdate = false;
m_connection->connection()->send(Messages::PluginControllerProxy::DidUpdate(), m_pluginInstanceID);
- return;
}
}
@@ -241,16 +238,16 @@ bool PluginProxy::supportsSnapshotting() const
return isSupported;
}
-PassRefPtr<ShareableBitmap> PluginProxy::snapshot()
+RefPtr<ShareableBitmap> PluginProxy::snapshot()
{
ShareableBitmap::Handle snapshotStoreHandle;
m_connection->connection()->sendSync(Messages::PluginControllerProxy::Snapshot(), Messages::PluginControllerProxy::Snapshot::Reply(snapshotStoreHandle), m_pluginInstanceID);
if (snapshotStoreHandle.isNull())
- return 0;
+ return nullptr;
RefPtr<ShareableBitmap> snapshotBuffer = ShareableBitmap::create(snapshotStoreHandle);
- return snapshotBuffer.release();
+ return snapshotBuffer;
}
bool PluginProxy::isTransparent()
@@ -286,7 +283,7 @@ void PluginProxy::geometryDidChange()
m_pluginBackingStoreContainsValidData = false;
}
- m_connection->connection()->send(Messages::PluginControllerProxy::GeometryDidChange(m_pluginSize, m_clipRect, m_pluginToRootViewTransform, contentsScaleFactor(), pluginBackingStoreHandle), m_pluginInstanceID, IPC::DispatchMessageEvenWhenWaitingForSyncReply);
+ m_connection->connection()->send(Messages::PluginControllerProxy::GeometryDidChange(m_pluginSize, m_clipRect, m_pluginToRootViewTransform, contentsScaleFactor(), pluginBackingStoreHandle), m_pluginInstanceID, IPC::SendOption::DispatchMessageEvenWhenWaitingForSyncReply);
}
void PluginProxy::geometryDidChange(const IntSize& pluginSize, const IntRect& clipRect, const AffineTransform& pluginToRootViewTransform)
@@ -324,6 +321,11 @@ void PluginProxy::didEvaluateJavaScript(uint64_t requestID, const WTF::String& r
m_connection->connection()->send(Messages::PluginControllerProxy::DidEvaluateJavaScript(requestID, result), m_pluginInstanceID);
}
+void PluginProxy::streamWillSendRequest(uint64_t streamID, const URL& requestURL, const URL& responseURL, int responseStatus)
+{
+ m_connection->connection()->send(Messages::PluginControllerProxy::StreamWillSendRequest(streamID, requestURL.string(), responseURL.string(), responseStatus), m_pluginInstanceID);
+}
+
void PluginProxy::streamDidReceiveResponse(uint64_t streamID, const URL& responseURL, uint32_t streamLength, uint32_t lastModifiedTime, const WTF::String& mimeType, const WTF::String& headers, const String& /* suggestedFileName */)
{
m_connection->connection()->send(Messages::PluginControllerProxy::StreamDidReceiveResponse(streamID, responseURL.string(), streamLength, lastModifiedTime, mimeType, headers), m_pluginInstanceID);
@@ -369,11 +371,8 @@ bool PluginProxy::handleMouseEvent(const WebMouseEvent& mouseEvent)
if (m_waitingOnAsynchronousInitialization)
return false;
- bool handled = false;
- if (!m_connection->connection()->sendSync(Messages::PluginControllerProxy::HandleMouseEvent(mouseEvent), Messages::PluginControllerProxy::HandleMouseEvent::Reply(handled), m_pluginInstanceID))
- return false;
-
- return handled;
+ m_connection->connection()->send(Messages::PluginControllerProxy::HandleMouseEvent(mouseEvent), m_pluginInstanceID);
+ return true;
}
bool PluginProxy::handleWheelEvent(const WebWheelEvent& wheelEvent)
@@ -459,7 +458,7 @@ bool PluginProxy::isEditingCommandEnabled(const String& commandName)
return enabled;
}
-bool PluginProxy::handlesPageScaleFactor()
+bool PluginProxy::handlesPageScaleFactor() const
{
if (m_waitingOnAsynchronousInitialization)
return false;
@@ -471,6 +470,18 @@ bool PluginProxy::handlesPageScaleFactor()
return handled;
}
+bool PluginProxy::requiresUnifiedScaleFactor() const
+{
+ if (m_waitingOnAsynchronousInitialization)
+ return false;
+
+ bool required = false;
+ if (!m_connection->connection()->sendSync(Messages::PluginControllerProxy::RequiresUnifiedScaleFactor(), Messages::PluginControllerProxy::RequiresUnifiedScaleFactor::Reply(required), m_pluginInstanceID))
+ return false;
+
+ return required;
+}
+
NPObject* PluginProxy::pluginScriptableNPObject()
{
// Sending the synchronous Messages::PluginControllerProxy::GetPluginScriptableNPObject message can cause us to dispatch an
@@ -488,22 +499,21 @@ NPObject* PluginProxy::pluginScriptableNPObject()
return m_connection->npRemoteObjectMap()->createNPObjectProxy(pluginScriptableNPObjectID, this);
}
-#if PLATFORM(MAC)
void PluginProxy::windowFocusChanged(bool hasFocus)
{
m_connection->connection()->send(Messages::PluginControllerProxy::WindowFocusChanged(hasFocus), m_pluginInstanceID);
}
-void PluginProxy::windowAndViewFramesChanged(const WebCore::IntRect& windowFrameInScreenCoordinates, const WebCore::IntRect& viewFrameInWindowCoordinates)
-{
- m_connection->connection()->send(Messages::PluginControllerProxy::WindowAndViewFramesChanged(windowFrameInScreenCoordinates, viewFrameInWindowCoordinates), m_pluginInstanceID);
-}
-
void PluginProxy::windowVisibilityChanged(bool isVisible)
{
m_connection->connection()->send(Messages::PluginControllerProxy::WindowVisibilityChanged(isVisible), m_pluginInstanceID);
}
+#if PLATFORM(COCOA)
+void PluginProxy::windowAndViewFramesChanged(const WebCore::IntRect& windowFrameInScreenCoordinates, const WebCore::IntRect& viewFrameInWindowCoordinates)
+{
+ m_connection->connection()->send(Messages::PluginControllerProxy::WindowAndViewFramesChanged(windowFrameInScreenCoordinates, viewFrameInWindowCoordinates), m_pluginInstanceID);
+}
uint64_t PluginProxy::pluginComplexTextInputIdentifier() const
{
return m_pluginInstanceID;
@@ -530,6 +540,11 @@ void PluginProxy::privateBrowsingStateChanged(bool isPrivateBrowsingEnabled)
m_connection->connection()->send(Messages::PluginControllerProxy::PrivateBrowsingStateChanged(isPrivateBrowsingEnabled), m_pluginInstanceID);
}
+void PluginProxy::mutedStateChanged(bool isMuted)
+{
+ m_connection->connection()->send(Messages::PluginControllerProxy::MutedStateChanged(isMuted), m_pluginInstanceID);
+}
+
bool PluginProxy::getFormValue(String& formValue)
{
bool returnValue;
@@ -591,18 +606,15 @@ bool PluginProxy::updateBackingStore()
IntSize backingStoreSize = m_pluginSize;
backingStoreSize.scale(contentsScaleFactor());
-
- if (!m_backingStore) {
- m_backingStore = ShareableBitmap::create(backingStoreSize, ShareableBitmap::SupportsAlpha);
- return true;
- }
- if (backingStoreSize != m_backingStore->size()) {
- // The backing store already exists, just resize it.
- return m_backingStore->resize(backingStoreSize);
+ if (m_backingStore) {
+ if (m_backingStore->size() == backingStoreSize)
+ return false;
+ m_backingStore = nullptr; // Give malloc a chance to recycle our backing store.
}
- return false;
+ m_backingStore = ShareableBitmap::create(backingStoreSize, ShareableBitmap::SupportsAlpha);
+ return !!m_backingStore;
}
uint64_t PluginProxy::windowNPObjectID()
@@ -658,6 +670,16 @@ void PluginProxy::evaluate(const NPVariantData& npObjectAsVariantData, const Str
releaseNPVariantValue(&npObjectAsVariant);
}
+void PluginProxy::setPluginIsPlayingAudio(bool pluginIsPlayingAudio)
+{
+ controller()->setPluginIsPlayingAudio(pluginIsPlayingAudio);
+}
+
+void PluginProxy::continueStreamLoad(uint64_t streamID)
+{
+ controller()->continueStreamLoad(streamID);
+}
+
void PluginProxy::cancelStreamLoad(uint64_t streamID)
{
controller()->cancelStreamLoad(streamID);
@@ -713,9 +735,9 @@ IntPoint PluginProxy::convertToRootView(const IntPoint& point) const
return m_pluginToRootViewTransform.mapPoint(point);
}
-PassRefPtr<WebCore::SharedBuffer> PluginProxy::liveResourceData() const
+RefPtr<WebCore::SharedBuffer> PluginProxy::liveResourceData() const
{
- return 0;
+ return nullptr;
}
} // namespace WebKit