Changeset 77139 in webkit


Ignore:
Timestamp:
Jan 31, 2011 10:08:11 AM (13 years ago)
Author:
andersca@apple.com
Message:

2011-01-31 Anders Carlsson <andersca@apple.com>

Reviewed by Adam Roben.

Make LayerTreeHost an abstract base class and make LayerTreeHostMac inherit from it
https://bugs.webkit.org/show_bug.cgi?id=53432

  • WebKit2.xcodeproj/project.pbxproj: Add LayerTreeHostMac.h.
  • WebProcess/WebPage/DrawingAreaImpl.cpp:
  • WebProcess/WebPage/DrawingAreaImpl.h: Make m_layerTreeHost an OwnPtr and initialize/destroy it appropriately.
  • WebProcess/WebPage/LayerTreeHost.cpp: (WebKit::LayerTreeHost::create): On Mac, create a LayerTreeHostMac instance.

(WebKit::LayerTreeHost::~LayerTreeHost):
No need to call platformInvalidate anymore.

  • WebProcess/WebPage/LayerTreeHost.h:
  • WebProcess/WebPage/mac/LayerTreeHostMac.h: Added.
  • WebProcess/WebPage/mac/LayerTreeHostMac.mm: (WebKit::LayerTreeHostMac::~LayerTreeHostMac): Invalidate the run loop observer here instead of in platformInvalidate.

(WebKit::LayerTreeHostMac::scheduleLayerFlush):
(WebKit::LayerTreeHostMac::flushPendingLayerChangesRunLoopObserverCallback):
These are now members of LayerTreeHostMac.

