Changeset 71270 in webkit


Ignore:
Timestamp:
Nov 3, 2010 2:44:23 PM (13 years ago)
Author:
andersca@apple.com
Message:

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.

Location:
trunk/WebKit2
Files:
2 added
14 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebKit2/ChangeLog

    r71261 r71270  
     12010-11-03  Anders Carlsson  <andersca@apple.com>
     2
     3        Reviewed by Simon Fraser.
     4
     5        Out of process plug-ins don't support the CA drawing model
     6        https://bugs.webkit.org/show_bug.cgi?id=48950
     7        <rdar://problem/8626019>
     8
     9        * Platform/CoreIPC/HandleMessage.h:
     10        (CoreIPC::callMemberFunction):
     11        Add new overload.
     12
     13        * PluginProcess/PluginControllerProxy.cpp:
     14        (WebKit::PluginControllerProxy::initialize):
     15        Call platformInitialize().
     16
     17        (WebKit::PluginControllerProxy::destroy):
     18        Call platformDestroy().
     19
     20        (WebKit::PluginControllerProxy::isAcceleratedCompositingEnabled):
     21        Assume that accelerated compositing is available if we have a render server port.
     22
     23        (WebKit::PluginControllerProxy::geometryDidChange):
     24        Call platformGeometryDidChange().
     25
     26        * PluginProcess/PluginProcess.h:
     27        * PluginProcess/WebProcessConnection.cpp:
     28        (WebKit::WebProcessConnection::createPlugin):
     29        Pass back the remote layer client ID.
     30
     31        * PluginProcess/WebProcessConnection.messages.in:
     32        Add a remoteLayerClientID out parameter to CreatePlugin.
     33
     34        * PluginProcess/mac/PluginControllerProxyMac.mm: Added.
     35        (WebKit::PluginControllerProxy::platformInitialize):
     36        If the plug-in has a layer, create a remote layer client and associate it with the layer.
     37
     38        (WebKit::PluginControllerProxy::platformDestroy):
     39        Invalidate the remote layer client.
     40
     41        (WebKit::PluginControllerProxy::remoteLayerClientID):
     42        Return the remote layer client ID if one exists.
     43
     44        (WebKit::PluginControllerProxy::platformGeometryDidChange):
     45        Update the layer bounds.
     46
     47        * WebKit2.xcodeproj/project.pbxproj:
     48        Add new files.
     49
     50        * WebProcess/Plugins/Netscape/mac/PluginProxyMac.mm: Added.
     51        (WebKit::PluginProxy::pluginLayer):
     52        Create a render layer if needed.
     53
     54        (WebKit::PluginProxy::needsBackingStore):
     55        Return whether the plug-in needs a backing store. (It doesn't need a backing store if it's a CA plug-in).
     56
     57        * WebProcess/Plugins/PluginProxy.cpp:
     58        (WebKit::PluginProxy::PluginProxy):
     59        Initialize m_remoteLayerClientID.
     60
     61        (WebKit::PluginProxy::initialize):
     62        Set m_remoteLayerClientID.
     63
     64        (WebKit::PluginProxy::paint):
     65        Bail if the plug-in doesn't need a backing store.
     66
     67        (WebKit::PluginProxy::geometryDidChange):
     68        Don't create a backing store if the plug-in doesn't need one.
     69
     70        * WebProcess/WebPage/LayerBackedDrawingArea.cpp:
     71        (WebKit::LayerBackedDrawingArea::LayerBackedDrawingArea):
     72        Remove RetainPtr initialization.
     73
     74        * WebProcess/WebPage/mac/LayerBackedDrawingAreaMac.mm:
     75        (WebKit::LayerBackedDrawingArea::platformClear):
     76        Use nullptr instead of 0.
     77
    1782010-11-03  Anders Carlsson  <andersca@apple.com>
    279
  • trunk/WebKit2/Platform/CoreIPC/HandleMessage.h

    r71183 r71270  
    128128}
    129129
     130template<typename C, typename MF, typename P1, typename P2, typename P3, typename P4, typename R1, typename R2>
     131void callMemberFunction(const Arguments4<P1, P2, P3, P4>& args, Arguments2<R1, R2>& replyArgs, C* object, MF function)
     132{
     133    (object->*function)(args.argument1, args.argument2, args.argument3, args.argument4, replyArgs.argument1, replyArgs.argument2);
     134}
     135   
    130136// Variadic dispatch functions.
    131137
  • trunk/WebKit2/PluginProcess/PluginControllerProxy.cpp

    r71173 r71270  
    7575    }
    7676
     77    platformInitialize();
     78
    7779    return true;
    7880}
     
    8486    m_plugin->destroy();
    8587    m_plugin = 0;
     88
     89    platformDestroy();
    8690}
    8791
     
    194198bool PluginControllerProxy::isAcceleratedCompositingEnabled()
    195199{
    196     notImplemented();
    197     return false;
     200    return PluginProcess::shared().compositingRenderServerPort();
    198201}
    199202
     
    246249
    247250    m_plugin->geometryDidChange(frameRect, clipRect);
     251
     252    platformGeometryDidChange(frameRect, clipRect);
    248253}
    249254
  • trunk/WebKit2/PluginProcess/PluginControllerProxy.h

    r71173 r71270  
    3636#include <wtf/Noncopyable.h>
    3737
     38#if PLATFORM(MAC)
     39#include <wtf/RetainPtr.h>
     40
     41typedef struct __WKCARemoteLayerClientRef *WKCARemoteLayerClientRef;
     42#endif
     43
    3844namespace CoreIPC {
    3945    class DataReference;
     
    5965    void didReceivePluginControllerProxyMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
    6066    CoreIPC::SyncReplyMode didReceiveSyncPluginControllerProxyMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*, CoreIPC::ArgumentEncoder*);
     67
     68#if PLATFORM(MAC)
     69    uint32_t remoteLayerClientID() const;
     70#endif
    6171
    6272private:
     
    107117    void privateBrowsingStateChanged(bool);
    108118
     119    void platformInitialize();
     120    void platformDestroy();
     121    void platformGeometryDidChange(const WebCore::IntRect& frameRect, const WebCore::IntRect& clipRect);
     122
    109123    WebProcessConnection* m_connection;
    110124    uint64_t m_pluginInstanceID;
     
    131145    // The backing store that this plug-in draws into.
    132146    RefPtr<BackingStore> m_backingStore;
     147
     148#if PLATFORM(MAC)
     149    // For CA plug-ins, this holds the information needed to export the layer hierarchy to the UI process.
     150    RetainPtr<WKCARemoteLayerClientRef> m_remoteLayerClient;
     151#endif
    133152};
    134153
  • trunk/WebKit2/PluginProcess/PluginProcess.h

    r71247 r71270  
    4848    NetscapePluginModule* netscapePluginModule() const { return m_pluginModule.get(); }
    4949
     50#if USE(ACCELERATED_COMPOSITING) && PLATFORM(MAC)
     51    mach_port_t compositingRenderServerPort() const { return m_compositingRenderServerPort; }
     52#endif
     53
    5054private:
    5155    PluginProcess();
  • trunk/WebKit2/PluginProcess/WebProcessConnection.cpp

    r71127 r71270  
    146146}
    147147
    148 void WebProcessConnection::createPlugin(uint64_t pluginInstanceID, const Plugin::Parameters& parameters, const String& userAgent, bool isPrivateBrowsingEnabled, bool& result)
     148void WebProcessConnection::createPlugin(uint64_t pluginInstanceID, const Plugin::Parameters& parameters, const String& userAgent, bool isPrivateBrowsingEnabled, bool& result, uint32_t& remoteLayerClientID)
    149149{
    150150    OwnPtr<PluginControllerProxy> pluginControllerProxy = PluginControllerProxy::create(this, pluginInstanceID, userAgent, isPrivateBrowsingEnabled);
     
    159159    result = pluginControllerProxyPtr->initialize(parameters);
    160160
    161     if (!result) {
    162         // We failed to initialize, remove the plug-in controller. This could cause us to be deleted.
    163         removePluginControllerProxy(pluginControllerProxyPtr);
     161    if (result) {
     162        remoteLayerClientID = pluginControllerProxyPtr->remoteLayerClientID();
     163        return;
    164164    }
     165
     166    // We failed to initialize, remove the plug-in controller. This could cause us to be deleted.
     167    removePluginControllerProxy(pluginControllerProxyPtr);
    165168}
    166169
  • trunk/WebKit2/PluginProcess/WebProcessConnection.h

    r71081 r71270  
    6565    // Message handlers.
    6666    CoreIPC::SyncReplyMode didReceiveSyncWebProcessConnectionMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*, CoreIPC::ArgumentEncoder*);
    67     void createPlugin(uint64_t pluginInstanceID, const Plugin::Parameters&, const String& userAgent, bool isPrivateBrowsingEnabled, bool& result);
     67    void createPlugin(uint64_t pluginInstanceID, const Plugin::Parameters&, const String& userAgent, bool isPrivateBrowsingEnabled, bool& result, uint32_t& remoteLayerClientID);
    6868    void destroyPlugin(uint64_t pluginInstanceID);
    6969
  • trunk/WebKit2/PluginProcess/WebProcessConnection.messages.in

    r68989 r71270  
    2525messages -> WebProcessConnection {
    2626    # Creates a plug-in instance with the given instance ID.
    27     CreatePlugin(uint64_t pluginInstanceID, WebKit::Plugin::Parameters parameters, WTF::String userAgent, bool isPrivateBrowsingEnabled) -> (bool result)
     27    CreatePlugin(uint64_t pluginInstanceID, WebKit::Plugin::Parameters parameters, WTF::String userAgent, bool isPrivateBrowsingEnabled) -> (bool result, uint32_t remoteLayerClientID)
    2828
    2929    # Destroys the plug-in instance with the given instance ID.
  • trunk/WebKit2/WebKit2.xcodeproj/project.pbxproj

    r71247 r71270  
    9797                1A2D90D21281C966001EB962 /* PluginProcessCreationParameters.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A2D90D01281C966001EB962 /* PluginProcessCreationParameters.h */; };
    9898                1A2D90D31281C966001EB962 /* PluginProcessCreationParameters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A2D90D11281C966001EB962 /* PluginProcessCreationParameters.cpp */; };
     99                1A2D91A61281D739001EB962 /* PluginControllerProxyMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1A2D91A51281D739001EB962 /* PluginControllerProxyMac.mm */; };
     100                1A2D92211281DC1B001EB962 /* PluginProxyMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1A2D92201281DC1B001EB962 /* PluginProxyMac.mm */; };
    99101                1A30066E1110F4F70031937C /* ResponsivenessTimer.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A30066C1110F4F70031937C /* ResponsivenessTimer.h */; };
    100102                1A30EAC6115D7DA30053E937 /* ConnectionMac.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A30EAC5115D7DA30053E937 /* ConnectionMac.cpp */; };
     
    614616                1A2D90D01281C966001EB962 /* PluginProcessCreationParameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PluginProcessCreationParameters.h; sourceTree = "<group>"; };
    615617                1A2D90D11281C966001EB962 /* PluginProcessCreationParameters.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PluginProcessCreationParameters.cpp; sourceTree = "<group>"; };
     618                1A2D91A51281D739001EB962 /* PluginControllerProxyMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PluginControllerProxyMac.mm; sourceTree = "<group>"; };
     619                1A2D92201281DC1B001EB962 /* PluginProxyMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PluginProxyMac.mm; sourceTree = "<group>"; };
    616620                1A30066C1110F4F70031937C /* ResponsivenessTimer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ResponsivenessTimer.h; sourceTree = "<group>"; };
    617621                1A30EAC5115D7DA30053E937 /* ConnectionMac.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ConnectionMac.cpp; sourceTree = "<group>"; };
     
    11761180                        isa = PBXGroup;
    11771181                        children = (
     1182                                1A2D91A51281D739001EB962 /* PluginControllerProxyMac.mm */,
    11781183                                1A0EC802124BD41E007EF4A5 /* PluginProcessMainMac.mm */,
    11791184                        );
     
    12761281                        children = (
    12771282                                1AE5B7F911E7AED200BA6767 /* NetscapePluginMac.mm */,
     1283                                1A2D92201281DC1B001EB962 /* PluginProxyMac.mm */,
    12781284                        );
    12791285                        path = mac;
     
    26312637                                1A2D90BB1281C931001EB962 /* PluginProcessProxyMac.mm in Sources */,
    26322638                                1A2D90D31281C966001EB962 /* PluginProcessCreationParameters.cpp in Sources */,
     2639                                1A2D91A61281D739001EB962 /* PluginControllerProxyMac.mm in Sources */,
     2640                                1A2D92211281DC1B001EB962 /* PluginProxyMac.mm in Sources */,
    26332641                        );
    26342642                        runOnlyForDeploymentPostprocessing = 0;
  • trunk/WebKit2/WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm

    r70903 r71270  
    124124        if (NPP_GetValue(NPPVpluginCoreAnimationLayer, &value) == NPERR_NO_ERROR && value) {
    125125            ASSERT(!m_pluginLayer);
    126             m_pluginLayer = reinterpret_cast<CALayer*>(value);
     126            m_pluginLayer = reinterpret_cast<CALayer *>(value);
    127127        }
    128128    }
  • trunk/WebKit2/WebProcess/Plugins/PluginProxy.cpp

    r71173 r71270  
    6363    , m_isStarted(false)
    6464    , m_waitingForPaintInResponseToUpdate(false)
     65    , m_remoteLayerClientID(0)
    6566{
    6667}
     
    9091    bool result = false;
    9192
    92     if (!m_connection->connection()->sendSync(Messages::WebProcessConnection::CreatePlugin(m_pluginInstanceID, parameters, pluginController->userAgent(), pluginController->isPrivateBrowsingEnabled()), Messages::WebProcessConnection::CreatePlugin::Reply(result), 0) || !result) {
     93    uint32_t remoteLayerClientID = 0;
     94    if (!m_connection->connection()->sendSync(Messages::WebProcessConnection::CreatePlugin(m_pluginInstanceID, parameters, pluginController->userAgent(), pluginController->isPrivateBrowsingEnabled()), Messages::WebProcessConnection::CreatePlugin::Reply(result, remoteLayerClientID), 0) || !result) {
    9395        m_connection->removePluginProxy(this);
    9496        return false;
    9597    }
    9698
     99    m_remoteLayerClientID = remoteLayerClientID;
    97100    m_isStarted = true;
    98101
     
    112115void PluginProxy::paint(GraphicsContext* graphicsContext, const IntRect& dirtyRect)
    113116{
    114     if (!m_backingStore)
     117    if (!needsBackingStore() || !m_backingStore)
    115118        return;
    116119
     
    143146}
    144147
    145 #if PLATFORM(MAC)
    146 PlatformLayer* PluginProxy::pluginLayer()
    147 {
    148     notImplemented();
    149     return 0;
    150 }
    151 #endif
    152 
    153148void PluginProxy::geometryDidChange(const IntRect& frameRect, const IntRect& clipRect)
    154149{
     
    156151
    157152    m_frameRect = frameRect;
     153
     154    if (!needsBackingStore()) {
     155        SharedMemory::Handle pluginBackingStoreHandle;
     156        m_connection->connection()->send(Messages::PluginControllerProxy::GeometryDidChange(frameRect, clipRect, pluginBackingStoreHandle), m_pluginInstanceID);
     157        return;
     158    }
    158159
    159160    bool didUpdateBackingStore = false;
  • trunk/WebKit2/WebProcess/Plugins/PluginProxy.h

    r70927 r71270  
    3131#include "Connection.h"
    3232#include "Plugin.h"
     33
     34#if PLATFORM(MAC)
     35#include <wtf/RetainPtr.h>
     36#ifdef __OBJC__
     37@class CALayer;
     38#else
     39class CALayer;
     40#endif
     41#endif
    3342
    3443namespace WebCore {
     
    92101    virtual PluginController* controller();
    93102
     103    bool needsBackingStore() const;
     104
    94105    // Message handlers.
    95106    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);
     
    122133    // Whether we're called invalidate in response to an update call, and are now waiting for a paint call.
    123134    bool m_waitingForPaintInResponseToUpdate;
     135
     136    // 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.
     137    uint32_t m_remoteLayerClientID;
     138
     139#if PLATFORM(MAC)
     140    RetainPtr<CALayer> m_pluginLayer;
     141#endif
    124142};
    125143
  • trunk/WebKit2/WebProcess/WebPage/LayerBackedDrawingArea.cpp

    r71261 r71270  
    4343    : DrawingArea(LayerBackedDrawingAreaType, identifier, webPage)
    4444    , m_syncTimer(WebProcess::shared().runLoop(), this, &LayerBackedDrawingArea::syncCompositingLayers)
    45 #if PLATFORM(MAC) && HAVE(HOSTED_CORE_ANIMATION)
    46     , m_remoteLayerRef(0)
    47 #endif
    4845    , m_attached(false)
    4946    , m_shouldPaint(true)
  • trunk/WebKit2/WebProcess/WebPage/mac/LayerBackedDrawingAreaMac.mm

    r70920 r71270  
    6262#if HAVE(HOSTED_CORE_ANIMATION)
    6363    WKCARemoteLayerClientInvalidate(m_remoteLayerRef.get());
    64     m_remoteLayerRef = 0;
     64    m_remoteLayerRef = nullptr;
    6565#endif
    6666
Note: See TracChangeset for help on using the changeset viewer.