[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:27:10 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 0e9a2c966950ebd03e7096b75c84cd72df4743a3
Author: andersca at apple.com <andersca at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Nov 3 21:44:23 2010 +0000

    Out of process plug-ins don't support the CA drawing model
    https://bugs.webkit.org/show_bug.cgi?id=48950
    <rdar://problem/8626019>
    
    Reviewed by Simon Fraser.
    
    * Platform/CoreIPC/HandleMessage.h:
    (CoreIPC::callMemberFunction):
    Add new overload.
    
    * PluginProcess/PluginControllerProxy.cpp:
    (WebKit::PluginControllerProxy::initialize):
    Call platformInitialize().
    
    (WebKit::PluginControllerProxy::destroy):
    Call platformDestroy().
    
    (WebKit::PluginControllerProxy::isAcceleratedCompositingEnabled):
    Assume that accelerated compositing is available if we have a render server port.
    
    (WebKit::PluginControllerProxy::geometryDidChange):
    Call platformGeometryDidChange().
    
    * PluginProcess/PluginProcess.h:
    * PluginProcess/WebProcessConnection.cpp:
    (WebKit::WebProcessConnection::createPlugin):
    Pass back the remote layer client ID.
    
    * PluginProcess/WebProcessConnection.messages.in:
    Add a remoteLayerClientID out parameter to CreatePlugin.
    
    * PluginProcess/mac/PluginControllerProxyMac.mm: Added.
    (WebKit::PluginControllerProxy::platformInitialize):
    If the plug-in has a layer, create a remote layer client and associate it with the layer.
    
    (WebKit::PluginControllerProxy::platformDestroy):
    Invalidate the remote layer client.
    
    (WebKit::PluginControllerProxy::remoteLayerClientID):
    Return the remote layer client ID if one exists.
    
    (WebKit::PluginControllerProxy::platformGeometryDidChange):
    Update the layer bounds.
    
    * WebKit2.xcodeproj/project.pbxproj:
    Add new files.
    
    * WebProcess/Plugins/Netscape/mac/PluginProxyMac.mm: Added.
    (WebKit::PluginProxy::pluginLayer):
    Create a render layer if needed.
    
    (WebKit::PluginProxy::needsBackingStore):
    Return whether the plug-in needs a backing store. (It doesn't need a backing store if it's a CA plug-in).
    
    * WebProcess/Plugins/PluginProxy.cpp:
    (WebKit::PluginProxy::PluginProxy):
    Initialize m_remoteLayerClientID.
    
    (WebKit::PluginProxy::initialize):
    Set m_remoteLayerClientID.
    
    (WebKit::PluginProxy::paint):
    Bail if the plug-in doesn't need a backing store.
    
    (WebKit::PluginProxy::geometryDidChange):
    Don't create a backing store if the plug-in doesn't need one.
    
    * WebProcess/WebPage/LayerBackedDrawingArea.cpp:
    (WebKit::LayerBackedDrawingArea::LayerBackedDrawingArea):
    Remove RetainPtr initialization.
    
    * WebProcess/WebPage/mac/LayerBackedDrawingAreaMac.mm:
    (WebKit::LayerBackedDrawingArea::platformClear):
    Use nullptr instead of 0.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@71270 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit2/ChangeLog b/WebKit2/ChangeLog
index 93d7c8f..ebfe94d 100644
--- a/WebKit2/ChangeLog
+++ b/WebKit2/ChangeLog
@@ -2,6 +2,83 @@
 
         Reviewed by Simon Fraser.
 
+        Out of process plug-ins don't support the CA drawing model
+        https://bugs.webkit.org/show_bug.cgi?id=48950
+        <rdar://problem/8626019>
+
+        * Platform/CoreIPC/HandleMessage.h:
+        (CoreIPC::callMemberFunction):
+        Add new overload.
+
+        * PluginProcess/PluginControllerProxy.cpp:
+        (WebKit::PluginControllerProxy::initialize):
+        Call platformInitialize().
+
+        (WebKit::PluginControllerProxy::destroy):
+        Call platformDestroy().
+
+        (WebKit::PluginControllerProxy::isAcceleratedCompositingEnabled):
+        Assume that accelerated compositing is available if we have a render server port.
+
+        (WebKit::PluginControllerProxy::geometryDidChange):
+        Call platformGeometryDidChange().
+
+        * PluginProcess/PluginProcess.h:
+        * PluginProcess/WebProcessConnection.cpp:
+        (WebKit::WebProcessConnection::createPlugin):
+        Pass back the remote layer client ID.
+
+        * PluginProcess/WebProcessConnection.messages.in:
+        Add a remoteLayerClientID out parameter to CreatePlugin.
+
+        * PluginProcess/mac/PluginControllerProxyMac.mm: Added.
+        (WebKit::PluginControllerProxy::platformInitialize):
+        If the plug-in has a layer, create a remote layer client and associate it with the layer.
+
+        (WebKit::PluginControllerProxy::platformDestroy):
+        Invalidate the remote layer client.
+
+        (WebKit::PluginControllerProxy::remoteLayerClientID):
+        Return the remote layer client ID if one exists.
+
+        (WebKit::PluginControllerProxy::platformGeometryDidChange):
+        Update the layer bounds.
+
+        * WebKit2.xcodeproj/project.pbxproj:
+        Add new files.
+
+        * WebProcess/Plugins/Netscape/mac/PluginProxyMac.mm: Added.
+        (WebKit::PluginProxy::pluginLayer):
+        Create a render layer if needed.
+
+        (WebKit::PluginProxy::needsBackingStore):
+        Return whether the plug-in needs a backing store. (It doesn't need a backing store if it's a CA plug-in).
+
+        * WebProcess/Plugins/PluginProxy.cpp:
+        (WebKit::PluginProxy::PluginProxy):
+        Initialize m_remoteLayerClientID.
+
+        (WebKit::PluginProxy::initialize):
+        Set m_remoteLayerClientID.
+
+        (WebKit::PluginProxy::paint):
+        Bail if the plug-in doesn't need a backing store.
+
+        (WebKit::PluginProxy::geometryDidChange):
+        Don't create a backing store if the plug-in doesn't need one.
+
+        * WebProcess/WebPage/LayerBackedDrawingArea.cpp:
+        (WebKit::LayerBackedDrawingArea::LayerBackedDrawingArea):
+        Remove RetainPtr initialization.
+
+        * WebProcess/WebPage/mac/LayerBackedDrawingAreaMac.mm:
+        (WebKit::LayerBackedDrawingArea::platformClear):
+        Use nullptr instead of 0.
+
+2010-11-03  Anders Carlsson  <andersca at apple.com>
+
+        Reviewed by Simon Fraser.
+
         Crash when layout in response to setSize changes the drawing area
         https://bugs.webkit.org/show_bug.cgi?id=48947
 
diff --git a/WebKit2/Platform/CoreIPC/HandleMessage.h b/WebKit2/Platform/CoreIPC/HandleMessage.h
index 4f27598..e43cfda 100644
--- a/WebKit2/Platform/CoreIPC/HandleMessage.h
+++ b/WebKit2/Platform/CoreIPC/HandleMessage.h
@@ -127,6 +127,12 @@ void callMemberFunction(const Arguments4<P1, P2, P3, P4>& args, Arguments1<R1>&
     (object->*function)(args.argument1, args.argument2, args.argument3, args.argument4, replyArgs.argument1);
 }
 
+template<typename C, typename MF, typename P1, typename P2, typename P3, typename P4, typename R1, typename R2>
+void callMemberFunction(const Arguments4<P1, P2, P3, P4>& args, Arguments2<R1, R2>& replyArgs, C* object, MF function)
+{
+    (object->*function)(args.argument1, args.argument2, args.argument3, args.argument4, replyArgs.argument1, replyArgs.argument2);
+}
+    
 // Variadic dispatch functions.
 
 template<typename C, typename MF>
diff --git a/WebKit2/PluginProcess/PluginControllerProxy.cpp b/WebKit2/PluginProcess/PluginControllerProxy.cpp
index 91a0059..6beb25a 100644
--- a/WebKit2/PluginProcess/PluginControllerProxy.cpp
+++ b/WebKit2/PluginProcess/PluginControllerProxy.cpp
@@ -74,6 +74,8 @@ bool PluginControllerProxy::initialize(const Plugin::Parameters& parameters)
         return false;
     }
 
