| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 COMPONENTS_HTML_VIEWER_WEB_LAYER_TREE_VIEW_IMPL_H_ | 5 #ifndef COMPONENTS_HTML_VIEWER_WEB_LAYER_TREE_VIEW_IMPL_H_ |
| 6 #define COMPONENTS_HTML_VIEWER_WEB_LAYER_TREE_VIEW_IMPL_H_ | 6 #define COMPONENTS_HTML_VIEWER_WEB_LAYER_TREE_VIEW_IMPL_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
| 12 #include "base/single_thread_task_runner.h" | 12 #include "base/single_thread_task_runner.h" |
| 13 #include "cc/trees/layer_tree_host_client.h" | 13 #include "cc/trees/layer_tree_host_client.h" |
| 14 #include "components/view_manager/public/interfaces/gpu.mojom.h" | 14 #include "components/view_manager/public/interfaces/gpu.mojom.h" |
| 15 #include "components/view_manager/public/interfaces/surfaces.mojom.h" | |
| 16 #include "mojo/cc/output_surface_mojo.h" | 15 #include "mojo/cc/output_surface_mojo.h" |
| 17 #include "third_party/WebKit/public/platform/WebLayerTreeView.h" | 16 #include "third_party/WebKit/public/platform/WebLayerTreeView.h" |
| 18 | 17 |
| 19 namespace base { | 18 namespace base { |
| 20 class SingleThreadTaskRunner; | 19 class SingleThreadTaskRunner; |
| 21 } | 20 } |
| 22 | 21 |
| 23 namespace blink { | 22 namespace blink { |
| 24 class WebWidget; | 23 class WebWidget; |
| 25 } | 24 } |
| 26 | 25 |
| 27 namespace cc { | 26 namespace cc { |
| 28 class LayerTreeHost; | 27 class LayerTreeHost; |
| 29 class TaskGraphRunner; | 28 class TaskGraphRunner; |
| 30 } | 29 } |
| 31 | 30 |
| 32 namespace gpu { | 31 namespace gpu { |
| 33 class GpuMemoryBufferManager; | 32 class GpuMemoryBufferManager; |
| 34 } | 33 } |
| 35 | 34 |
| 36 namespace mojo { | 35 namespace mojo { |
| 37 class View; | 36 class View; |
| 38 } | 37 } |
| 39 | 38 |
| 40 namespace html_viewer { | 39 namespace html_viewer { |
| 41 | 40 |
| 42 class WebLayerTreeViewImpl : public blink::WebLayerTreeView, | 41 class WebLayerTreeViewImpl : public blink::WebLayerTreeView, |
| 43 public cc::LayerTreeHostClient, | 42 public cc::LayerTreeHostClient { |
| 44 public mojo::OutputSurfaceMojoClient { | |
| 45 public: | 43 public: |
| 46 WebLayerTreeViewImpl( | 44 WebLayerTreeViewImpl( |
| 47 scoped_refptr<base::SingleThreadTaskRunner> compositor_task_runner, | 45 scoped_refptr<base::SingleThreadTaskRunner> compositor_task_runner, |
| 48 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, | 46 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, |
| 49 cc::TaskGraphRunner* task_graph_runner, | 47 cc::TaskGraphRunner* task_graph_runner); |
| 50 mojo::SurfacePtr surface, | |
| 51 mojo::GpuPtr gpu_service); | |
| 52 ~WebLayerTreeViewImpl() override; | 48 ~WebLayerTreeViewImpl() override; |
| 53 | 49 |
| 54 void set_widget(blink::WebWidget* widget) { widget_ = widget; } | 50 void Initialize(mojo::GpuPtr gpu_service, |
| 55 void set_view(mojo::View* view) { view_ = view; } | 51 mojo::View* view, |
| 52 blink::WebWidget* widget); |
| 56 | 53 |
| 57 // cc::LayerTreeHostClient implementation. | 54 // cc::LayerTreeHostClient implementation. |
| 58 void WillBeginMainFrame() override; | 55 void WillBeginMainFrame() override; |
| 59 void DidBeginMainFrame() override; | 56 void DidBeginMainFrame() override; |
| 60 void BeginMainFrame(const cc::BeginFrameArgs& args) override; | 57 void BeginMainFrame(const cc::BeginFrameArgs& args) override; |
| 61 void BeginMainFrameNotExpectedSoon() override; | 58 void BeginMainFrameNotExpectedSoon() override; |
| 62 void Layout() override; | 59 void Layout() override; |
| 63 void ApplyViewportDeltas(const gfx::Vector2dF& inner_delta, | 60 void ApplyViewportDeltas(const gfx::Vector2dF& inner_delta, |
| 64 const gfx::Vector2dF& outer_delta, | 61 const gfx::Vector2dF& outer_delta, |
| 65 const gfx::Vector2dF& elastic_overscroll_delta, | 62 const gfx::Vector2dF& elastic_overscroll_delta, |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 const blink::WebLayer* outerViewportScrollLayer); | 108 const blink::WebLayer* outerViewportScrollLayer); |
| 112 virtual void clearViewportLayers(); | 109 virtual void clearViewportLayers(); |
| 113 virtual void registerSelection(const blink::WebSelection& selection) {} | 110 virtual void registerSelection(const blink::WebSelection& selection) {} |
| 114 virtual void clearSelection() {} | 111 virtual void clearSelection() {} |
| 115 virtual void setShowFPSCounter(bool) {} | 112 virtual void setShowFPSCounter(bool) {} |
| 116 virtual void setShowPaintRects(bool) {} | 113 virtual void setShowPaintRects(bool) {} |
| 117 virtual void setShowDebugBorders(bool) {} | 114 virtual void setShowDebugBorders(bool) {} |
| 118 virtual void setContinuousPaintingEnabled(bool) {} | 115 virtual void setContinuousPaintingEnabled(bool) {} |
| 119 virtual void setShowScrollBottleneckRects(bool) {} | 116 virtual void setShowScrollBottleneckRects(bool) {} |
| 120 | 117 |
| 121 // OutputSurfaceMojoClient implementation. | |
| 122 void DidCreateSurface(cc::SurfaceId id) override; | |
| 123 | |
| 124 private: | 118 private: |
| 125 void DidCreateSurfaceOnMainThread(cc::SurfaceId id); | |
| 126 | |
| 127 // widget_ and view_ will outlive us. | 119 // widget_ and view_ will outlive us. |
| 128 blink::WebWidget* widget_; | 120 blink::WebWidget* widget_; |
| 129 mojo::View* view_; | 121 mojo::View* view_; |
| 130 scoped_ptr<cc::LayerTreeHost> layer_tree_host_; | 122 scoped_ptr<cc::LayerTreeHost> layer_tree_host_; |
| 131 scoped_ptr<cc::OutputSurface> output_surface_; | 123 scoped_ptr<cc::OutputSurface> output_surface_; |
| 132 scoped_refptr<base::SingleThreadTaskRunner> | 124 scoped_refptr<base::SingleThreadTaskRunner> |
| 133 main_thread_compositor_task_runner_; | 125 main_thread_compositor_task_runner_; |
| 134 base::WeakPtr<WebLayerTreeViewImpl> main_thread_bound_weak_ptr_; | 126 base::WeakPtr<WebLayerTreeViewImpl> main_thread_bound_weak_ptr_; |
| 135 | 127 |
| 136 base::WeakPtrFactory<WebLayerTreeViewImpl> weak_factory_; | 128 base::WeakPtrFactory<WebLayerTreeViewImpl> weak_factory_; |
| 137 DISALLOW_COPY_AND_ASSIGN(WebLayerTreeViewImpl); | 129 DISALLOW_COPY_AND_ASSIGN(WebLayerTreeViewImpl); |
| 138 }; | 130 }; |
| 139 | 131 |
| 140 } // namespace html_viewer | 132 } // namespace html_viewer |
| 141 | 133 |
| 142 #endif // COMPONENTS_HTML_VIEWER_WEB_LAYER_TREE_VIEW_IMPL_H_ | 134 #endif // COMPONENTS_HTML_VIEWER_WEB_LAYER_TREE_VIEW_IMPL_H_ |
| OLD | NEW |