Rename WKCACFLayerRenderer[Client] to CACFLayerTreeHost[Client]
authoraroben@apple.com <aroben@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 21 Jan 2011 19:32:59 +0000 (19:32 +0000)
committeraroben@apple.com <aroben@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 21 Jan 2011 19:32:59 +0000 (19:32 +0000)
Also renamed a few functions and data members to match.

Fixes <http://webkit.org/b/52898> WKCACFLayerRenderer sounds like a render object, but isn't

Reviewed by Simon Fraser.

Source/WebCore:

* WebCore.vcproj/WebCore.vcproj: Updated files' names and paths.

* WebCore.vcproj/WebCoreQuartzCore.vsprops: Added platform/graphics/ca/win to the include
path.

* WebCore.vcproj/copyForwardingHeaders.cmd: Copy headers from platform/graphics/ca/win, too.

* platform/graphics/ca/win/CACFLayerTreeHost.cpp: Renamed from Source/WebCore/platform/graphics/win/WKCACFLayerRenderer.cpp.
* platform/graphics/ca/win/CACFLayerTreeHost.h: Renamed from Source/WebCore/platform/graphics/win/WKCACFLayerRenderer.h.

* platform/graphics/ca/win/PlatformCALayerWin.cpp:
* platform/graphics/win/MediaPlayerPrivateFullscreenWindow.cpp:
* platform/graphics/win/MediaPlayerPrivateFullscreenWindow.h:
Updated for renames.

Source/WebKit/win:

Update for WKCACFLayerRenderer -> CACFLayerTreeHost rename

Also renamed WebView::m_layerRenderer to WebView::m_layerTreeHost to match.

* WebPreferences.cpp:
* WebView.cpp:
(WebView::setAcceleratedCompositing): Also made sure to remove our HWND from the layer tree
host before we get rid of the layer tree host itself.
* WebView.h:

Source/WebKit2:

Update for WKCACFLayerRenderer -> CACFLayerView rename

* WebProcess/WebPage/win/LayerBackedDrawingAreaWin.cpp: Just removed all the unnecessary
 #includes.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@76370 268f45cc-cd09-0410-ab3c-d52691b4dbfc

15 files changed:
Source/WebCore/ChangeLog
Source/WebCore/WebCore.vcproj/WebCore.vcproj
Source/WebCore/WebCore.vcproj/WebCoreQuartzCore.vsprops
Source/WebCore/WebCore.vcproj/copyForwardingHeaders.cmd
Source/WebCore/platform/graphics/ca/win/CACFLayerTreeHost.cpp [moved from Source/WebCore/platform/graphics/win/WKCACFLayerRenderer.cpp with 89% similarity]
Source/WebCore/platform/graphics/ca/win/CACFLayerTreeHost.h [moved from Source/WebCore/platform/graphics/win/WKCACFLayerRenderer.h with 82% similarity]
Source/WebCore/platform/graphics/ca/win/PlatformCALayerWin.cpp
Source/WebCore/platform/graphics/win/MediaPlayerPrivateFullscreenWindow.cpp
Source/WebCore/platform/graphics/win/MediaPlayerPrivateFullscreenWindow.h
Source/WebKit/win/ChangeLog
Source/WebKit/win/WebPreferences.cpp
Source/WebKit/win/WebView.cpp
Source/WebKit/win/WebView.h
Source/WebKit2/ChangeLog
Source/WebKit2/WebProcess/WebPage/win/LayerBackedDrawingAreaWin.cpp

index 3d87938..2a366e3 100644 (file)
@@ -1,3 +1,28 @@
+2011-01-21  Adam Roben  <aroben@apple.com>
+
+        Rename WKCACFLayerRenderer[Client] to CACFLayerTreeHost[Client]
+
+        Also renamed a few functions and data members to match.
+
+        Fixes <http://webkit.org/b/52898> WKCACFLayerRenderer sounds like a render object, but isn't
+
+        Reviewed by Simon Fraser.
+
+        * WebCore.vcproj/WebCore.vcproj: Updated files' names and paths.
+
+        * WebCore.vcproj/WebCoreQuartzCore.vsprops: Added platform/graphics/ca/win to the include
+        path.
+
+        * WebCore.vcproj/copyForwardingHeaders.cmd: Copy headers from platform/graphics/ca/win, too.
+
+        * platform/graphics/ca/win/CACFLayerTreeHost.cpp: Renamed from Source/WebCore/platform/graphics/win/WKCACFLayerRenderer.cpp.
+        * platform/graphics/ca/win/CACFLayerTreeHost.h: Renamed from Source/WebCore/platform/graphics/win/WKCACFLayerRenderer.h.
+
+        * platform/graphics/ca/win/PlatformCALayerWin.cpp:
+        * platform/graphics/win/MediaPlayerPrivateFullscreenWindow.cpp:
+        * platform/graphics/win/MediaPlayerPrivateFullscreenWindow.h:
+        Updated for renames.
+
 2011-01-21  Patrick Gansterer  <paroga@paroga.com>
 
         Original patch from Fran├žois Sausset  <sausset@gmail.com>
index 5c30699..165a193 100755 (executable)
                                                >
                                        </File>
                                        <File