Location:
trunk/Source/WebKit2
Files:
1 added
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r77104 r77139  
     12011-01-31  Anders Carlsson  <andersca@apple.com>
     2
     3        Reviewed by Adam Roben.
     4
     5        Make LayerTreeHost an abstract base class and make LayerTreeHostMac inherit from it
     6        https://bugs.webkit.org/show_bug.cgi?id=53432
     7
     8        * WebKit2.xcodeproj/project.pbxproj:
     9        Add LayerTreeHostMac.h.
     10
     11        * WebProcess/WebPage/DrawingAreaImpl.cpp:
     12        * WebProcess/WebPage/DrawingAreaImpl.h:
     13        Make m_layerTreeHost an OwnPtr and initialize/destroy it appropriately.
     14
     15        * WebProcess/WebPage/LayerTreeHost.cpp:
     16        (WebKit::LayerTreeHost::create):
     17        On Mac, create a LayerTreeHostMac instance.
     18
     19        (WebKit::LayerTreeHost::~LayerTreeHost):
     20        No need to call platformInvalidate anymore.
     21
     22        * WebProcess/WebPage/LayerTreeHost.h:
     23        * WebProcess/WebPage/mac/LayerTreeHostMac.h: Added.
     24        * WebProcess/WebPage/mac/LayerTreeHostMac.mm:
     25        (WebKit::LayerTreeHostMac::~LayerTreeHostMac):
     26        Invalidate the run loop observer here instead of in platformInvalidate.
     27
     28        (WebKit::LayerTreeHostMac::scheduleLayerFlush):
     29        (WebKit::LayerTreeHostMac::flushPendingLayerChangesRunLoopObserverCallback):
     30        These are now members of LayerTreeHostMac.
     31
    1322011-01-30  Geoffrey Garen  <ggaren@apple.com>
    233
  • trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj

    r77012 r77139  
    144144                1A64256912DE42EC00CAAE2C /* BackingStore.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A64256712DE42EC00CAAE2C /* BackingStore.cpp */; };
    145145                1A64292D12DE5F9800CAAE2C /* BackingStoreMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1A64292C12DE5F9800CAAE2C /* BackingStoreMac.mm */; };
     146                1A690D1712F39E3300ECD289 /* LayerTreeHostMac.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A690D1612F39E3300ECD289 /* LayerTreeHostMac.h */; };
    146147                1A6F9F9011E13EFC00DB1371 /* CommandLine.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A6F9F8E11E13EFC00DB1371 /* CommandLine.h */; };
    147148                1A6F9FB711E1408500DB1371 /* CommandLineMac.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A6F9FB611E1408500DB1371 /* CommandLineMac.cpp */; };
     
    890891                1A64256712DE42EC00CAAE2C /* BackingStore.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = BackingStore.cpp; sourceTree = "<group>"; };
    891892                1A64292C12DE5F9800CAAE2C /* BackingStoreMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = BackingStoreMac.mm; sourceTree = "<group>"; };
     893                1A690D1612F39E3300ECD289 /* LayerTreeHostMac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LayerTreeHostMac.h; sourceTree = "<group>"; };
    892894                1A6F9F8E11E13EFC00DB1371 /* CommandLine.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CommandLine.h; sourceTree = "<group>"; };
    893895                1A6F9FB611E1408500DB1371 /* CommandLineMac.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CommandLineMac.cpp; sourceTree = "<group>"; };
     
    25762578                                BC5F7BB8118237990052C02C /* ChunkedUpdateDrawingAreaMac.cpp */,
    25772579                                0F5265B511DD37700006D33C /* LayerBackedDrawingAreaMac.mm */,
     2580                                1A690D1612F39E3300ECD289 /* LayerTreeHostMac.h */,
    25782581                                1A18718412EF9877008E5F37 /* LayerTreeHostMac.mm */,
    25792582                                1C8E2DAD1278C5B200BC7BD0 /* WebInspectorMac.mm */,
     
    31163119                                1A9636BD12F348490078A062 /* ShareableSurface.h in Headers */,
    31173120                                1A9639F712F38ECD0078A062 /* CoreAnimationRenderer.h in Headers */,
     3121                                1A690D1712F39E3300ECD289 /* LayerTreeHostMac.h in Headers */,
    31183122                        );
    31193123                        runOnlyForDeploymentPostprocessing = 0;
  • trunk/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.cpp

    r76916 r77139  
    5757    , m_isPaintingSuspended(!parameters.isVisible)
    5858    , m_displayTimer(WebProcess::shared().runLoop(), this, &DrawingAreaImpl::display)
    59     , m_layerTreeHost(webPage)
    6059{
    6160}
     
    129128{
    130129    if (graphicsLayer)
    131         m_layerTreeHost.attachRootCompositingLayer(graphicsLayer);
     130        m_layerTreeHost = LayerTreeHost::create(m_webPage, graphicsLayer);
    132131    else
    133         m_layerTreeHost.detachRootCompositingLayer();
     132        m_layerTreeHost = nullptr;
    134133}
    135134
    136135void DrawingAreaImpl::scheduleCompositingLayerSync()
    137136{
    138     m_layerTreeHost.scheduleLayerFlush();
     137    if (!m_layerTreeHost)
     138        return;
     139    m_layerTreeHost->scheduleLayerFlush();
    139140}
    140141
  • trunk/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.h

    r76649 r77139  
    7979    RunLoop::Timer<DrawingAreaImpl> m_displayTimer;
    8080
    81     // The layer tree host which handles accelerated compositing.
    82     LayerTreeHost m_layerTreeHost;
     81    // The layer tree host that handles accelerated compositing.
     82    OwnPtr<LayerTreeHost> m_layerTreeHost;
    8383};
    8484
  • trunk/Source/WebKit2/WebProcess/WebPage/LayerTreeHost.cpp

    r76991 r77139  
    3232#include "WebPage.h"
    3333
    34 #if !PLATFORM(MAC)
     34#if PLATFORM(MAC)
     35#include "LayerTreeHostMac.h"
     36#else
    3537#error "This class is not ready for use by other ports yet."
    3638#endif
     
    3941
    4042namespace WebKit {
     43
     44PassOwnPtr<LayerTreeHost> LayerTreeHost::create(WebPage* webPage, GraphicsLayer* graphicsLayer)
     45{
     46#if PLATFORM(MAC)
     47    return adoptPtr(static_cast<LayerTreeHost*>(new LayerTreeHostMac(webPage, graphicsLayer)));
     48#endif
     49
     50    return 0;
     51}
    4152
    4253LayerTreeHost::LayerTreeHost(WebPage* webPage)
     
    4758LayerTreeHost::~LayerTreeHost()
    4859{
    49     platformInvalidate();
    50 }
    51 
    52 void LayerTreeHost::attachRootCompositingLayer(GraphicsLayer* graphicsLayer)
    53 {
    54     // FIXME: Implement.
    55 }
    56 
    57 void LayerTreeHost::detachRootCompositingLayer()
    58 {
    59     // FIXME: Implement.
    6060}
    6161
  • trunk/Source/WebKit2/WebProcess/WebPage/LayerTreeHost.h

    r76653 r77139  
    2828
    2929#include <wtf/Noncopyable.h>
     30#include <wtf/PassOwnPtr.h>
    3031
    3132#if PLATFORM(MAC)
     
    4546
    4647public:
     48    static PassOwnPtr<LayerTreeHost> create(WebPage*, WebCore::GraphicsLayer*);
     49    virtual ~LayerTreeHost();
     50
     51    virtual void scheduleLayerFlush() = 0;
     52
     53protected:
    4754    explicit LayerTreeHost(WebPage*);
    48     ~LayerTreeHost();
    49 
    50     void attachRootCompositingLayer(WebCore::GraphicsLayer*);
    51     void detachRootCompositingLayer();
    52 
    53     void scheduleLayerFlush();
     55    bool flushPendingLayerChanges();
    5456
    5557private:
    5658    void platformInvalidate();
    57 
    58     bool flushPendingLayerChanges();
    59 
    60 #if PLATFORM(MAC)
    61     static void flushPendingLayerChangesRunLoopObserverCallback(CFRunLoopObserverRef, CFRunLoopActivity, void*);
    62     void flushPendingLayerChangesRunLoopObserverCallback();
    63    
    64     RetainPtr<CFRunLoopObserverRef> m_flushPendingLayerChangesRunLoopObserver;
    65 #endif
    6659
    6760    WebPage* m_webPage;
  • trunk/Source/WebKit2/WebProcess/WebPage/mac/LayerTreeHostMac.mm

    r76991 r77139  
    2525
    2626#import "config.h"
    27 #import "LayerTreeHost.h"
     27#import "LayerTreeHostMac.h"
     28
     29using namespace WebCore;
    2830
    2931namespace WebKit {
    3032
    31 void LayerTreeHost::scheduleLayerFlush()
     33LayerTreeHostMac::LayerTreeHostMac(WebPage* webPage, GraphicsLayer* graphicsLayer)
     34    : LayerTreeHost(webPage)
     35{
     36}
     37
     38LayerTreeHostMac::~LayerTreeHostMac()
     39{
     40    if (m_flushPendingLayerChangesRunLoopObserver)
     41        CFRunLoopObserverInvalidate(m_flushPendingLayerChangesRunLoopObserver.get());
     42}
     43
     44void LayerTreeHostMac::scheduleLayerFlush()
    3245{
    3346    CFRunLoopRef currentRunLoop = CFRunLoopGetCurrent();
     
    4760}
    4861
    49 void LayerTreeHost::platformInvalidate()
     62void LayerTreeHostMac::flushPendingLayerChangesRunLoopObserverCallback(CFRunLoopObserverRef, CFRunLoopActivity, void* context)
    5063{
    51     if (m_flushPendingLayerChangesRunLoopObserver)
    52         CFRunLoopObserverInvalidate(m_flushPendingLayerChangesRunLoopObserver.get());
     64    static_cast<LayerTreeHostMac*>(context)->flushPendingLayerChangesRunLoopObserverCallback();
    5365}
    5466
    55 void LayerTreeHost::flushPendingLayerChangesRunLoopObserverCallback(CFRunLoopObserverRef, CFRunLoopActivity, void* context)
    56 {
    57     static_cast<LayerTreeHost*>(context)->flushPendingLayerChangesRunLoopObserverCallback();
    58 }
    59 
    60 void LayerTreeHost::flushPendingLayerChangesRunLoopObserverCallback()
     67void LayerTreeHostMac::flushPendingLayerChangesRunLoopObserverCallback()
    6168{
    6269    if (!flushPendingLayerChanges())
Note: See TracChangeset for help on using the changeset viewer.