| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 CONTENT_RENDERER_GPU_RENDER_WIDGET_COMPOSITOR_H_ | 5 #ifndef CONTENT_RENDERER_GPU_RENDER_WIDGET_COMPOSITOR_H_ |
| 6 #define CONTENT_RENDERER_GPU_RENDER_WIDGET_COMPOSITOR_H_ | 6 #define CONTENT_RENDERER_GPU_RENDER_WIDGET_COMPOSITOR_H_ |
| 7 | 7 |
| 8 #include "base/time.h" |
| 8 #include "cc/layer_tree_host_client.h" | 9 #include "cc/layer_tree_host_client.h" |
| 9 #include "cc/layer_tree_settings.h" | 10 #include "cc/layer_tree_settings.h" |
| 11 #include "cc/rendering_stats.h" |
| 12 #include "skia/ext/refptr.h" |
| 10 #include "third_party/WebKit/Source/Platform/chromium/public/WebLayerTreeView.h" | 13 #include "third_party/WebKit/Source/Platform/chromium/public/WebLayerTreeView.h" |
| 11 | 14 |
| 15 class SkPicture; |
| 16 |
| 12 namespace cc { | 17 namespace cc { |
| 13 class LayerTreeHost; | 18 class LayerTreeHost; |
| 14 } | 19 } |
| 15 | 20 |
| 16 namespace content { | 21 namespace content { |
| 17 class RenderWidget; | 22 class RenderWidget; |
| 18 | 23 |
| 19 class RenderWidgetCompositor : public WebKit::WebLayerTreeView, | 24 class RenderWidgetCompositor : public WebKit::WebLayerTreeView, |
| 20 public cc::LayerTreeHostClient { | 25 public cc::LayerTreeHostClient { |
| 21 public: | 26 public: |
| 22 // Attempt to construct and initialize a compositor instance for the widget | 27 // Attempt to construct and initialize a compositor instance for the widget |
| 23 // with the given settings. Returns NULL if initialization fails. | 28 // with the given settings. Returns NULL if initialization fails. |
| 24 static scoped_ptr<RenderWidgetCompositor> Create( | 29 static scoped_ptr<RenderWidgetCompositor> Create( |
| 25 RenderWidget* widget, | 30 RenderWidget* widget, |
| 26 WebKit::WebLayerTreeViewClient* client, | |
| 27 WebKit::WebLayerTreeView::Settings settings); | 31 WebKit::WebLayerTreeView::Settings settings); |
| 28 | 32 |
| 29 virtual ~RenderWidgetCompositor(); | 33 virtual ~RenderWidgetCompositor(); |
| 30 | 34 |
| 31 cc::LayerTreeHost* layer_tree_host() const { return layer_tree_host_.get(); } | |
| 32 | |
| 33 void SetSuppressScheduleComposite(bool suppress); | 35 void SetSuppressScheduleComposite(bool suppress); |
| 36 void Animate(base::TimeTicks time); |
| 37 void Composite(); |
| 38 void GetRenderingStats(cc::RenderingStats* stats); |
| 39 skia::RefPtr<SkPicture> CapturePicture(); |
| 40 void EnableHidingTopControls(bool enable); |
| 34 | 41 |
| 35 // WebLayerTreeView implementation. | 42 // WebLayerTreeView implementation. |
| 36 virtual void setSurfaceReady(); | 43 virtual void setSurfaceReady(); |
| 37 virtual void setRootLayer(const WebKit::WebLayer& layer); | 44 virtual void setRootLayer(const WebKit::WebLayer& layer); |
| 38 virtual void clearRootLayer(); | 45 virtual void clearRootLayer(); |
| 39 virtual void setViewportSize( | 46 virtual void setViewportSize( |
| 40 const WebKit::WebSize& layout_viewport_size, | 47 const WebKit::WebSize& layout_viewport_size, |
| 41 const WebKit::WebSize& device_viewport_size); | 48 const WebKit::WebSize& device_viewport_size); |
| 42 virtual WebKit::WebSize layoutViewportSize() const; | 49 virtual WebKit::WebSize layoutViewportSize() const; |
| 43 virtual WebKit::WebSize deviceViewportSize() const; | 50 virtual WebKit::WebSize deviceViewportSize() const; |
| 44 virtual WebKit::WebFloatPoint adjustEventPointForPinchZoom( | 51 virtual WebKit::WebFloatPoint adjustEventPointForPinchZoom( |
| 45 const WebKit::WebFloatPoint& point) const; | 52 const WebKit::WebFloatPoint& point) const; |
| 46 virtual void setDeviceScaleFactor(float device_scale); | 53 virtual void setDeviceScaleFactor(float device_scale); |
| 47 virtual float deviceScaleFactor() const; | 54 virtual float deviceScaleFactor() const; |
| 48 virtual void setBackgroundColor(WebKit::WebColor color); | 55 virtual void setBackgroundColor(WebKit::WebColor color); |
| 49 virtual void setHasTransparentBackground(bool transparent); | 56 virtual void setHasTransparentBackground(bool transparent); |
| 50 virtual void setVisible(bool visible); | 57 virtual void setVisible(bool visible); |
| 51 virtual void setPageScaleFactorAndLimits(float page_scale_factor, | 58 virtual void setPageScaleFactorAndLimits(float page_scale_factor, |
| 52 float minimum, | 59 float minimum, |
| 53 float maximum); | 60 float maximum); |
| 54 virtual void startPageScaleAnimation(const WebKit::WebPoint& destination, | 61 virtual void startPageScaleAnimation(const WebKit::WebPoint& destination, |
| 55 bool use_anchor, | 62 bool use_anchor, |
| 56 float new_page_scale, | 63 float new_page_scale, |
| 57 double duration_sec); | 64 double duration_sec); |
| 58 virtual void setNeedsAnimate(); | 65 virtual void setNeedsAnimate(); |
| 59 virtual void setNeedsRedraw(); | 66 virtual void setNeedsRedraw(); |
| 60 virtual bool commitRequested() const; | 67 virtual bool commitRequested() const; |
| 61 virtual void composite(); | |
| 62 virtual void updateAnimations(double frame_begin_time); | |
| 63 virtual void didStopFlinging(); | 68 virtual void didStopFlinging(); |
| 64 virtual bool compositeAndReadback(void *pixels, const WebKit::WebRect& rect); | 69 virtual bool compositeAndReadback(void *pixels, const WebKit::WebRect& rect); |
| 65 virtual void finishAllRendering(); | 70 virtual void finishAllRendering(); |
| 66 virtual void setDeferCommits(bool defer_commits); | 71 virtual void setDeferCommits(bool defer_commits); |
| 67 virtual void renderingStats(WebKit::WebRenderingStats& stats) const {} | 72 virtual void renderingStats(WebKit::WebRenderingStats& stats) const {} |
| 68 virtual void setShowFPSCounter(bool show); | 73 virtual void setShowFPSCounter(bool show); |
| 69 virtual void setShowPaintRects(bool show); | 74 virtual void setShowPaintRects(bool show); |
| 70 virtual void setShowDebugBorders(bool show); | 75 virtual void setShowDebugBorders(bool show); |
| 71 virtual void setContinuousPaintingEnabled(bool enabled); | 76 virtual void setContinuousPaintingEnabled(bool enabled); |
| 72 | 77 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 84 virtual void didCommit() OVERRIDE; | 89 virtual void didCommit() OVERRIDE; |
| 85 virtual void didCommitAndDrawFrame() OVERRIDE; | 90 virtual void didCommitAndDrawFrame() OVERRIDE; |
| 86 virtual void didCompleteSwapBuffers() OVERRIDE; | 91 virtual void didCompleteSwapBuffers() OVERRIDE; |
| 87 virtual void scheduleComposite() OVERRIDE; | 92 virtual void scheduleComposite() OVERRIDE; |
| 88 virtual scoped_refptr<cc::ContextProvider> | 93 virtual scoped_refptr<cc::ContextProvider> |
| 89 OffscreenContextProviderForMainThread() OVERRIDE; | 94 OffscreenContextProviderForMainThread() OVERRIDE; |
| 90 virtual scoped_refptr<cc::ContextProvider> | 95 virtual scoped_refptr<cc::ContextProvider> |
| 91 OffscreenContextProviderForCompositorThread() OVERRIDE; | 96 OffscreenContextProviderForCompositorThread() OVERRIDE; |
| 92 | 97 |
| 93 private: | 98 private: |
| 94 RenderWidgetCompositor(RenderWidget* widget, | 99 explicit RenderWidgetCompositor(RenderWidget* widget); |
| 95 WebKit::WebLayerTreeViewClient* client); | |
| 96 | 100 |
| 97 bool initialize(cc::LayerTreeSettings settings); | 101 bool initialize(cc::LayerTreeSettings settings); |
| 98 | 102 |
| 99 bool threaded_; | 103 bool threaded_; |
| 100 bool suppress_schedule_composite_; | 104 bool suppress_schedule_composite_; |
| 101 RenderWidget* widget_; | 105 RenderWidget* widget_; |
| 102 WebKit::WebLayerTreeViewClient* client_; | |
| 103 scoped_ptr<cc::LayerTreeHost> layer_tree_host_; | 106 scoped_ptr<cc::LayerTreeHost> layer_tree_host_; |
| 104 }; | 107 }; |
| 105 | 108 |
| 106 } // namespace content | 109 } // namespace content |
| 107 | 110 |
| 108 #endif // CONTENT_RENDERER_GPU_RENDER_WIDGET_COMPOSITOR_H_ | 111 #endif // CONTENT_RENDERER_GPU_RENDER_WIDGET_COMPOSITOR_H_ |
| 109 | 112 |
| OLD | NEW |