-                                               RelativePath="..\platform\graphics\win\WKCACFLayerRenderer.cpp"
-                                               >
-                                               <FileConfiguration
-                                                       Name="Debug_Cairo_CFLite|Win32"
-                                                       ExcludedFromBuild="true"
-                                                       >
-                                                       <Tool
-                                                               Name="VCCLCompilerTool"
-                                                       />
-                                               </FileConfiguration>
-                                               <FileConfiguration
-                                                       Name="Release_Cairo_CFLite|Win32"
-                                                       ExcludedFromBuild="true"
-                                                       >
-                                                       <Tool
-                                                               Name="VCCLCompilerTool"
-                                                       />
-                                               </FileConfiguration>
-                                       </File>
-                                       <File
-                                               RelativePath="..\platform\graphics\win\WKCACFLayerRenderer.h"
-                                               >
-                                               <FileConfiguration
-                                                       Name="Debug_Cairo_CFLite|Win32"
-                                                       ExcludedFromBuild="true"
-                                                       >
-                                                       <Tool
-                                                               Name="VCCustomBuildTool"
-                                                       />
-                                               </FileConfiguration>
-                                               <FileConfiguration
-                                                       Name="Release_Cairo_CFLite|Win32"
-                                                       ExcludedFromBuild="true"
-                                                       >
-                                                       <Tool
-                                                               Name="VCCustomBuildTool"
-                                                       />
-                                               </FileConfiguration>
-                                       </File>
-                                       <File
                                                RelativePath="..\platform\graphics\win\WKCAImageQueue.cpp"
                                                >
                                                <FileConfiguration
                                                Name="win"
                                                >
                                                <File
+                                                       RelativePath="..\platform\graphics\ca\win\CACFLayerTreeHost.cpp"
+                                                       >
+                                                       <FileConfiguration
+                                                               Name="Debug_Cairo_CFLite|Win32"
+                                                               ExcludedFromBuild="true"
+                                                               >
+                                                               <Tool
+                                                                       Name="VCCLCompilerTool"
+                                                               />
+                                                       </FileConfiguration>
+                                                       <FileConfiguration
+                                                               Name="Release_Cairo_CFLite|Win32"
+                                                               ExcludedFromBuild="true"
+                                                               >
+                                                               <Tool
+                                                                       Name="VCCLCompilerTool"
+                                                               />
+                                                       </FileConfiguration>
+                                               </File>
+                                               <File
+                                                       RelativePath="..\platform\graphics\ca\win\CACFLayerTreeHost.h"
+                                                       >
+                                                       <FileConfiguration
+                                                               Name="Debug_Cairo_CFLite|Win32"
+                                                               ExcludedFromBuild="true"
+                                                               >
+                                                               <Tool
+                                                                       Name="VCCustomBuildTool"
+                                                               />
+                                                       </FileConfiguration>
+                                                       <FileConfiguration
+                                                               Name="Release_Cairo_CFLite|Win32"
+                                                               ExcludedFromBuild="true"
+                                                               >
+                                                               <Tool
+                                                                       Name="VCCustomBuildTool"
+                                                               />
+                                                       </FileConfiguration>
+                                               </File>
+                                               <File
                                                        RelativePath="..\platform\graphics\ca\win\PlatformCAAnimationWin.cpp"
                                                        >
                                                </File>
index a9866d9..48328c9 100644 (file)
@@ -6,7 +6,7 @@
        >
        <Tool
                Name="VCCLCompilerTool"
-               AdditionalIncludeDirectories="&quot;$(DXSDK_DIR)\Include&quot;"
+               AdditionalIncludeDirectories="&quot;$(ProjectDir)\..\platform\graphics\ca\win&quot;;&quot;$(DXSDK_DIR)\Include&quot;"
                PreprocessorDefinitions="QUARTZCORE_DLL"
        />
 </VisualStudioPropertySheet>
index 7393d34..b3f19c6 100755 (executable)
@@ -39,6 +39,7 @@ xcopy /y /d "%ProjectDir%..\platform\graphics\*.h" "%CONFIGURATIONBUILDDIR%\incl
 xcopy /y /d "%ProjectDir%..\platform\graphics\%1\*.h" "%CONFIGURATIONBUILDDIR%\include\WebCore"
 xcopy /y /d "%ProjectDir%..\platform\graphics\transforms\*.h" "%CONFIGURATIONBUILDDIR%\include\WebCore"
 xcopy /y /d "%ProjectDir%..\platform\graphics\ca\*.h" "%CONFIGURATIONBUILDDIR%\include\WebCore"
+xcopy /y /d "%ProjectDir%..\platform\graphics\ca\win\*.h" "%CONFIGURATIONBUILDDIR%\include\WebCore"
 xcopy /y /d "%ProjectDir%..\platform\graphics\win\*.h" "%CONFIGURATIONBUILDDIR%\include\WebCore"
 xcopy /y /d "%ProjectDir%..\platform\graphics\win\%1\*.h" "%CONFIGURATIONBUILDDIR%\include\WebCore"
 xcopy /y /d "%ProjectDir%..\platform\graphics\opentype\*.h" "%CONFIGURATIONBUILDDIR%\include\WebCore"
@@ -31,7 +31,7 @@
 #define D3D_DEBUG_INFO
 #endif
 
