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