2 Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies)
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 Boston, MA 02110-1301, USA.
20 #ifndef CoordinatedLayerTreeHostProxy_h
21 #define CoordinatedLayerTreeHostProxy_h
23 #if USE(COORDINATED_GRAPHICS)
25 #include "BackingStore.h"
26 #include "CoordinatedGraphicsArgumentCoders.h"
27 #include "DrawingAreaProxy.h"
29 #include "WebCoordinatedSurface.h"
30 #include <WebCore/CoordinatedGraphicsScene.h>
31 #include <WebCore/GraphicsContext.h>
32 #include <WebCore/GraphicsLayer.h>
33 #include <WebCore/GraphicsLayerAnimation.h>
34 #include <WebCore/GraphicsSurfaceToken.h>
35 #include <WebCore/IntRect.h>
36 #include <WebCore/IntSize.h>
37 #include <WebCore/RunLoop.h>
38 #include <WebCore/Timer.h>
39 #include <wtf/Functional.h>
40 #include <wtf/HashSet.h>
41 #include <wtf/Vector.h>
44 class CoordinatedLayerInfo;
45 class SurfaceUpdateInfo;
50 class CoordinatedLayerTreeHostProxy : public WebCore::CoordinatedGraphicsSceneClient, public CoreIPC::MessageReceiver {
51 WTF_MAKE_NONCOPYABLE(CoordinatedLayerTreeHostProxy);
52 WTF_MAKE_FAST_ALLOCATED;
54 explicit CoordinatedLayerTreeHostProxy(DrawingAreaProxy*);
55 virtual ~CoordinatedLayerTreeHostProxy();
56 void setCompositingLayerState(WebCore::CoordinatedLayerID, const WebCore::CoordinatedLayerInfo&);
57 void setCompositingLayerChildren(WebCore::CoordinatedLayerID, const Vector<WebCore::CoordinatedLayerID>&);
58 #if ENABLE(CSS_FILTERS)
59 void setCompositingLayerFilters(WebCore::CoordinatedLayerID, const WebCore::FilterOperations&);
61 #if ENABLE(CSS_SHADERS)
62 void createCustomFilterProgram(int id, const WebCore::CustomFilterProgramInfo&);
63 void removeCustomFilterProgram(int id);
65 void createCompositingLayers(const Vector<WebCore::CoordinatedLayerID>&);
66 void deleteCompositingLayers(const Vector<WebCore::CoordinatedLayerID>&);
67 void setRootCompositingLayer(WebCore::CoordinatedLayerID);
68 void setContentsSize(const WebCore::FloatSize&);
69 void setVisibleContentsRect(const WebCore::FloatRect&, const WebCore::FloatPoint& trajectoryVector);
70 void didRenderFrame(const WebCore::IntSize& contentsSize, const WebCore::IntRect& coveredRect);
71 void createTileForLayer(WebCore::CoordinatedLayerID, uint32_t tileID, const WebCore::IntRect&, const WebCore::SurfaceUpdateInfo&);
72 void updateTileForLayer(WebCore::CoordinatedLayerID, uint32_t tileID, const WebCore::IntRect&, const WebCore::SurfaceUpdateInfo&);
73 void removeTileForLayer(WebCore::CoordinatedLayerID, uint32_t tileID);
74 void createUpdateAtlas(uint32_t atlasID, const WebCoordinatedSurface::Handle&);
75 void removeUpdateAtlas(uint32_t atlasID);
76 void createImageBacking(WebCore::CoordinatedImageBackingID);
77 void updateImageBacking(WebCore::CoordinatedImageBackingID, const WebCoordinatedSurface::Handle&);
78 void clearImageBackingContents(WebCore::CoordinatedImageBackingID);
79 void removeImageBacking(WebCore::CoordinatedImageBackingID);
80 void didChangeScrollPosition(const WebCore::FloatPoint& position);
81 #if USE(GRAPHICS_SURFACE)
82 void createCanvas(WebCore::CoordinatedLayerID, const WebCore::IntSize&, const WebCore::GraphicsSurfaceToken&);
83 void syncCanvas(WebCore::CoordinatedLayerID, uint32_t frontBuffer);
84 void destroyCanvas(WebCore::CoordinatedLayerID);
86 void setLayerRepaintCount(WebCore::CoordinatedLayerID, int value);
87 WebCore::CoordinatedGraphicsScene* coordinatedGraphicsScene() const { return m_scene.get(); }
88 void setLayerAnimations(WebCore::CoordinatedLayerID, const WebCore::GraphicsLayerAnimations&);
89 void setAnimationsLocked(bool);
90 #if ENABLE(REQUEST_ANIMATION_FRAME)
91 void requestAnimationFrame();
93 void setBackgroundColor(const WebCore::Color&);
95 // CoordinatedGraphicsSceneClient Methods.
96 #if ENABLE(REQUEST_ANIMATION_FRAME)
97 virtual void animationFrameReady() OVERRIDE;
99 virtual void updateViewport() OVERRIDE;
100 virtual void renderNextFrame() OVERRIDE;
101 virtual void purgeBackingStores() OVERRIDE;
104 void dispatchUpdate(const Function<void()>&);
106 // CoreIPC::MessageReceiver
107 virtual void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageDecoder&) OVERRIDE;
109 DrawingAreaProxy* m_drawingAreaProxy;
110 RefPtr<WebCore::CoordinatedGraphicsScene> m_scene;
111 WebCore::FloatRect m_lastSentVisibleRect;
112 WebCore::FloatPoint m_lastSentTrajectoryVector;
115 } // namespace WebKit
117 #endif // USE(COORDINATED_GRAPHICS)
119 #endif // CoordinatedLayerTreeHostProxy_h