0d1ed9bef7b2f534e7b38bdffa2bfec8c0184005
[framework/web/webkit-efl.git] / Source / WebKit2 / UIProcess / LayerTreeHostProxy.h
1 /*
2     Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies)
3
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.
8
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.
13
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.
18 */
19
20 #ifndef LayerTreeHostProxy_h
21 #define LayerTreeHostProxy_h
22
23 #if USE(UI_SIDE_COMPOSITING)
24
25 #include "BackingStore.h"
26 #include "DrawingAreaProxy.h"
27 #include "Region.h"
28 #include "SurfaceUpdateInfo.h"
29 #include "WebLayerTreeInfo.h"
30 #include <WebCore/GraphicsContext.h>
31 #include <WebCore/GraphicsLayer.h>
32 #include <WebCore/IntRect.h>
33 #include <WebCore/IntSize.h>
34 #include <WebCore/RunLoop.h>
35 #include <WebCore/Timer.h>
36 #include <wtf/Functional.h>
37 #include <wtf/HashSet.h>
38
39 #if ENABLE(TIZEN_WEBKIT2_TILED_AC)
40 struct _Evas_GL_API;
41 typedef struct _Evas_GL_API Evas_GL_API;
42 #endif
43
44 namespace WebKit {
45
46 class WebLayerInfo;
47 class WebLayerTreeRenderer;
48 class WebLayerUpdateInfo;
49
50 class LayerTreeHostProxy {
51 public:
52     LayerTreeHostProxy(DrawingAreaProxy*);
53     virtual ~LayerTreeHostProxy();
54
55     void setCompositingLayerState(WebLayerID, const WebLayerInfo&);
56     void setCompositingLayerChildren(WebLayerID, const Vector<WebLayerID>&);
57 #if ENABLE(CSS_FILTERS)
58     void setCompositingLayerFilters(WebLayerID, const WebCore::FilterOperations&);
59 #endif
60     void deleteCompositingLayer(WebLayerID);
61     void setRootCompositingLayer(WebLayerID);
62     void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
63     void purgeGLResources();
64     void setContentsSize(const WebCore::FloatSize&);
65     void setVisibleContentsRect(const WebCore::IntRect&, float scale, const WebCore::FloatPoint& trajectory, const WebCore::FloatPoint& accurateVisibleContentsPosition);
66     void didRenderFrame();
67     void createTileForLayer(int layerID, int tileID, const WebCore::IntRect&, const SurfaceUpdateInfo&);
68     void updateTileForLayer(int layerID, int tileID, const WebCore::IntRect&, const SurfaceUpdateInfo&);
69     void removeTileForLayer(int layerID, int tileID);
70     void createDirectlyCompositedImage(int64_t, const WebKit::ShareableBitmap::Handle&);
71     void destroyDirectlyCompositedImage(int64_t);
72     void didReceiveLayerTreeHostProxyMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
73     void updateViewport();
74     void renderNextFrame();
75     void didChangeScrollPosition(const WebCore::IntPoint& position);
76     void purgeBackingStores();
77     WebLayerTreeRenderer* layerTreeRenderer() const { return m_renderer.get(); }
78
79 #if ENABLE(TIZEN_WEBKIT2_TILED_AC)
80     void clearBackingStores();
81     void restoreBackingStores();
82 #endif
83
84 #if ENABLE(TIZEN_CSS_OVERFLOW_SCROLL_ACCELERATION)
85     bool hasOverflowLayer() const;
86     virtual void platformLayerChanged(WebCore::GraphicsLayer*, WebCore::PlatformLayer* oldPlatformLayer, WebCore::PlatformLayer* newPlatformLayer) { ASSERT_NOT_REACHED(); }
87 #endif
88 #if ENABLE(TIZEN_CSS_OVERFLOW_SCROLL_ACCELERATION_ON_UI_SIDE)
89     bool setOffsetForFocusedScrollingContentsLayer(const WebCore::FloatPoint&);
90     void setVisibleContentsRectForScrollingContentsLayers(const WebCore::IntRect&);
91 #endif
92
93 protected:
94     void dispatchUpdate(const Function<void()>&);
95
96 #if ENABLE(TIZEN_ONESHOT_DRAWING_SYNCHRONIZATION)
97     void setNeedsOneShotDrawingSynchronization();
98     void doOneShotDrawingSynchronization();
99 #endif
100
101     DrawingAreaProxy* m_drawingAreaProxy;
102     RefPtr<WebLayerTreeRenderer> m_renderer;
103 #if USE(GRAPHICS_SURFACE)
104     HashMap<uint32_t, RefPtr<ShareableSurface> > m_surfaces;
105 #endif
106 };
107
108 }
109
110 #endif
111
112 #endif // LayerTreeHostProxy_h