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 "cc/layer_tree_host_client.h" | 8 #include "cc/layer_tree_host_client.h" |
| 9 #include "cc/layer_tree_settings.h" | 9 #include "cc/layer_tree_settings.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 LayerTreeHost; | 13 class LayerTreeHost; |
| 14 } | 14 } |
| 15 | 15 |
| 16 namespace content { | 16 namespace content { |
| 17 class RenderWidget; | 17 class RenderWidget; |
| 18 | 18 |
| 19 class RenderWidgetCompositor : public WebKit::WebLayerTreeView, | 19 class RenderWidgetCompositor : public WebKit::WebLayerTreeView, |
| 20 public cc::LayerTreeHostClient { | 20 public cc::LayerTreeHostClient { |
| 21 public: | 21 public: |
| 22 // Attempt to construct and initialize a compositor instance for the widget | 22 // Attempt to construct and initialize a compositor instance for the widget |
| 23 // with the given settings. Returns NULL if initialization fails. | 23 // with the given settings. Returns NULL if initialization fails. |
| 24 static scoped_ptr<RenderWidgetCompositor> Create( | 24 static scoped_ptr<RenderWidgetCompositor> Create( |
| 25 RenderWidget* widget, | 25 RenderWidget* widget, |
| 26 WebKit::WebLayerTreeViewClient* client, | |
| 27 WebKit::WebLayerTreeView::Settings settings); | 26 WebKit::WebLayerTreeView::Settings settings); |
| 28 | 27 |
| 29 virtual ~RenderWidgetCompositor(); | 28 virtual ~RenderWidgetCompositor(); |
| 30 | 29 |
| 31 cc::LayerTreeHost* layer_tree_host() const { return layer_tree_host_.get(); } | 30 cc::LayerTreeHost* layer_tree_host() const { return layer_tree_host_.get(); } |
| 32 | 31 |
| 33 void SetSuppressScheduleComposite(bool suppress); | 32 void SetSuppressScheduleComposite(bool suppress); |
| 34 | 33 |
| 35 // WebLayerTreeView implementation. | 34 // WebLayerTreeView implementation. |
| 36 virtual void setSurfaceReady(); | 35 virtual void setSurfaceReady(); |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 51 virtual void setPageScaleFactorAndLimits(float page_scale_factor, | 50 virtual void setPageScaleFactorAndLimits(float page_scale_factor, |
| 52 float minimum, | 51 float minimum, |
| 53 float maximum); | 52 float maximum); |
| 54 virtual void startPageScaleAnimation(const WebKit::WebPoint& destination, | 53 virtual void startPageScaleAnimation(const WebKit::WebPoint& destination, |
| 55 bool use_anchor, | 54 bool use_anchor, |
| 56 float new_page_scale, | 55 float new_page_scale, |
| 57 double duration_sec); | 56 double duration_sec); |
| 58 virtual void setNeedsAnimate(); | 57 virtual void setNeedsAnimate(); |
| 59 virtual void setNeedsRedraw(); | 58 virtual void setNeedsRedraw(); |
| 60 virtual bool commitRequested() const; | 59 virtual bool commitRequested() const; |
| 61 virtual void composite(); | |
| 62 virtual void updateAnimations(double frame_begin_time); | |
|
piman
2013/03/01 01:51:40
nit: We could keep both of these as accessor funct
| |
| 63 virtual void didStopFlinging(); | 60 virtual void didStopFlinging(); |
| 64 virtual bool compositeAndReadback(void *pixels, const WebKit::WebRect& rect); | 61 virtual bool compositeAndReadback(void *pixels, const WebKit::WebRect& rect); |
| 65 virtual void finishAllRendering(); | 62 virtual void finishAllRendering(); |
| 66 virtual void setDeferCommits(bool defer_commits); | 63 virtual void setDeferCommits(bool defer_commits); |
| 67 virtual void renderingStats(WebKit::WebRenderingStats& stats) const {} | 64 virtual void renderingStats(WebKit::WebRenderingStats& stats) const {} |
| 68 virtual void setShowFPSCounter(bool show); | 65 virtual void setShowFPSCounter(bool show); |
| 69 virtual void setShowPaintRects(bool show); | 66 virtual void setShowPaintRects(bool show); |
| 70 virtual void setShowDebugBorders(bool show); | 67 virtual void setShowDebugBorders(bool show); |
| 71 virtual void setContinuousPaintingEnabled(bool enabled); | 68 virtual void setContinuousPaintingEnabled(bool enabled); |
| 72 | 69 |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 84 virtual void didCommit() OVERRIDE; | 81 virtual void didCommit() OVERRIDE; |
| 85 virtual void didCommitAndDrawFrame() OVERRIDE; | 82 virtual void didCommitAndDrawFrame() OVERRIDE; |
| 86 virtual void didCompleteSwapBuffers() OVERRIDE; | 83 virtual void didCompleteSwapBuffers() OVERRIDE; |
| 87 virtual void scheduleComposite() OVERRIDE; | 84 virtual void scheduleComposite() OVERRIDE; |
| 88 virtual scoped_refptr<cc::ContextProvider> | 85 virtual scoped_refptr<cc::ContextProvider> |
| 89 OffscreenContextProviderForMainThread() OVERRIDE; | 86 OffscreenContextProviderForMainThread() OVERRIDE; |
| 90 virtual scoped_refptr<cc::ContextProvider> | 87 virtual scoped_refptr<cc::ContextProvider> |
| 91 OffscreenContextProviderForCompositorThread() OVERRIDE; | 88 OffscreenContextProviderForCompositorThread() OVERRIDE; |
| 92 | 89 |
| 93 private: | 90 private: |
| 94 RenderWidgetCompositor(RenderWidget* widget, | 91 explicit RenderWidgetCompositor(RenderWidget* widget); |
| 95 WebKit::WebLayerTreeViewClient* client); | |
| 96 | 92 |
| 97 bool initialize(cc::LayerTreeSettings settings); | 93 bool initialize(cc::LayerTreeSettings settings); |
| 98 | 94 |
| 99 bool threaded_; | 95 bool threaded_; |
| 100 bool suppress_schedule_composite_; | 96 bool suppress_schedule_composite_; |
| 101 RenderWidget* widget_; | 97 RenderWidget* widget_; |
| 102 WebKit::WebLayerTreeViewClient* client_; | |
| 103 scoped_ptr<cc::LayerTreeHost> layer_tree_host_; | 98 scoped_ptr<cc::LayerTreeHost> layer_tree_host_; |
| 104 | 99 |
| 105 class MainThreadContextProvider; | 100 class MainThreadContextProvider; |
| 106 scoped_refptr<MainThreadContextProvider> contexts_main_thread_; | 101 scoped_refptr<MainThreadContextProvider> contexts_main_thread_; |
| 107 class CompositorThreadContextProvider; | 102 class CompositorThreadContextProvider; |
| 108 scoped_refptr<CompositorThreadContextProvider> contexts_compositor_thread_; | 103 scoped_refptr<CompositorThreadContextProvider> contexts_compositor_thread_; |
| 109 }; | 104 }; |
| 110 | 105 |
| 111 } // namespace content | 106 } // namespace content |
| 112 | 107 |
| 113 #endif // CONTENT_RENDERER_GPU_RENDER_WIDGET_COMPOSITOR_H_ | 108 #endif // CONTENT_RENDERER_GPU_RENDER_WIDGET_COMPOSITOR_H_ |
| 114 | 109 |
| OLD | NEW |