+    platformInitialize();
+
     return true;
 }
 
@@ -83,6 +85,8 @@ void PluginControllerProxy::destroy()
 
     m_plugin->destroy();
     m_plugin = 0;
+
+    platformDestroy();
 }
 
 void PluginControllerProxy::paint()
@@ -193,8 +197,7 @@ void PluginControllerProxy::setStatusbarText(const WTF::String&)
 
 bool PluginControllerProxy::isAcceleratedCompositingEnabled()
 {
-    notImplemented();
-    return false;
+    return PluginProcess::shared().compositingRenderServerPort();
 }
 
 void PluginControllerProxy::pluginProcessCrashed()
@@ -245,6 +248,8 @@ void PluginControllerProxy::geometryDidChange(const IntRect& frameRect, const In
     }
 
     m_plugin->geometryDidChange(frameRect, clipRect);
+
+    platformGeometryDidChange(frameRect, clipRect);
 }
 
 void PluginControllerProxy::didEvaluateJavaScript(uint64_t requestID, const String& requestURLString, const String& result)
diff --git a/WebKit2/PluginProcess/PluginControllerProxy.h b/WebKit2/PluginProcess/PluginControllerProxy.h
index 06c5338..6934329 100644
--- a/WebKit2/PluginProcess/PluginControllerProxy.h
+++ b/WebKit2/PluginProcess/PluginControllerProxy.h
@@ -35,6 +35,12 @@
 #include "SharedMemory.h"
 #include <wtf/Noncopyable.h>
 