-#include "WKCACFLayerRenderer.h"
+#include "CACFLayerTreeHost.h"
 
 #include "PlatformCALayer.h"
 #include "WebCoreInstanceHandle.h"
@@ -116,7 +116,7 @@ static bool hardwareCapabilitiesIndicateCoreAnimationSupport(const D3DCAPS9& cap
     return true;
 }
 
-bool WKCACFLayerRenderer::acceleratedCompositingAvailable()
+bool CACFLayerTreeHost::acceleratedCompositingAvailable()
 {
     static bool available;
     static bool tested;
@@ -164,28 +164,28 @@ bool WKCACFLayerRenderer::acceleratedCompositingAvailable()
         return available;
     }
 
-    RefPtr<WKCACFLayerRenderer> testLayerRenderer = WKCACFLayerRenderer::create();
-    testLayerRenderer->setHostWindow(testWindow);
-    available = testLayerRenderer->createRenderer();
+    RefPtr<CACFLayerTreeHost> host = CACFLayerTreeHost::create();
+    host->setWindow(testWindow);
+    available = host->createRenderer();
     ::DestroyWindow(testWindow);
 
     return available;
 }
 
-PassRefPtr<WKCACFLayerRenderer> WKCACFLayerRenderer::create()
+PassRefPtr<CACFLayerTreeHost> CACFLayerTreeHost::create()
 {
     if (!acceleratedCompositingAvailable())
         return 0;
-    return adoptRef(new WKCACFLayerRenderer());
+    return adoptRef(new CACFLayerTreeHost());
 }
 
-WKCACFLayerRenderer::WKCACFLayerRenderer()
+CACFLayerTreeHost::CACFLayerTreeHost()
     : m_client(0)
     , m_mightBeAbleToCreateDeviceLater(true)
     , m_rootLayer(PlatformCALayer::create(PlatformCALayer::LayerTypeRootLayer, 0))
     , m_context(wkCACFContextCreate())
-    , m_hostWindow(0)
-    , m_renderTimer(this, &WKCACFLayerRenderer::renderTimerFired)
+    , m_window(0)
+    , m_renderTimer(this, &CACFLayerTreeHost::renderTimerFired)
     , m_mustResetLostDeviceBeforeRendering(false)
     , m_shouldFlushPendingGraphicsLayerChanges(false)
 {
@@ -201,7 +201,7 @@ WKCACFLayerRenderer::WKCACFLayerRenderer()
     // cause any repositioning.
     // Scrolling will affect only the position of the scroll layer without affecting the bounds.
 
-    m_rootLayer->setName("WKCACFLayerRenderer rootLayer");
+    m_rootLayer->setName("CACFLayerTreeHost rootLayer");
     m_rootLayer->setAnchorPoint(FloatPoint3D(0, 0, 0));
     m_rootLayer->setGeometryFlipped(true);
 
@@ -220,37 +220,37 @@ WKCACFLayerRenderer::WKCACFLayerRenderer()
 #endif
 }
 
-WKCACFLayerRenderer::~WKCACFLayerRenderer()
+CACFLayerTreeHost::~CACFLayerTreeHost()
 {
-    setHostWindow(0);
+    setWindow(0);
     wkCACFContextDestroy(m_context);
 }
 
-void WKCACFLayerRenderer::setHostWindow(HWND window)
+void CACFLayerTreeHost::setWindow(HWND window)
 {
-    if (window == m_hostWindow)
+    if (window == m_window)
         return;
 
-    if (m_hostWindow)
+    if (m_window)
         destroyRenderer();
 
-    m_hostWindow = window;
+    m_window = window;
 
-    if (m_hostWindow)
+    if (m_window)
         createRenderer();
 }
 
-PlatformCALayer* WKCACFLayerRenderer::rootLayer() const
+PlatformCALayer* CACFLayerTreeHost::rootLayer() const
 {
     return m_rootLayer.get();
 }
 
-void WKCACFLayerRenderer::addPendingAnimatedLayer(PassRefPtr<PlatformCALayer> layer)
+void CACFLayerTreeHost::addPendingAnimatedLayer(PassRefPtr<PlatformCALayer> layer)
 {
     m_pendingAnimatedLayers.add(layer);
 }
 
-void WKCACFLayerRenderer::setRootChildLayer(PlatformCALayer* layer)
+void CACFLayerTreeHost::setRootChildLayer(PlatformCALayer* layer)
 {
     m_rootLayer->removeAllSublayers();
     m_rootChildLayer = layer;
@@ -258,12 +258,12 @@ void WKCACFLayerRenderer::setRootChildLayer(PlatformCALayer* layer)
         m_rootLayer->appendSublayer(m_rootChildLayer.get());
 }
    
-void WKCACFLayerRenderer::layerTreeDidChange()
+void CACFLayerTreeHost::layerTreeDidChange()
 {
     renderSoon();
 }
 
