Changeset 82650 in webkit
- Timestamp:
- Mar 31, 2011 6:05:06 PM (13 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 6 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r82646 r82650 1 2011-03-31 Adam Roben <aroben@apple.com> 2 3 Add a new AbstractCACFLayerTreeHost base class 4 5 This class exposes the interface that LayerChangesFlusher and PlatformCALayer rely on. 6 CACFLayerTreeHost now derives from AbstractCACFLayerTreeHost. In the future, WebKit2's 7 LayerTreeHostCA will also derive from it (on Windows). 8 9 This should cause no change in behavior. 10 11 Fixes <http://webkit.org/b/57598> Coupling between CACFLayerTreeHost and other CACF-related 12 code is too high 13 14 Reviewed by Anders Carlsson. 15 16 * WebCore.vcproj/WebCore.vcproj: Added AbstractCACFLayerTreeHost, and let VS reorder files. 17 18 * platform/graphics/ca/win/AbstractCACFLayerTreeHost.h: Added. 19 20 * platform/graphics/ca/win/CACFLayerTreeHost.h: Changed to derive from 21 AbstractCACFLayerTreeHost, and annotated the overrides of its functions. 22 AbstractCACFLayerTreeHost also allows us to get rid of the friend relationship with 23 PlatformCALayer. 24 25 * platform/graphics/ca/win/LayerChangesFlusher.cpp: 26 (WebCore::LayerChangesFlusher::flushPendingLayerChangesSoon): 27 (WebCore::LayerChangesFlusher::cancelPendingFlush): 28 (WebCore::LayerChangesFlusher::hookFired): 29 * platform/graphics/ca/win/LayerChangesFlusher.h: 30 * platform/graphics/ca/win/PlatformCALayerWin.cpp: 31 (layerTreeHostForLayer): 32 (PlatformCALayer::rootLayer): 33 (PlatformCALayer::setNeedsCommit): 34 (PlatformCALayer::addAnimationForKey): 35 (PlatformCALayer::removeAnimationForKey): 36 Changed to use AbstractCACFLayerTreeHost instead of using CACFLayerTreeHost directly. 37 1 38 2011-03-31 Andy Estes <aestes@apple.com> 2 39 -
trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj
r82640 r82650 25787 25787 </File> 25788 25788 <File 25789 RelativePath="..\platform\DefaultLocalizationStrategy.cpp" 25790 > 25791 </File> 25792 <File 25793 RelativePath="..\platform\DefaultLocalizationStrategy.h" 25794 > 25795 </File> 25796 <File 25789 25797 RelativePath="..\platform\DragData.cpp" 25790 25798 > … … 25792 25800 <File 25793 25801 RelativePath="..\platform\DragData.h" 25794 >25795 </File>25796 <File25797 RelativePath="..\platform\DefaultLocalizationStrategy.cpp"25798 >25799 </File>25800 <File25801 RelativePath="..\platform\DefaultLocalizationStrategy.h"25802 25802 > 25803 25803 </File> … … 29147 29147 Name="win" 29148 29148 > 29149 <File 29150 RelativePath="..\platform\graphics\ca\win\AbstractCACFLayerTreeHost.h" 29151 > 29152 </File> 29149 29153 <File 29150 29154 RelativePath="..\platform\graphics\ca\win\CACFLayerTreeHost.cpp" … … 63202 63206 </File> 63203 63207 <File 63208 RelativePath="..\bindings\js\PageScriptDebugServer.h" 63209 > 63210 </File> 63211 <File 63204 63212 RelativePath="..\bindings\js\ScheduledAction.cpp" 63205 63213 > … … 64032 64040 /> 64033 64041 </FileConfiguration> 64034 </File>64035 <File64036 RelativePath="..\bindings\js\PageScriptDebugServer.h"64037 >64038 64042 </File> 64039 64043 </Filter> … … 66495 66499 </File> 66496 66500 <File 66501 RelativePath="..\inspector\InspectorPageAgent.cpp" 66502 > 66503 </File> 66504 <File 66505 RelativePath="..\inspector\InspectorPageAgent.h" 66506 > 66507 </File> 66508 <File 66497 66509 RelativePath="..\inspector\InspectorProfilerAgent.cpp" 66498 >66499 </File>66500 <File66501 RelativePath="..\inspector\InspectorPageAgent.cpp"66502 >66503 </File>66504 <File66505 RelativePath="..\inspector\InspectorPageAgent.h"66506 66510 > 66507 66511 </File> -
trunk/Source/WebCore/platform/graphics/ca/win/AbstractCACFLayerTreeHost.h
r82649 r82650 1 1 /* 2 * Copyright (C) 20 11 Apple Inc. All rights reserved.2 * Copyright (C) 2009, 2011 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 24 24 */ 25 25 26 #ifndef LayerChangesFlusher_h27 #define LayerChangesFlusher_h26 #ifndef AbstractCACFLayerTreeHost_h 27 #define AbstractCACFLayerTreeHost_h 28 28 29 29 #if USE(ACCELERATED_COMPOSITING) 30 30 31 #include <windows.h> 32 #include <wtf/HashSet.h> 33 #include <wtf/Noncopyable.h> 31 #include <wtf/Forward.h> 34 32 35 33 namespace WebCore { 36 34 37 class CACFLayerTreeHost;35 class PlatformCALayer; 38 36 39 class LayerChangesFlusher { 40 WTF_MAKE_NONCOPYABLE(LayerChangesFlusher); 37 class AbstractCACFLayerTreeHost { 41 38 public: 42 static LayerChangesFlusher& shared(); 39 virtual PlatformCALayer* rootLayer() const = 0; 40 virtual void addPendingAnimatedLayer(PassRefPtr<PlatformCALayer>) = 0; 41 virtual void layerTreeDidChange() = 0; 42 virtual void flushPendingLayerChangesNow() = 0; 43 43 44 void flushPendingLayerChangesSoon(CACFLayerTreeHost*); 45 void cancelPendingFlush(CACFLayerTreeHost*); 46 47 private: 48 LayerChangesFlusher(); 49 ~LayerChangesFlusher(); 50 51 static LRESULT CALLBACK hookCallback(int code, WPARAM, LPARAM); 52 LRESULT hookFired(int code, WPARAM, LPARAM); 53 void setHook(); 54 void removeHook(); 55 56 HashSet<CACFLayerTreeHost*> m_hostsWithChangesToFlush; 57 HHOOK m_hook; 58 bool m_isCallingHosts; 44 protected: 45 virtual ~AbstractCACFLayerTreeHost() { } 59 46 }; 60 47 61 } // namespace WebCore48 } 62 49 63 50 #endif // USE(ACCELERATED_COMPOSITING) 64 51 65 #endif // LayerChangesFlusher_h52 #endif // AbstractCACFLayerTreeHost_h -
trunk/Source/WebCore/platform/graphics/ca/win/CACFLayerTreeHost.h
r76858 r82650 29 29 #if USE(ACCELERATED_COMPOSITING) 30 30 31 #include "AbstractCACFLayerTreeHost.h" 31 32 #include "COMPtr.h" 32 33 #include "Timer.h" … … 51 52 class PlatformCALayer; 52 53 53 class CACFLayerTreeHost : public RefCounted<CACFLayerTreeHost> { 54 friend PlatformCALayer; 55 54 class CACFLayerTreeHost : public RefCounted<CACFLayerTreeHost>, private AbstractCACFLayerTreeHost { 56 55 public: 57 56 static PassRefPtr<CACFLayerTreeHost> create(); … … 67 66 virtual void resize() = 0; 68 67 void flushPendingGraphicsLayerChangesSoon(); 69 void flushPendingLayerChangesNow(); 68 69 // AbstractCACFLayerTreeHost 70 virtual void flushPendingLayerChangesNow(); 70 71 71 72 protected: … … 73 74 74 75 CGRect bounds() const; 75 PlatformCALayer* rootLayer() const;76 76 HWND window() const { return m_window; } 77 77 void notifyAnimationsStarted(); 78 79 // AbstractCACFLayerTreeHost 80 virtual PlatformCALayer* rootLayer() const; 78 81 79 82 virtual bool createRenderer() = 0; … … 83 86 private: 84 87 void initialize(); 85 void addPendingAnimatedLayer(PassRefPtr<PlatformCALayer>); 86 void layerTreeDidChange(); 88 89 // AbstractCACFLayerTreeHost 90 virtual void addPendingAnimatedLayer(PassRefPtr<PlatformCALayer>); 91 virtual void layerTreeDidChange(); 92 87 93 88 94 virtual void flushContext() = 0; -
trunk/Source/WebCore/platform/graphics/ca/win/LayerChangesFlusher.cpp
r82633 r82650 29 29 #if USE(ACCELERATED_COMPOSITING) 30 30 31 #include " CACFLayerTreeHost.h"31 #include "AbstractCACFLayerTreeHost.h" 32 32 #include "WebCoreInstanceHandle.h" 33 33 #include <wtf/StdLibExtras.h> … … 48 48 } 49 49 50 void LayerChangesFlusher::flushPendingLayerChangesSoon( CACFLayerTreeHost* host)50 void LayerChangesFlusher::flushPendingLayerChangesSoon(AbstractCACFLayerTreeHost* host) 51 51 { 52 52 if (!m_hostsWithChangesToFlush.add(host).second || m_hook) … … 56 56 } 57 57 58 void LayerChangesFlusher::cancelPendingFlush( CACFLayerTreeHost* host)58 void LayerChangesFlusher::cancelPendingFlush(AbstractCACFLayerTreeHost* host) 59 59 { 60 60 m_hostsWithChangesToFlush.remove(host); … … 82 82 // Calling out to the hosts can cause m_hostsWithChangesToFlush to be modified, so we copy it 83 83 // into a Vector first. 84 Vector< CACFLayerTreeHost*> hosts;84 Vector<AbstractCACFLayerTreeHost*> hosts; 85 85 copyToVector(m_hostsWithChangesToFlush, hosts); 86 86 m_hostsWithChangesToFlush.clear(); -
trunk/Source/WebCore/platform/graphics/ca/win/LayerChangesFlusher.h
r76372 r82650 35 35 namespace WebCore { 36 36 37 class CACFLayerTreeHost;37 class AbstractCACFLayerTreeHost; 38 38 39 39 class LayerChangesFlusher { … … 42 42 static LayerChangesFlusher& shared(); 43 43 44 void flushPendingLayerChangesSoon( CACFLayerTreeHost*);45 void cancelPendingFlush( CACFLayerTreeHost*);44 void flushPendingLayerChangesSoon(AbstractCACFLayerTreeHost*); 45 void cancelPendingFlush(AbstractCACFLayerTreeHost*); 46 46 47 47 private: … … 54 54 void removeHook(); 55 55 56 HashSet< CACFLayerTreeHost*> m_hostsWithChangesToFlush;56 HashSet<AbstractCACFLayerTreeHost*> m_hostsWithChangesToFlush; 57 57 HHOOK m_hook; 58 58 bool m_isCallingHosts; -
trunk/Source/WebCore/platform/graphics/ca/win/PlatformCALayerWin.cpp
r76370 r82650 30 30 #include "PlatformCALayer.h" 31 31 32 #include " CACFLayerTreeHost.h"32 #include "AbstractCACFLayerTreeHost.h" 33 33 #include "Font.h" 34 34 #include "GraphicsContext.h" … … 66 66 } 67 67 68 static CACFLayerTreeHost* layerTreeHostForLayer(const PlatformCALayer* layer)69 { 70 // We need the CACFLayerTreeHost associated with this layer, which is stored in the UserData of the CACFContext68 static AbstractCACFLayerTreeHost* layerTreeHostForLayer(const PlatformCALayer* layer) 69 { 70 // We need the AbstractCACFLayerTreeHost associated with this layer, which is stored in the UserData of the CACFContext 71 71 void* userData = wkCACFLayerGetContextUserData(layer->platformLayer()); 72 72 if (!userData) 73 73 return 0; 74 74 75 return static_cast< CACFLayerTreeHost*>(userData);75 return static_cast<AbstractCACFLayerTreeHost*>(userData); 76 76 } 77 77 … … 157 157 PlatformCALayer* PlatformCALayer::rootLayer() const 158 158 { 159 CACFLayerTreeHost* host = layerTreeHostForLayer(this);159 AbstractCACFLayerTreeHost* host = layerTreeHostForLayer(this); 160 160 return host ? host->rootLayer() : 0; 161 161 } … … 168 168 void PlatformCALayer::setNeedsCommit() 169 169 { 170 CACFLayerTreeHost* host = layerTreeHostForLayer(this);170 AbstractCACFLayerTreeHost* host = layerTreeHostForLayer(this); 171 171 if (host) 172 172 host->layerTreeDidChange(); … … 271 271 272 272 // Tell the host about it so we can fire the start animation event 273 CACFLayerTreeHost* host = layerTreeHostForLayer(this);273 AbstractCACFLayerTreeHost* host = layerTreeHostForLayer(this); 274 274 if (host) 275 275 host->addPendingAnimatedLayer(this); … … 284 284 CACFLayerRemoveAnimation(m_layer.get(), s.get()); 285 285 286 // We don't "remove" a layer from CACFLayerTreeHost when it loses an animation.286 // We don't "remove" a layer from AbstractCACFLayerTreeHost when it loses an animation. 287 287 // There may be other active animations on the layer and if an animation 288 288 // callback is fired on a layer without any animations no harm is done.
Note: See TracChangeset
for help on using the changeset viewer.