+#if PLATFORM(MAC)
+#include <wtf/RetainPtr.h>
+
+typedef struct __WKCARemoteLayerClientRef *WKCARemoteLayerClientRef;
+#endif
+
 namespace CoreIPC {
     class DataReference;
 }
@@ -59,6 +65,10 @@ public:
     void didReceivePluginControllerProxyMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
     CoreIPC::SyncReplyMode didReceiveSyncPluginControllerProxyMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*, CoreIPC::ArgumentEncoder*);
 
+#if PLATFORM(MAC)
+    uint32_t remoteLayerClientID() const;
+#endif
+
 private:
     PluginControllerProxy(WebProcessConnection* connection, uint64_t pluginInstanceID, const String& userAgent, bool isPrivateBrowsingEnabled);
 
@@ -106,6 +116,10 @@ private:
 #endif
     void privateBrowsingStateChanged(bool);
 
+    void platformInitialize();
+    void platformDestroy();
+    void platformGeometryDidChange(const WebCore::IntRect& frameRect, const WebCore::IntRect& clipRect);
+
     WebProcessConnection* m_connection;
     uint64_t m_pluginInstanceID;
 
@@ -130,6 +144,11 @@ private:
 
     // The backing store that this plug-in draws into.
     RefPtr<BackingStore> m_backingStore;
+
+#if PLATFORM(MAC)
+    // For CA plug-ins, this holds the information needed to export the layer hierarchy to the UI process.
+    RetainPtr<WKCARemoteLayerClientRef> m_remoteLayerClient;
+#endif
 };
 
 } // namespace WebKit