-bool WKCACFLayerRenderer::createRenderer()
+bool CACFLayerTreeHost::createRenderer()
 {
     if (m_d3dDevice || !m_mightBeAbleToCreateDeviceLater)
         return m_d3dDevice;
@@ -271,14 +271,14 @@ bool WKCACFLayerRenderer::createRenderer()
     m_mightBeAbleToCreateDeviceLater = false;
     D3DPRESENT_PARAMETERS parameters = initialPresentationParameters();
 
-    if (!d3d() || !::IsWindow(m_hostWindow))
+    if (!d3d() || !::IsWindow(m_window))
         return false;
 
     // D3D doesn't like to make back buffers for 0 size windows. We skirt this problem if we make the
     // passed backbuffer width and height non-zero. The window will necessarily get set to a non-zero
     // size eventually, and then the backbuffer size will get reset.
     RECT rect;
-    GetClientRect(m_hostWindow, &rect);
+    GetClientRect(m_window, &rect);
 
     if (rect.left-rect.right == 0 || rect.bottom-rect.top == 0) {
         parameters.BackBufferWidth = 1;
@@ -296,7 +296,7 @@ bool WKCACFLayerRenderer::createRenderer()
         behaviorFlags |= D3DCREATE_SOFTWARE_VERTEXPROCESSING;
 
     COMPtr<IDirect3DDevice9> device;
-    if (FAILED(d3d()->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, m_hostWindow, behaviorFlags, &parameters, &device))) {
+    if (FAILED(d3d()->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, m_window, behaviorFlags, &parameters, &device))) {
         // In certain situations (e.g., shortly after waking from sleep), Direct3DCreate9() will
         // return an IDirect3D9 for which IDirect3D9::CreateDevice will always fail. In case we
         // have one of these bad IDirect3D9s, get rid of it so we'll fetch a new one the next time
@@ -329,13 +329,13 @@ bool WKCACFLayerRenderer::createRenderer()
 
     wkCACFContextSetD3DDevice(m_context, m_d3dDevice.get());
 
-    if (IsWindow(m_hostWindow))
+    if (IsWindow(m_window))
         m_rootLayer->setBounds(bounds());
 
     return true;
 }
 
-void WKCACFLayerRenderer::destroyRenderer()
+void CACFLayerTreeHost::destroyRenderer()
 {
     wkCACFContextSetLayer(m_context, m_rootLayer->platformLayer());
 
@@ -351,7 +351,7 @@ void WKCACFLayerRenderer::destroyRenderer()
     m_mightBeAbleToCreateDeviceLater = true;
 }
 
-void WKCACFLayerRenderer::resize()
+void CACFLayerTreeHost::resize()
 {
     if (!m_d3dDevice)
         return;
@@ -396,12 +396,12 @@ static void getDirtyRects(HWND window, Vector<CGRect>& outRects)
         outRects[i] = winRectToCGRect(*rect, clientRect);
 }
 
-void WKCACFLayerRenderer::renderTimerFired(Timer<WKCACFLayerRenderer>*)
+void CACFLayerTreeHost::renderTimerFired(Timer<CACFLayerTreeHost>*)
 {
     paint();
 }
 
-void WKCACFLayerRenderer::paint()
+void CACFLayerTreeHost::paint()
 {
     createRenderer();
     if (!m_d3dDevice) {
@@ -411,11 +411,11 @@ void WKCACFLayerRenderer::paint()
     }
 
     Vector<CGRect> dirtyRects;
-    getDirtyRects(m_hostWindow, dirtyRects);
+    getDirtyRects(m_window, dirtyRects);
     render(dirtyRects);
 }
 
-void WKCACFLayerRenderer::render(const Vector<CGRect>& windowDirtyRects)
+void CACFLayerTreeHost::render(const Vector<CGRect>& windowDirtyRects)
 {
     ASSERT(m_d3dDevice);
 
@@ -517,27 +517,27 @@ void WKCACFLayerRenderer::render(const Vector<CGRect>& windowDirtyRects)
         renderSoon();
 }
 
-void WKCACFLayerRenderer::renderSoon()
+void CACFLayerTreeHost::renderSoon()
 {
     if (!m_renderTimer.isActive())
         m_renderTimer.startOneShot(0);
 }
 
-void WKCACFLayerRenderer::flushPendingGraphicsLayerChangesSoon()
+void CACFLayerTreeHost::flushPendingGraphicsLayerChangesSoon()
 {
     m_shouldFlushPendingGraphicsLayerChanges = true;
     renderSoon();
 }
 
-CGRect WKCACFLayerRenderer::bounds() const
+CGRect CACFLayerTreeHost::bounds() const
 {
     RECT clientRect;
-    GetClientRect(m_hostWindow, &clientRect);
+    GetClientRect(m_window, &clientRect);
 
     return winRectToCGRect(clientRect);
 }
 
-void WKCACFLayerRenderer::initD3DGeometry()
+void CACFLayerTreeHost::initD3DGeometry()
 {
     ASSERT(m_d3dDevice);
 
@@ -554,7 +554,7 @@ void WKCACFLayerRenderer::initD3DGeometry()
     m_d3dDevice->SetTransform(D3DTS_PROJECTION, &projection);
 }
 
-bool WKCACFLayerRenderer::resetDevice(ResetReason reason)
+bool CACFLayerTreeHost::resetDevice(ResetReason reason)
 {
     ASSERT(m_d3dDevice);
     ASSERT(m_context);
@@ -23,8 +23,8 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
  */
 
-#ifndef WKCACFLayerRenderer_h
-#define WKCACFLayerRenderer_h
+#ifndef CACFLayerTreeHost_h
+#define CACFLayerTreeHost_h
 
 #if USE(ACCELERATED_COMPOSITING)
 
@@ -49,30 +49,30 @@ namespace WebCore {
 
 class PlatformCALayer;
 
-class WKCACFLayerRendererClient {
+class CACFLayerTreeHostClient {
 public:
-    virtual ~WKCACFLayerRendererClient() { }
+    virtual ~CACFLayerTreeHostClient() { }
     virtual bool shouldRender() const = 0;
     virtual void flushPendingGraphicsLayerChanges() { }
 };
 
-// FIXME: Currently there is a WKCACFLayerRenderer for each WebView and each
+// FIXME: Currently there is a CACFLayerTreeHost for each WebView and each
 // has its own CARenderOGLContext and Direct3DDevice9, which is inefficient.
 // (https://bugs.webkit.org/show_bug.cgi?id=31855)
-class WKCACFLayerRenderer : public RefCounted<WKCACFLayerRenderer> {
+class CACFLayerTreeHost : public RefCounted<CACFLayerTreeHost> {
     friend PlatformCALayer;
 
 public:
-    static PassRefPtr<WKCACFLayerRenderer> create();
-    ~WKCACFLayerRenderer();
+    static PassRefPtr<CACFLayerTreeHost> create();
+    ~CACFLayerTreeHost();
 
     static bool acceleratedCompositingAvailable();
 
-    void setClient(WKCACFLayerRendererClient* client) { m_client = client; }
+    void setClient(CACFLayerTreeHostClient* client) { m_client = client; }
 
     void setRootChildLayer(PlatformCALayer*);
     void layerTreeDidChange();
-    void setHostWindow(HWND);
+    void setWindow(HWND);
     void paint();
     void resize();
     void flushPendingGraphicsLayerChangesSoon();
@@ -82,12 +82,12 @@ protected:
     void addPendingAnimatedLayer(PassRefPtr<PlatformCALayer>);
 
 private:
-    WKCACFLayerRenderer();
+    CACFLayerTreeHost();
 
     bool createRenderer();
     void destroyRenderer();
     void renderSoon();
-    void renderTimerFired(Timer<WKCACFLayerRenderer>*);
+    void renderTimerFired(Timer<CACFLayerTreeHost>*);
 
     CGRect bounds() const;
 
@@ -101,14 +101,14 @@ private:
 
     void render(const Vector<CGRect>& dirtyRects = Vector<CGRect>());
 
-    WKCACFLayerRendererClient* m_client;
+    CACFLayerTreeHostClient* m_client;
     bool m_mightBeAbleToCreateDeviceLater;
     COMPtr<IDirect3DDevice9> m_d3dDevice;
     RefPtr<PlatformCALayer> m_rootLayer;
     RefPtr<PlatformCALayer> m_rootChildLayer;
     WKCACFContext* m_context;
-    HWND m_hostWindow;
-    Timer<WKCACFLayerRenderer> m_renderTimer;
+    HWND m_window;
+    Timer<CACFLayerTreeHost> m_renderTimer;
     bool m_mustResetLostDeviceBeforeRendering;
     bool m_shouldFlushPendingGraphicsLayerChanges;
     HashSet<RefPtr<PlatformCALayer> > m_pendingAnimatedLayers;
@@ -122,4 +122,4 @@ private:
 
 #endif // USE(ACCELERATED_COMPOSITING)
 
-#endif // WKCACFLayerRenderer_h
+#endif // CACFLayerTreeHost_h
index 66d0732..b5a26f4 100644 (file)
 
 #include "PlatformCALayer.h"
 
+#include "CACFLayerTreeHost.h"
 #include "Font.h"
 #include "GraphicsContext.h"
 #include "PlatformCALayerWinInternal.h"
-#include "WKCACFLayerRenderer.h"
 #include <QuartzCore/CoreAnimationCF.h>
 #include <WebKitSystemInterface/WebKitSystemInterface.h>
 #include <wtf/CurrentTime.h>
@@ -65,14 +65,14 @@ static CFStringRef toCACFFilterType(PlatformCALayer::FilterType type)
     }
 }
 
-static WKCACFLayerRenderer* rendererForLayer(const PlatformCALayer* layer)
+static CACFLayerTreeHost* layerTreeHostForLayer(const PlatformCALayer* layer)
 {
-    // We need the WKCACFLayerRenderer associated with this layer, which is stored in the UserData of the CACFContext
+    // We need the CACFLayerTreeHost associated with this layer, which is stored in the UserData of the CACFContext
     void* userData = wkCACFLayerGetContextUserData(layer->platformLayer());
     if (!userData)
         return 0;
 
-    return static_cast<WKCACFLayerRenderer*>(userData);
+    return static_cast<CACFLayerTreeHost*>(userData);
 }
 
 static PlatformCALayerWinInternal* intern(const PlatformCALayer* layer)
@@ -156,8 +156,8 @@ PlatformLayer* PlatformCALayer::platformLayer() const
 
 PlatformCALayer* PlatformCALayer::rootLayer() const
 {
-    WKCACFLayerRenderer* renderer = rendererForLayer(this);
-    return renderer ? renderer->rootLayer() : 0;
+    CACFLayerTreeHost* host = layerTreeHostForLayer(this);
+    return host ? host->rootLayer() : 0;
 }
 
 void PlatformCALayer::setNeedsDisplay(const FloatRect* dirtyRect)
@@ -167,9 +167,9 @@ void PlatformCALayer::setNeedsDisplay(const FloatRect* dirtyRect)
     
 void PlatformCALayer::setNeedsCommit()
 {
-    WKCACFLayerRenderer* renderer = rendererForLayer(this);
-    if (renderer)
-        renderer->layerTreeDidChange();
+    CACFLayerTreeHost* host = layerTreeHostForLayer(this);
+    if (host)
+        host->layerTreeDidChange();
 }
 
 void PlatformCALayer::setContentsChanged()
@@ -269,10 +269,10 @@ void PlatformCALayer::addAnimationForKey(const String& key, PlatformCAAnimation*
     CACFLayerAddAnimation(m_layer.get(), s.get(), animation->platformAnimation());
     setNeedsCommit();
 
-    // Tell the renderer about it so we can fire the start animation event
-    WKCACFLayerRenderer* renderer = rendererForLayer(this);
-    if (renderer)
-        renderer->addPendingAnimatedLayer(this);
+    // Tell the host about it so we can fire the start animation event
+    CACFLayerTreeHost* host = layerTreeHostForLayer(this);
+    if (host)
+        host->addPendingAnimatedLayer(this);
 }
 
 void PlatformCALayer::removeAnimationForKey(const String& key)
@@ -283,7 +283,7 @@ void PlatformCALayer::removeAnimationForKey(const String& key)
     RetainPtr<CFStringRef> s(AdoptCF, key.createCFString());
     CACFLayerRemoveAnimation(m_layer.get(), s.get());
 
-    // We don't "remove" a layer from WKCACFLayerRenderer when it loses an animation.
+    // We don't "remove" a layer from CACFLayerTreeHost when it loses an animation.
     // There may be other active animations on the layer and if an animation
     // callback is fired on a layer without any animations no harm is done.
 
index 6f28860..01db7f2 100644 (file)
@@ -40,7 +40,7 @@ MediaPlayerPrivateFullscreenWindow::MediaPlayerPrivateFullscreenWindow(MediaPlay
     : m_client(client)
     , m_hwnd(0)
 #if USE(ACCELERATED_COMPOSITING)
-    , m_layerRenderer(WKCACFLayerRenderer::create())
+    , m_layerTreeHost(CACFLayerTreeHost::create())
 #endif
 {
 }
@@ -81,7 +81,7 @@ void MediaPlayerPrivateFullscreenWindow::createWindow(HWND parentHwnd)
     ASSERT(IsWindow(m_hwnd));
 
 #if USE(ACCELERATED_COMPOSITING)
-    m_layerRenderer->setHostWindow(m_hwnd);
+    m_layerTreeHost->setWindow(m_hwnd);
 #endif
 
     ::SetFocus(m_hwnd);
@@ -107,7 +107,7 @@ void MediaPlayerPrivateFullscreenWindow::setRootChildLayer(PassRefPtr<PlatformCA
     if (!m_rootChild)
         return;
 
-    m_layerRenderer->setRootChildLayer(m_rootChild.get());
+    m_layerTreeHost->setRootChildLayer(m_rootChild.get());
     PlatformCALayer* rootLayer = m_rootChild->rootLayer();
     CGRect rootBounds = m_rootChild->rootLayer()->bounds();
     m_rootChild->setFrame(rootBounds);
@@ -147,7 +147,7 @@ LRESULT MediaPlayerPrivateFullscreenWindow::wndProc(HWND hWnd, UINT message, WPA
     case WM_DESTROY:
         m_hwnd = 0;
 #if USE(ACCELERATED_COMPOSITING)
-        m_layerRenderer->setHostWindow(0);
+        m_layerTreeHost->setWindow(0);
 #endif
         break;
     case WM_WINDOWPOSCHANGED:
@@ -156,7 +156,7 @@ LRESULT MediaPlayerPrivateFullscreenWindow::wndProc(HWND hWnd, UINT message, WPA
             if (wp->flags & SWP_NOSIZE)
                 break;
 #if USE(ACCELERATED_COMPOSITING)
-            m_layerRenderer->resize();
+            m_layerTreeHost->resize();
             PlatformCALayer* rootLayer = m_rootChild->rootLayer();
             CGRect rootBounds = m_rootChild->rootLayer()->bounds();
             m_rootChild->setFrame(rootBounds);
@@ -166,7 +166,7 @@ LRESULT MediaPlayerPrivateFullscreenWindow::wndProc(HWND hWnd, UINT message, WPA
         break;
     case WM_PAINT:
 #if USE(ACCELERATED_COMPOSITING)
-        m_layerRenderer->paint();
+        m_layerTreeHost->paint();
         ::ValidateRect(m_hwnd, 0);
 #endif
         break;
index 4619f2a..c1ae762 100644 (file)
@@ -27,8 +27,8 @@
 #define MediaPlayerPrivateFullscreenWindow_h
 
 #if USE(ACCELERATED_COMPOSITING)
+#include "CACFLayerTreeHost.h"
 #include "PlatformCALayer.h"
-#include "WKCACFLayerRenderer.h"
 #endif
 
 typedef unsigned WPARAM;
@@ -58,7 +58,7 @@ public:
     HWND hwnd() const { return m_hwnd; }
 
 #if USE(ACCELERATED_COMPOSITING)
-    WKCACFLayerRenderer* layerRenderer() const { return m_layerRenderer.get(); }
+    CACFLayerTreeHost* layerView() const { return m_layerTreeHost.get(); }
 
     PlatformCALayer* rootChildLayer() const { return m_rootChild.get(); }
     void setRootChildLayer(PassRefPtr<PlatformCALayer>);
@@ -70,7 +70,7 @@ private:
 
     MediaPlayerPrivateFullscreenClient* m_client;
 #if USE(ACCELERATED_COMPOSITING)
-    RefPtr<WKCACFLayerRenderer> m_layerRenderer;
+    RefPtr<CACFLayerTreeHost> m_layerTreeHost;
     RefPtr<PlatformCALayer> m_rootChild;
 #endif
     HWND m_hwnd;
index 23f8ee4..3e3cc49 100644 (file)
@@ -1,5 +1,21 @@
 2011-01-21  Adam Roben  <aroben@apple.com>
 
+        Update for WKCACFLayerRenderer -> CACFLayerTreeHost rename
+
+        Also renamed WebView::m_layerRenderer to WebView::m_layerTreeHost to match.
+
+        Fixes <http://webkit.org/b/52898> WKCACFLayerRenderer sounds like a render object, but isn't
+
+        Reviewed by Simon Fraser.
+
+        * WebPreferences.cpp:
+        * WebView.cpp:
+        (WebView::setAcceleratedCompositing): Also made sure to remove our HWND from the layer tree
+        host before we get rid of the layer tree host itself.
+        * WebView.h:
+
+2011-01-21  Adam Roben  <aroben@apple.com>
+
         Replace some "sync compositing state" terminology with "flush pending GraphicsLayer changes"
 
         This seems to be the direction in which our code is moving. I chose "GraphicsLayer" as
index 5a2c19b..a962471 100644 (file)
 #include "WebPreferences.h"
 
 #include "COMPtr.h"
+#include "WebLocalizableStrings.h"
 #include "WebNotificationCenter.h"
 #include "WebPreferenceKeysPrivate.h"
 
-#include <wtf/text/StringHash.h>
+#include <CoreFoundation/CoreFoundation.h>
+#include <WebCore/CACFLayerTreeHost.h>
 #include <WebCore/FileSystem.h>
 #include <WebCore/Font.h>
 #include <WebCore/PlatformString.h>
-#include <WebCore/WKCACFLayerRenderer.h>
-#include "WebLocalizableStrings.h"
-
-#include <CoreFoundation/CoreFoundation.h>
 #include <limits>
 #include <shlobj.h>
 #include <tchar.h>
 #include <wtf/HashMap.h>
 #include <wtf/OwnArrayPtr.h>
 #include <wtf/text/CString.h>
+#include <wtf/text/StringHash.h>
 
 #if PLATFORM(CG)
 #include <CoreGraphics/CoreGraphics.h>
@@ -1446,7 +1445,7 @@ HRESULT WebPreferences::setAcceleratedCompositingEnabled(BOOL enabled)
 HRESULT WebPreferences::acceleratedCompositingEnabled(BOOL* enabled)
 {
 #if USE(ACCELERATED_COMPOSITING)
-    *enabled = WKCACFLayerRenderer::acceleratedCompositingAvailable() && boolValueForKey(CFSTR(WebKitAcceleratedCompositingEnabledPreferenceKey));
+    *enabled = CACFLayerTreeHost::acceleratedCompositingAvailable() && boolValueForKey(CFSTR(WebKitAcceleratedCompositingEnabledPreferenceKey));
 #else
     *enabled = FALSE;
 #endif
index 9eb0c0e..5a33d5b 100644 (file)
@@ -388,7 +388,7 @@ WebView::~WebView()
     ASSERT(!m_viewWindow);
 
 #if USE(ACCELERATED_COMPOSITING)
-    ASSERT(!m_layerRenderer);
+    ASSERT(!m_layerTreeHost);
     ASSERT(!m_backingLayer);
 #endif
 
@@ -883,8 +883,8 @@ void WebView::sizeChanged(const IntSize& newSize)
         coreFrame->view()->resize(newSize);
 
 #if USE(ACCELERATED_COMPOSITING)
-    if (m_layerRenderer)
-        m_layerRenderer->resize();
+    if (m_layerTreeHost)
+        m_layerTreeHost->resize();
     if (m_backingLayer) {
         m_backingLayer->setSize(newSize);
         m_backingLayer->setNeedsDisplay();
@@ -994,7 +994,7 @@ void WebView::paint(HDC dc, LPARAM options)
         // Flushing might have taken us out of compositing mode.
         if (isAcceleratedCompositing()) {
             // FIXME: We need to paint into dc (if provided). <http://webkit.org/b/52578>
-            m_layerRenderer->paint();
+            m_layerTreeHost->paint();
             ::ValidateRect(m_viewWindow, 0);
             return;
         }
@@ -6274,24 +6274,24 @@ void WebView::setRootChildLayer(GraphicsLayer* layer)
 
 void WebView::flushPendingGraphicsLayerChangesSoon()
 {
-    if (!m_layerRenderer)
+    if (!m_layerTreeHost)
         return;
-    m_layerRenderer->flushPendingGraphicsLayerChangesSoon();
+    m_layerTreeHost->flushPendingGraphicsLayerChangesSoon();
 }
 
 void WebView::setAcceleratedCompositing(bool accelerated)
 {
-    if (m_isAcceleratedCompositing == accelerated || !WKCACFLayerRenderer::acceleratedCompositingAvailable())
+    if (m_isAcceleratedCompositing == accelerated || !CACFLayerTreeHost::acceleratedCompositingAvailable())
         return;
 
     if (accelerated) {
-        m_layerRenderer = WKCACFLayerRenderer::create();
-        if (m_layerRenderer) {
+        m_layerTreeHost = CACFLayerTreeHost::create();
+        if (m_layerTreeHost) {
             m_isAcceleratedCompositing = true;
 
-            m_layerRenderer->setClient(this);
+            m_layerTreeHost->setClient(this);
             ASSERT(m_viewWindow);
-            m_layerRenderer->setHostWindow(m_viewWindow);
+            m_layerTreeHost->setWindow(m_viewWindow);
 
             // FIXME: We could perhaps get better performance by never allowing this layer to
             // become tiled (or choosing a higher-than-normal tiling threshold).
@@ -6304,7 +6304,7 @@ void WebView::setAcceleratedCompositing(bool accelerated)
             m_backingLayer->setSize(IntRect(clientRect).size());
             m_backingLayer->setNeedsDisplay();
 
-            m_layerRenderer->setRootChildLayer(PlatformCALayer::platformCALayer(m_backingLayer->platformLayer()));
+            m_layerTreeHost->setRootChildLayer(PlatformCALayer::platformCALayer(m_backingLayer->platformLayer()));
 
             // We aren't going to be using our backing store while we're in accelerated compositing
             // mode. But don't delete it immediately, in case we switch out of accelerated
@@ -6312,9 +6312,10 @@ void WebView::setAcceleratedCompositing(bool accelerated)
             deleteBackingStoreSoon();
         }
     } else {
-        ASSERT(m_layerRenderer);
-        m_layerRenderer->setClient(0);
-        m_layerRenderer = 0;
+        ASSERT(m_layerTreeHost);
+        m_layerTreeHost->setClient(0);
+        m_layerTreeHost->setWindow(0);
+        m_layerTreeHost = 0;
         m_backingLayer = 0;
         m_isAcceleratedCompositing = false;
     }
index 68b02da..c81f6d6 100644 (file)
@@ -40,8 +40,8 @@
 #include <wtf/RefPtr.h>
 
 #if USE(ACCELERATED_COMPOSITING)
+#include <WebCore/CACFLayerTreeHost.h>
 #include <WebCore/PlatformCALayer.h>
-#include <WebCore/WKCACFLayerRenderer.h>
 #endif
 
 class FullscreenVideoController;
@@ -71,7 +71,7 @@ class WebView
     , WebCore::WindowMessageListener
 #if USE(ACCELERATED_COMPOSITING)
     , WebCore::GraphicsLayerClient
-    , WebCore::WKCACFLayerRendererClient
+    , WebCore::CACFLayerTreeHostClient
 #endif
 {
 public:
@@ -947,7 +947,7 @@ private:
     virtual bool showDebugBorders() const;
     virtual bool showRepaintCounter() const;
 
-    // WKCACFLayerRendererClient
+    // CACFLayerTreeHostClient
     virtual bool shouldRender() const;
     virtual void flushPendingGraphicsLayerChanges();
 #endif
@@ -1056,7 +1056,7 @@ protected:
     bool isAcceleratedCompositing() const { return m_isAcceleratedCompositing; }
     void setAcceleratedCompositing(bool);
 
-    RefPtr<WebCore::WKCACFLayerRenderer> m_layerRenderer;
+    RefPtr<WebCore::CACFLayerTreeHost> m_layerTreeHost;
     OwnPtr<WebCore::GraphicsLayer> m_backingLayer;
     bool m_isAcceleratedCompositing;
 #endif
index 84330b8..6bfc039 100644 (file)
@@ -1,3 +1,14 @@
+2011-01-21  Adam Roben  <aroben@apple.com>
+
+        Update for WKCACFLayerRenderer -> CACFLayerView rename
+
+        Fixes <http://webkit.org/b/52898> WKCACFLayerRenderer sounds like a render object, but isn't
+
+        Reviewed by Simon Fraser.
+
+        * WebProcess/WebPage/win/LayerBackedDrawingAreaWin.cpp: Just removed all the unnecessary
+        #includes.
+
 2011-01-20  Darin Adler  <darin@apple.com>
 
         Reviewed by Dan Bernstein.
index c07e1f5..cae79c2 100644 (file)
 
 #include "LayerBackedDrawingArea.h"
 
-#include "DrawingAreaProxyMessageKinds.h"
-#include "WebPage.h"
-#include "WebProcess.h"
-#include <WebCore/Frame.h>
-#include <WebCore/FrameView.h>
-#include <WebCore/GraphicsLayer.h>
-#include <WebCore/Page.h>
-#include <WebCore/WKCACFLayerRenderer.h>
-#include <WebCore/WebCoreInstanceHandle.h>
-
 using namespace WebCore;
 
 namespace WebKit {