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