diff --git a/WebKit2/PluginProcess/PluginProcess.h b/WebKit2/PluginProcess/PluginProcess.h
index c855f5a..dfc83ab 100644
--- a/WebKit2/PluginProcess/PluginProcess.h
+++ b/WebKit2/PluginProcess/PluginProcess.h
@@ -47,6 +47,10 @@ public:
 
     NetscapePluginModule* netscapePluginModule() const { return m_pluginModule.get(); }
 
+#if USE(ACCELERATED_COMPOSITING) && PLATFORM(MAC)
+    mach_port_t compositingRenderServerPort() const { return m_compositingRenderServerPort; }
+#endif
+
 private:
     PluginProcess();
     ~PluginProcess();
diff --git a/WebKit2/PluginProcess/WebProcessConnection.cpp b/WebKit2/PluginProcess/WebProcessConnection.cpp
index 3539454..005c72c 100644
--- a/WebKit2/PluginProcess/WebProcessConnection.cpp
+++ b/WebKit2/PluginProcess/WebProcessConnection.cpp
@@ -145,7 +145,7 @@ void WebProcessConnection::didReceiveInvalidMessage(CoreIPC::Connection*, CoreIP
     // FIXME: Implement.
 }
 
-void WebProcessConnection::createPlugin(uint64_t pluginInstanceID, const Plugin::Parameters& parameters, const String& userAgent, bool isPrivateBrowsingEnabled, bool& result)
+void WebProcessConnection::createPlugin(uint64_t pluginInstanceID, const Plugin::Parameters& parameters, const String& userAgent, bool isPrivateBrowsingEnabled, bool& result, uint32_t& remoteLayerClientID)
 {
     OwnPtr<PluginControllerProxy> pluginControllerProxy = PluginControllerProxy::create(this, pluginInstanceID, userAgent, isPrivateBrowsingEnabled);
 
@@ -158,10 +158,13 @@ void WebProcessConnection::createPlugin(uint64_t pluginInstanceID, const Plugin:
     // Now try to initialize the plug-in.
     result = pluginControllerProxyPtr->initialize(parameters);
 
-    if (!result) {
-        // We failed to initialize, remove the plug-in controller. This could cause us to be deleted.
-        removePluginControllerProxy(pluginControllerProxyPtr);
+    if (result) {
+        remoteLayerClientID = pluginControllerProxyPtr->remoteLayerClientID();
+        return;
     }
+
+    // We failed to initialize, remove the plug-in controller. This could cause us to be deleted.
+    removePluginControllerProxy(pluginControllerProxyPtr);
 }
 
 } // namespace WebKit
diff --git a/WebKit2/PluginProcess/WebProcessConnection.h b/WebKit2/PluginProcess/WebProcessConnection.h
index 8555435..e04b842 100644
--- a/WebKit2/PluginProcess/WebProcessConnection.h
+++ b/WebKit2/PluginProcess/WebProcessConnection.h
@@ -64,7 +64,7 @@ private:
 
     // Message handlers.
     CoreIPC::SyncReplyMode didReceiveSyncWebProcessConnectionMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*, CoreIPC::ArgumentEncoder*);
-    void createPlugin(uint64_t pluginInstanceID, const Plugin::Parameters&, const String& userAgent, bool isPrivateBrowsingEnabled, bool& result);
+    void createPlugin(uint64_t pluginInstanceID, const Plugin::Parameters&, const String& userAgent, bool isPrivateBrowsingEnabled, bool& result, uint32_t& remoteLayerClientID);
     void destroyPlugin(uint64_t pluginInstanceID);
 
     RefPtr<CoreIPC::Connection> m_connection;
