| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 BLIMP_CLIENT_CORE_COMPOSITOR_BLIMP_COMPOSITOR_H_ | 5 #ifndef BLIMP_CLIENT_CORE_COMPOSITOR_BLIMP_COMPOSITOR_H_ |
| 6 #define BLIMP_CLIENT_CORE_COMPOSITOR_BLIMP_COMPOSITOR_H_ | 6 #define BLIMP_CLIENT_CORE_COMPOSITOR_BLIMP_COMPOSITOR_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
| 12 #include "blimp/client/core/compositor/blimp_output_surface.h" | 12 #include "blimp/client/core/compositor/blimp_output_surface.h" |
| 13 #include "blimp/client/core/input/blimp_input_manager.h" | 13 #include "blimp/client/core/input/blimp_input_manager.h" |
| 14 #include "blimp/client/public/compositor/compositor_dependencies.h" |
| 14 #include "cc/surfaces/surface_factory_client.h" | 15 #include "cc/surfaces/surface_factory_client.h" |
| 15 #include "cc/trees/layer_tree_host.h" | 16 #include "cc/trees/layer_tree_host.h" |
| 16 #include "cc/trees/layer_tree_host_client.h" | 17 #include "cc/trees/layer_tree_host_client.h" |
| 17 #include "cc/trees/layer_tree_settings.h" | 18 #include "cc/trees/layer_tree_settings.h" |
| 18 #include "cc/trees/remote_proto_channel.h" | 19 #include "cc/trees/remote_proto_channel.h" |
| 19 #include "ui/gfx/geometry/size.h" | 20 #include "ui/gfx/geometry/size.h" |
| 20 #include "ui/gfx/native_widget_types.h" | 21 #include "ui/gfx/native_widget_types.h" |
| 21 | 22 |
| 22 namespace base { | 23 namespace base { |
| 23 class SingleThreadTaskRunner; | 24 class SingleThreadTaskRunner; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 39 class SurfaceId; | 40 class SurfaceId; |
| 40 class SurfaceIdAllocator; | 41 class SurfaceIdAllocator; |
| 41 } // namespace cc | 42 } // namespace cc |
| 42 | 43 |
| 43 namespace blimp { | 44 namespace blimp { |
| 44 class BlimpMessage; | 45 class BlimpMessage; |
| 45 | 46 |
| 46 namespace client { | 47 namespace client { |
| 47 | 48 |
| 48 class BlimpCompositorDependencies; | 49 class BlimpCompositorDependencies; |
| 49 class CompositorDependencies; | |
| 50 | 50 |
| 51 // The BlimpCompositorClient provides the BlimpCompositor with the necessary | 51 // The BlimpCompositorClient provides the BlimpCompositor with the necessary |
| 52 // dependencies for cc::LayerTreeHost owned by this compositor and for | 52 // dependencies for cc::LayerTreeHost owned by this compositor and for |
| 53 // communicating the compositor and input messages to the corresponding | 53 // communicating the compositor and input messages to the corresponding |
| 54 // render widget of this compositor on the engine. | 54 // render widget of this compositor on the engine. |
| 55 class BlimpCompositorClient { | 55 class BlimpCompositorClient { |
| 56 public: | 56 public: |
| 57 // Should send web gesture events which could not be handled locally by the | 57 // Should send web gesture events which could not be handled locally by the |
| 58 // compositor to the engine. | 58 // compositor to the engine. |
| 59 virtual void SendWebGestureEvent( | 59 virtual void SendWebGestureEvent( |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 // Forwards the touch event to the |input_manager_|. | 96 // Forwards the touch event to the |input_manager_|. |
| 97 // virtual for testing. | 97 // virtual for testing. |
| 98 virtual bool OnTouchEvent(const ui::MotionEvent& motion_event); | 98 virtual bool OnTouchEvent(const ui::MotionEvent& motion_event); |
| 99 | 99 |
| 100 // Called to forward the compositor message from the remote server | 100 // Called to forward the compositor message from the remote server |
| 101 // LayerTreeHost of the render widget for this compositor. | 101 // LayerTreeHost of the render widget for this compositor. |
| 102 // virtual for testing. | 102 // virtual for testing. |
| 103 virtual void OnCompositorMessageReceived( | 103 virtual void OnCompositorMessageReceived( |
| 104 std::unique_ptr<cc::proto::CompositorMessage> message); | 104 std::unique_ptr<cc::proto::CompositorMessage> message); |
| 105 | 105 |
| 106 // Called when the a ContextProvider has been created by the | |
| 107 // CompositorDependencies class. If |host_| is waiting on an OutputSurface | |
| 108 // this will build one for it. | |
| 109 void OnContextProviderCreated( | |
| 110 const scoped_refptr<cc::ContextProvider>& provider); | |
| 111 | |
| 112 scoped_refptr<cc::Layer> layer() const { return layer_; } | 106 scoped_refptr<cc::Layer> layer() const { return layer_; } |
| 113 | 107 |
| 114 int render_widget_id() const { return render_widget_id_; } | 108 int render_widget_id() const { return render_widget_id_; } |
| 115 | 109 |
| 116 private: | 110 private: |
| 117 friend class BlimpCompositorForTesting; | 111 friend class BlimpCompositorForTesting; |
| 118 | 112 |
| 119 // LayerTreeHostClient implementation. | 113 // LayerTreeHostClient implementation. |
| 120 void WillBeginMainFrame() override {} | 114 void WillBeginMainFrame() override {} |
| 121 void DidBeginMainFrame() override {} | 115 void DidBeginMainFrame() override {} |
| (...skipping 26 matching lines...) Expand all Loading... |
| 148 // BlimpOutputSurfaceClient implementation. | 142 // BlimpOutputSurfaceClient implementation. |
| 149 void BindToOutputSurface( | 143 void BindToOutputSurface( |
| 150 base::WeakPtr<BlimpOutputSurface> output_surface) override; | 144 base::WeakPtr<BlimpOutputSurface> output_surface) override; |
| 151 void SwapCompositorFrame(cc::CompositorFrame frame) override; | 145 void SwapCompositorFrame(cc::CompositorFrame frame) override; |
| 152 void UnbindOutputSurface() override; | 146 void UnbindOutputSurface() override; |
| 153 | 147 |
| 154 // SurfaceFactoryClient implementation. | 148 // SurfaceFactoryClient implementation. |
| 155 void ReturnResources(const cc::ReturnedResourceArray& resources) override; | 149 void ReturnResources(const cc::ReturnedResourceArray& resources) override; |
| 156 void SetBeginFrameSource(cc::BeginFrameSource* begin_frame_source) override {} | 150 void SetBeginFrameSource(cc::BeginFrameSource* begin_frame_source) override {} |
| 157 | 151 |
| 152 // Called when the a ContextProvider has been created by the |
| 153 // CompositorDependencies class. If |host_| is waiting on an OutputSurface |
| 154 // this will build one for it. |
| 155 void OnContextProvidersCreated( |
| 156 const blimp::client::CompositorDependencies::ContextProviders& |
| 157 context_providers); |
| 158 |
| 158 // Helper method to get the embedder dependencies. | 159 // Helper method to get the embedder dependencies. |
| 159 CompositorDependencies* GetEmbedderDeps(); | 160 CompositorDependencies* GetEmbedderDeps(); |
| 160 | 161 |
| 161 // TODO(khushalsagar): Move all of this to the |DocumentView| or another | 162 // TODO(khushalsagar): Move all of this to the |DocumentView| or another |
| 162 // platform specific class. So we use the DelegatedFrameHostAndroid like the | 163 // platform specific class. So we use the DelegatedFrameHostAndroid like the |
| 163 // RenderWidgetHostViewAndroid. | 164 // RenderWidgetHostViewAndroid. |
| 164 void DestroyDelegatedContent(); | 165 void DestroyDelegatedContent(); |
| 165 | 166 |
| 166 // Helper method to build the internal CC LayerTreeHost instance from | 167 // Helper method to build the internal CC LayerTreeHost instance from |
| 167 // |message|. | 168 // |message|. |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 | 217 |
| 217 base::WeakPtrFactory<BlimpCompositor> weak_ptr_factory_; | 218 base::WeakPtrFactory<BlimpCompositor> weak_ptr_factory_; |
| 218 | 219 |
| 219 DISALLOW_COPY_AND_ASSIGN(BlimpCompositor); | 220 DISALLOW_COPY_AND_ASSIGN(BlimpCompositor); |
| 220 }; | 221 }; |
| 221 | 222 |
| 222 } // namespace client | 223 } // namespace client |
| 223 } // namespace blimp | 224 } // namespace blimp |
| 224 | 225 |
| 225 #endif // BLIMP_CLIENT_CORE_COMPOSITOR_BLIMP_COMPOSITOR_H_ | 226 #endif // BLIMP_CLIENT_CORE_COMPOSITOR_BLIMP_COMPOSITOR_H_ |
| OLD | NEW |