OLD | NEW |
1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef WebLayerTreeViewImpl_h | 5 #ifndef WEBKIT_COMPOSITOR_BINDINGS_WEB_LAYER_TREE_VIEW_IMPL_H_ |
6 #define WebLayerTreeViewImpl_h | 6 #define WEBKIT_COMPOSITOR_BINDINGS_WEB_LAYER_TREE_VIEW_IMPL_H_ |
7 | 7 |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "cc/layer_tree_host_client.h" | 9 #include "cc/layer_tree_host_client.h" |
10 #include "third_party/WebKit/Source/Platform/chromium/public/WebLayerTreeView.h" | 10 #include "third_party/WebKit/Source/Platform/chromium/public/WebLayerTreeView.h" |
11 | 11 |
12 namespace cc { | 12 namespace cc { |
13 class FontAtlas; | 13 class FontAtlas; |
14 class LayerTreeHost; | 14 class LayerTreeHost; |
15 class Thread; | 15 class Thread; |
16 } | 16 } |
17 | 17 |
18 namespace WebKit { | 18 namespace WebKit { |
19 class WebLayer; | 19 class WebLayer; |
20 class WebLayerTreeViewClient; | 20 class WebLayerTreeViewClient; |
21 class WebLayerTreeViewClientAdapter; | 21 class WebLayerTreeViewClientAdapter; |
22 | 22 |
23 class WebLayerTreeViewImpl : public WebLayerTreeView, public cc::LayerTreeHostCl
ient { | 23 class WebLayerTreeViewImpl : public WebLayerTreeView, |
24 public: | 24 public cc::LayerTreeHostClient { |
25 explicit WebLayerTreeViewImpl(WebLayerTreeViewClient*); | 25 public: |
26 virtual ~WebLayerTreeViewImpl(); | 26 explicit WebLayerTreeViewImpl(WebLayerTreeViewClient* client); |
| 27 virtual ~WebLayerTreeViewImpl(); |
27 | 28 |
28 bool initialize(const Settings&, scoped_ptr<cc::Thread> implThread); | 29 bool initialize(const Settings& settings, scoped_ptr<cc::Thread> impl_thread); |
29 | 30 |
30 // WebLayerTreeView implementation. | 31 cc::LayerTreeHost* layer_tree_host() const; |
31 virtual void setSurfaceReady() OVERRIDE; | |
32 virtual void setRootLayer(const WebLayer&) OVERRIDE; | |
33 virtual void clearRootLayer() OVERRIDE; | |
34 virtual void setViewportSize(const WebSize& layoutViewportSize, const WebSiz
e& deviceViewportSize = WebSize()) OVERRIDE; | |
35 virtual WebSize layoutViewportSize() const OVERRIDE; | |
36 virtual WebSize deviceViewportSize() const OVERRIDE; | |
37 virtual WebFloatPoint adjustEventPointForPinchZoom(const WebFloatPoint& poin
t) const OVERRIDE; | |
38 virtual void setDeviceScaleFactor(float) OVERRIDE; | |
39 virtual float deviceScaleFactor() const OVERRIDE; | |
40 virtual void setBackgroundColor(WebColor) OVERRIDE; | |
41 virtual void setHasTransparentBackground(bool) OVERRIDE; | |
42 virtual void setVisible(bool) OVERRIDE; | |
43 virtual void setPageScaleFactorAndLimits(float pageScaleFactor, float minimu
m, float maximum) OVERRIDE; | |
44 virtual void startPageScaleAnimation(const WebPoint& destination, bool useAn
chor, float newPageScale, double durationSec) OVERRIDE; | |
45 virtual void setNeedsAnimate() OVERRIDE; | |
46 virtual void setNeedsRedraw() OVERRIDE; | |
47 virtual bool commitRequested() const OVERRIDE; | |
48 virtual void composite() OVERRIDE; | |
49 virtual void updateAnimations(double frameBeginTime) OVERRIDE; | |
50 virtual bool compositeAndReadback(void *pixels, const WebRect&) OVERRIDE; | |
51 virtual void finishAllRendering() OVERRIDE; | |
52 virtual void setDeferCommits(bool deferCommits) OVERRIDE; | |
53 virtual void renderingStats(WebRenderingStats&) const OVERRIDE; | |
54 virtual void setShowFPSCounter(bool show); | |
55 virtual void setShowPaintRects(bool show); | |
56 virtual void loseCompositorContext(int numTimes) OVERRIDE; | |
57 | 32 |
58 // cc::LayerTreeHostClient implementation. | 33 // WebLayerTreeView implementation. |
59 virtual void willBeginFrame() OVERRIDE; | 34 virtual void setSurfaceReady() OVERRIDE; |
60 virtual void didBeginFrame() OVERRIDE; | 35 virtual void setRootLayer(const WebLayer&) OVERRIDE; |
61 virtual void animate(double monotonicFrameBeginTime) OVERRIDE; | 36 virtual void clearRootLayer() OVERRIDE; |
62 virtual void layout() OVERRIDE; | 37 virtual void setViewportSize( |
63 virtual void applyScrollAndScale(gfx::Vector2d scrollDelta, float pageScale)
OVERRIDE; | 38 const WebSize& layout_viewport_size, |
64 virtual scoped_ptr<cc::OutputSurface> createOutputSurface() OVERRIDE; | 39 const WebSize& deviceViewportSize = WebSize()) OVERRIDE; |
65 virtual void didRecreateOutputSurface(bool success) OVERRIDE; | 40 virtual WebSize layoutViewportSize() const OVERRIDE; |
66 virtual scoped_ptr<cc::InputHandler> createInputHandler() OVERRIDE; | 41 virtual WebSize deviceViewportSize() const OVERRIDE; |
67 virtual void willCommit() OVERRIDE; | 42 virtual WebFloatPoint adjustEventPointForPinchZoom( |
68 virtual void didCommit() OVERRIDE; | 43 const WebFloatPoint& point) const OVERRIDE; |
69 virtual void didCommitAndDrawFrame() OVERRIDE; | 44 virtual void setDeviceScaleFactor(float device_scale_factor) OVERRIDE; |
70 virtual void didCompleteSwapBuffers() OVERRIDE; | 45 virtual float deviceScaleFactor() const OVERRIDE; |
71 virtual void scheduleComposite() OVERRIDE; | 46 virtual void setBackgroundColor(WebColor) OVERRIDE; |
72 virtual scoped_ptr<cc::FontAtlas> createFontAtlas(); | 47 virtual void setHasTransparentBackground(bool transparent) OVERRIDE; |
| 48 virtual void setVisible(bool visible) OVERRIDE; |
| 49 virtual void setPageScaleFactorAndLimits(float page_scale_factor, |
| 50 float minimum, |
| 51 float maximum) OVERRIDE; |
| 52 virtual void startPageScaleAnimation(const WebPoint& destination, |
| 53 bool use_anchor, |
| 54 float new_page_scale, |
| 55 double duration_sec) OVERRIDE; |
| 56 virtual void setNeedsAnimate() OVERRIDE; |
| 57 virtual void setNeedsRedraw() OVERRIDE; |
| 58 virtual bool commitRequested() const OVERRIDE; |
| 59 virtual void composite() OVERRIDE; |
| 60 virtual void updateAnimations(double frame_begin_time) OVERRIDE; |
| 61 virtual bool compositeAndReadback(void* pixels, |
| 62 const WebRect& viewport_rect) OVERRIDE; |
| 63 virtual void finishAllRendering() OVERRIDE; |
| 64 virtual void setDeferCommits(bool defer_commits) OVERRIDE; |
| 65 virtual void renderingStats(WebRenderingStats& stats) const OVERRIDE; |
| 66 virtual void setShowFPSCounter(bool show); |
| 67 virtual void setShowPaintRects(bool show); |
| 68 virtual void loseCompositorContext(int num_times) OVERRIDE; |
73 | 69 |
74 private: | 70 // cc::LayerTreeHostClient implementation. |
75 WebLayerTreeViewClient* m_client; | 71 virtual void willBeginFrame() OVERRIDE; |
76 scoped_ptr<cc::LayerTreeHost> m_layerTreeHost; | 72 virtual void didBeginFrame() OVERRIDE; |
| 73 virtual void animate(double monotonicFrameBeginTime) OVERRIDE; |
| 74 virtual void layout() OVERRIDE; |
| 75 virtual void applyScrollAndScale(gfx::Vector2d scroll_delta, |
| 76 float page_scale) OVERRIDE; |
| 77 virtual scoped_ptr<cc::OutputSurface> createOutputSurface() OVERRIDE; |
| 78 virtual void didRecreateOutputSurface(bool success) OVERRIDE; |
| 79 virtual scoped_ptr<cc::InputHandler> createInputHandler() OVERRIDE; |
| 80 virtual void willCommit() OVERRIDE; |
| 81 virtual void didCommit() OVERRIDE; |
| 82 virtual void didCommitAndDrawFrame() OVERRIDE; |
| 83 virtual void didCompleteSwapBuffers() OVERRIDE; |
| 84 virtual void scheduleComposite() OVERRIDE; |
| 85 virtual scoped_ptr<cc::FontAtlas> createFontAtlas(); |
| 86 |
| 87 private: |
| 88 WebLayerTreeViewClient* client_; |
| 89 scoped_ptr<cc::LayerTreeHost> layer_tree_host_; |
77 }; | 90 }; |
78 | 91 |
79 } // namespace WebKit | 92 } // namespace WebKit |
80 | 93 |
81 #endif // WebLayerTreeViewImpl_h | 94 #endif // WEBKIT_COMPOSITOR_BINDINGS_WEB_LAYER_TREE_VIEW_IMPL_H_ |
OLD | NEW |