diff --git a/WebKit2/PluginProcess/WebProcessConnection.messages.in b/WebKit2/PluginProcess/WebProcessConnection.messages.in
index 8fa4952..c311400 100644
--- a/WebKit2/PluginProcess/WebProcessConnection.messages.in
+++ b/WebKit2/PluginProcess/WebProcessConnection.messages.in
@@ -24,7 +24,7 @@
 
 messages -> WebProcessConnection {
     # Creates a plug-in instance with the given instance ID.
-    CreatePlugin(uint64_t pluginInstanceID, WebKit::Plugin::Parameters parameters, WTF::String userAgent, bool isPrivateBrowsingEnabled) -> (bool result)
+    CreatePlugin(uint64_t pluginInstanceID, WebKit::Plugin::Parameters parameters, WTF::String userAgent, bool isPrivateBrowsingEnabled) -> (bool result, uint32_t remoteLayerClientID)
 
     # Destroys the plug-in instance with the given instance ID.
     DestroyPlugin(uint64_t pluginInstanceID) -> ()
diff --git a/WebKit2/PluginProcess/mac/PluginControllerProxyMac.mm b/WebKit2/PluginProcess/mac/PluginControllerProxyMac.mm
new file mode 100644
index 0000000..40d4f6d
--- /dev/null
+++ b/WebKit2/PluginProcess/mac/PluginControllerProxyMac.mm
@@ -0,0 +1,82 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#if ENABLE(PLUGIN_PROCESS)
+
+#include "PluginControllerProxy.h"
+
+#include <QuartzCore/QuartzCore.h>
+#include "PluginProcess.h"
+#include "WebKitSystemInterface.h"
+
+using namespace WebCore;
+
+namespace WebKit {
+
+void PluginControllerProxy::platformInitialize()
+{
+    CALayer * platformLayer = m_plugin->pluginLayer();
+    if (!platformLayer)
+        return;
+
+    ASSERT(!m_remoteLayerClient);
+
+    m_remoteLayerClient = WKCARemoteLayerClientMakeWithServerPort(PluginProcess::shared().compositingRenderServerPort());
+    ASSERT(m_remoteLayerClient);
+
+    WKCARemoteLayerClientSetLayer(m_remoteLayerClient.get(), platformLayer);
+}
+
+void PluginControllerProxy::platformDestroy()
+{
+    if (!m_remoteLayerClient)
+        return;
+
+    WKCARemoteLayerClientInvalidate(m_remoteLayerClient.get());
+    m_remoteLayerClient = nullptr;
+}
+
+uint32_t PluginControllerProxy::remoteLayerClientID() const
+{
+    if (!m_remoteLayerClient)
+        return 0;
+
+    return WKCARemoteLayerClientGetClientId(m_remoteLayerClient.get());
+}
+
+void PluginControllerProxy::platformGeometryDidChange(const IntRect& frameRect, const IntRect&)
+{
+    CALayer * pluginLayer = m_plugin->pluginLayer();
+
+    // We don't want to animate to the new size so we disable actions for this transaction.
+    [CATransaction begin];
+    [CATransaction setValue:[NSNumber numberWithBool:YES] forKey:kCATransactionDisableActions];
+    [pluginLayer setFrame:CGRectMake(0, 0, frameRect.width(), frameRect.height())];
+    [CATransaction commit];
+}
+
+} // namespace WebKit
+
+#endif // ENABLE(PLUGIN_PROCESS)
diff --git a/WebKit2/WebKit2.xcodeproj/project.pbxproj b/WebKit2/WebKit2.xcodeproj/project.pbxproj
index 3bfb526..aa44761 100644
--- a/WebKit2/WebKit2.xcodeproj/project.pbxproj
+++ b/WebKit2/WebKit2.xcodeproj/project.pbxproj
@@ -96,6 +96,8 @@
 		1A2D90BB1281C931001EB962 /* PluginProcessProxyMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1A2D90BA1281C931001EB962 /* PluginProcessProxyMac.mm */; };
 		1A2D90D21281C966001EB962 /* PluginProcessCreationParameters.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A2D90D01281C966001EB962 /* PluginProcessCreationParameters.h */; };
 		1A2D90D31281C966001EB962 /* PluginProcessCreationParameters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A2D90D11281C966001EB962 /* PluginProcessCreationParameters.cpp */; };
+		1A2D91A61281D739001EB962 /* PluginControllerProxyMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1A2D91A51281D739001EB962 /* PluginControllerProxyMac.mm */; };
+		1A2D92211281DC1B001EB962 /* PluginProxyMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1A2D92201281DC1B001EB962 /* PluginProxyMac.mm */; };
 		1A30066E1110F4F70031937C /* ResponsivenessTimer.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A30066C1110F4F70031937C /* ResponsivenessTimer.h */; };
 		1A30EAC6115D7DA30053E937 /* ConnectionMac.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A30EAC5115D7DA30053E937 /* ConnectionMac.cpp */; };
 		1A3DD1FD125E59F3004515E6 /* WebFindClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A3DD1FC125E59F3004515E6 /* WebFindClient.cpp */; };
@@ -613,6 +615,8 @@
 		1A2D90BA1281C931001EB962 /* PluginProcessProxyMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PluginProcessProxyMac.mm; sourceTree = "<group>"; };
 		1A2D90D01281C966001EB962 /* PluginProcessCreationParameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PluginProcessCreationParameters.h; sourceTree = "<group>"; };
 		1A2D90D11281C966001EB962 /* PluginProcessCreationParameters.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PluginProcessCreationParameters.cpp; sourceTree = "<group>"; };
+		1A2D91A51281D739001EB962 /* PluginControllerProxyMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PluginControllerProxyMac.mm; sourceTree = "<group>"; };
+		1A2D92201281DC1B001EB962 /* PluginProxyMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PluginProxyMac.mm; sourceTree = "<group>"; };
 		1A30066C1110F4F70031937C /* ResponsivenessTimer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ResponsivenessTimer.h; sourceTree = "<group>"; };
 		1A30EAC5115D7DA30053E937 /* ConnectionMac.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ConnectionMac.cpp; sourceTree = "<group>"; };
 		1A3DD1FC125E59F3004515E6 /* WebFindClient.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebFindClient.cpp; sourceTree = "<group>"; };
@@ -1175,6 +1179,7 @@
 		1A0EC7FD124BD402007EF4A5 /* mac */ = {
 			isa = PBXGroup;
 			children = (
+				1A2D91A51281D739001EB962 /* PluginControllerProxyMac.mm */,
 				1A0EC802124BD41E007EF4A5 /* PluginProcessMainMac.mm */,
 			);
 			path = mac;
@@ -1275,6 +1280,7 @@
 			isa = PBXGroup;
 			children = (
 				1AE5B7F911E7AED200BA6767 /* NetscapePluginMac.mm */,
+				1A2D92201281DC1B001EB962 /* PluginProxyMac.mm */,
 			);
 			path = mac;
 			sourceTree = "<group>";
@@ -2630,6 +2636,8 @@
 				1C8E2A351277852400BC7BD0 /* WebInspectorMessageReceiver.cpp in Sources */,
 				1A2D90BB1281C931001EB962 /* PluginProcessProxyMac.mm in Sources */,
 				1A2D90D31281C966001EB962 /* PluginProcessCreationParameters.cpp in Sources */,
+				1A2D91A61281D739001EB962 /* PluginControllerProxyMac.mm in Sources */,
+				1A2D92211281DC1B001EB962 /* PluginProxyMac.mm in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
diff --git a/WebKit2/WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm b/WebKit2/WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm
index bf6c7fc..51911b5 100644
--- a/WebKit2/WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm
+++ b/WebKit2/WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm
@@ -123,7 +123,7 @@ bool NetscapePlugin::platformPostInitialize()
         // Get the Core Animation layer.
         if (NPP_GetValue(NPPVpluginCoreAnimationLayer, &value) == NPERR_NO_ERROR && value) {
             ASSERT(!m_pluginLayer);
-            m_pluginLayer = reinterpret_cast<CALayer*>(value);
+            m_pluginLayer = reinterpret_cast<CALayer *>(value);
         }
     }
 
diff --git a/WebKit2/WebProcess/Plugins/Netscape/mac/PluginProxyMac.mm b/WebKit2/WebProcess/Plugins/Netscape/mac/PluginProxyMac.mm
new file mode 100644
index 0000000..6ecf7b9
--- /dev/null
+++ b/WebKit2/WebProcess/Plugins/Netscape/mac/PluginProxyMac.mm
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#if ENABLE(PLUGIN_PROCESS)
+
+#include "PluginProxy.h"
+
+#include <WebKitSystemInterface.h>
+
+namespace WebKit {
+
+PlatformLayer* PluginProxy::pluginLayer()
+{
+    if (!m_pluginLayer && m_remoteLayerClientID)
+        m_pluginLayer = WKMakeRenderLayer(m_remoteLayerClientID);
+
+    return m_pluginLayer.get();
+}
+
+bool PluginProxy::needsBackingStore() const
+{
+    return !m_remoteLayerClientID;
+}
+
+} // namespace WebKit
+
+#endif // ENABLE(PLUGIN_PROCESS)
diff --git a/WebKit2/WebProcess/Plugins/PluginProxy.cpp b/WebKit2/WebProcess/Plugins/PluginProxy.cpp
index b074507..983d40e 100644
--- a/WebKit2/WebProcess/Plugins/PluginProxy.cpp
+++ b/WebKit2/WebProcess/Plugins/PluginProxy.cpp
@@ -62,6 +62,7 @@ PluginProxy::PluginProxy(PassRefPtr<PluginProcessConnection> connection)
     , m_pluginBackingStoreContainsValidData(false)
     , m_isStarted(false)
     , m_waitingForPaintInResponseToUpdate(false)
+    , m_remoteLayerClientID(0)
 {
 }
 
@@ -89,11 +90,13 @@ bool PluginProxy::initialize(PluginController* pluginController, const Parameter
     // Ask the plug-in process to create a plug-in.
     bool result = false;
 
-    if (!m_connection->connection()->sendSync(Messages::WebProcessConnection::CreatePlugin(m_pluginInstanceID, parameters, pluginController->userAgent(), pluginController->isPrivateBrowsingEnabled()), Messages::WebProcessConnection::CreatePlugin::Reply(result), 0) || !result) {
+    uint32_t remoteLayerClientID = 0;
+    if (!m_connection->connection()->sendSync(Messages::WebProcessConnection::CreatePlugin(m_pluginInstanceID, parameters, pluginController->userAgent(), pluginController->isPrivateBrowsingEnabled()), Messages::WebProcessConnection::CreatePlugin::Reply(result, remoteLayerClientID), 0) || !result) {
         m_connection->removePluginProxy(this);
         return false;
     }
 
+    m_remoteLayerClientID = remoteLayerClientID;
     m_isStarted = true;
 
     return true;
@@ -111,7 +114,7 @@ void PluginProxy::destroy()
 
 void PluginProxy::paint(GraphicsContext* graphicsContext, const IntRect& dirtyRect)
 {
-    if (!m_backingStore)
+    if (!needsBackingStore() || !m_backingStore)
         return;
 
     if (!m_pluginBackingStoreContainsValidData) {
@@ -142,20 +145,18 @@ void PluginProxy::paint(GraphicsContext* graphicsContext, const IntRect& dirtyRe
     }
 }
 
-#if PLATFORM(MAC)
-PlatformLayer* PluginProxy::pluginLayer()
-{
-    notImplemented();
-    return 0;
-}
-#endif
-
 void PluginProxy::geometryDidChange(const IntRect& frameRect, const IntRect& clipRect)
 {
     ASSERT(m_isStarted);
 
     m_frameRect = frameRect;
 
+    if (!needsBackingStore()) {
+        SharedMemory::Handle pluginBackingStoreHandle;
+        m_connection->connection()->send(Messages::PluginControllerProxy::GeometryDidChange(frameRect, clipRect, pluginBackingStoreHandle), m_pluginInstanceID);
+        return;
+    }
+
     bool didUpdateBackingStore = false;
     if (!m_backingStore) {
         m_backingStore = BackingStore::create(frameRect.size());
diff --git a/WebKit2/WebProcess/Plugins/PluginProxy.h b/WebKit2/WebProcess/Plugins/PluginProxy.h
index 93bc7a0..38cf676 100644
--- a/WebKit2/WebProcess/Plugins/PluginProxy.h
+++ b/WebKit2/WebProcess/Plugins/PluginProxy.h
@@ -31,6 +31,15 @@
 #include "Connection.h"
 #include "Plugin.h"
 
+#if PLATFORM(MAC)
+#include <wtf/RetainPtr.h>
+#ifdef __OBJC__
+ at class CALayer;
+#else
+class CALayer;
+#endif
+#endif
+
 namespace WebCore {
     class HTTPHeaderMap;
 }
@@ -91,6 +100,8 @@ private:
 
     virtual PluginController* controller();
 
+    bool needsBackingStore() const;
+
     // Message handlers.
     void loadURL(uint64_t requestID, const String& method, const String& urlString, const String& target, const WebCore::HTTPHeaderMap& headerFields, const Vector<uint8_t>& httpBody, bool allowPopups);
     void update(const WebCore::IntRect& paintedRect);
@@ -121,6 +132,13 @@ private:
 
     // Whether we're called invalidate in response to an update call, and are now waiting for a paint call.
     bool m_waitingForPaintInResponseToUpdate;
+
+    // The client ID for the CA layer in the plug-in process. Will be 0 if the plug-in is not a CA plug-in.
+    uint32_t m_remoteLayerClientID;
+
+#if PLATFORM(MAC)
+    RetainPtr<CALayer> m_pluginLayer;
+#endif
 };
 
 } // namespace WebKit
diff --git a/WebKit2/WebProcess/WebPage/LayerBackedDrawingArea.cpp b/WebKit2/WebProcess/WebPage/LayerBackedDrawingArea.cpp
index 038b7b3..ec0e4f1 100644
--- a/WebKit2/WebProcess/WebPage/LayerBackedDrawingArea.cpp
+++ b/WebKit2/WebProcess/WebPage/LayerBackedDrawingArea.cpp
@@ -42,9 +42,6 @@ namespace WebKit {
 LayerBackedDrawingArea::LayerBackedDrawingArea(DrawingAreaID identifier, WebPage* webPage)
     : DrawingArea(LayerBackedDrawingAreaType, identifier, webPage)
     , m_syncTimer(WebProcess::shared().runLoop(), this, &LayerBackedDrawingArea::syncCompositingLayers)
-#if PLATFORM(MAC) && HAVE(HOSTED_CORE_ANIMATION)
-    , m_remoteLayerRef(0)
-#endif
     , m_attached(false)
     , m_shouldPaint(true)
 {
diff --git a/WebKit2/WebProcess/WebPage/mac/LayerBackedDrawingAreaMac.mm b/WebKit2/WebProcess/WebPage/mac/LayerBackedDrawingAreaMac.mm
index e935a5f..c7efa8e 100644
--- a/WebKit2/WebProcess/WebPage/mac/LayerBackedDrawingAreaMac.mm
+++ b/WebKit2/WebProcess/WebPage/mac/LayerBackedDrawingAreaMac.mm
@@ -61,7 +61,7 @@ void LayerBackedDrawingArea::platformClear()
 
 #if HAVE(HOSTED_CORE_ANIMATION)
     WKCARemoteLayerClientInvalidate(m_remoteLayerRef.get());
-    m_remoteLayerRef = 0;
+    m_remoteLayerRef = nullptr;
 #endif
 
     m_attached = false;

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list