| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_FEATURE_COMPOSITOR_BLIMP_COMPOSITOR_MANAGER_H_ | 5 #ifndef BLIMP_CLIENT_FEATURE_COMPOSITOR_BLIMP_COMPOSITOR_MANAGER_H_ |
| 6 #define BLIMP_CLIENT_FEATURE_COMPOSITOR_BLIMP_COMPOSITOR_MANAGER_H_ | 6 #define BLIMP_CLIENT_FEATURE_COMPOSITOR_BLIMP_COMPOSITOR_MANAGER_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "blimp/client/feature/compositor/blimp_compositor.h" | 9 #include "blimp/client/feature/compositor/blimp_compositor.h" |
| 10 #include "blimp/client/feature/compositor/blimp_gpu_memory_buffer_manager.h" | 10 #include "blimp/client/feature/compositor/blimp_gpu_memory_buffer_manager.h" |
| 11 #include "blimp/client/feature/render_widget_feature.h" | 11 #include "blimp/client/feature/render_widget_feature.h" |
| 12 #include "cc/trees/layer_tree_settings.h" | 12 #include "cc/trees/layer_tree_settings.h" |
| 13 | 13 |
| 14 namespace blimp { | 14 namespace blimp { |
| 15 namespace client { | 15 namespace client { |
| 16 | 16 |
| 17 class BlimpCompositorManagerClient { | |
| 18 public: | |
| 19 virtual void OnSwapBuffersCompleted() = 0; | |
| 20 }; | |
| 21 | |
| 22 // The BlimpCompositorManager manages multiple BlimpCompositor instances, each | 17 // The BlimpCompositorManager manages multiple BlimpCompositor instances, each |
| 23 // mapped to a render widget on the engine. The compositor corresponding to | 18 // mapped to a render widget on the engine. The compositor corresponding to |
| 24 // the render widget initialized on the engine will be the |active_compositor_|. | 19 // the render widget initialized on the engine will be the |active_compositor_|. |
| 25 // Only the |active_compositor_| holds the accelerated widget and builds the | 20 // Only the |active_compositor_| holds the accelerated widget and builds the |
| 26 // output surface from this widget to draw to the view. All events from the | 21 // output surface from this widget to draw to the view. All events from the |
| 27 // native view are forwarded to this compositor. | 22 // native view are forwarded to this compositor. |
| 28 class BlimpCompositorManager | 23 class BlimpCompositorManager |
| 29 : public RenderWidgetFeature::RenderWidgetFeatureDelegate, | 24 : public RenderWidgetFeature::RenderWidgetFeatureDelegate, |
| 30 public BlimpCompositorClient { | 25 public BlimpCompositorClient { |
| 31 public: | 26 public: |
| 32 explicit BlimpCompositorManager(RenderWidgetFeature* render_widget_feature, | 27 explicit BlimpCompositorManager(RenderWidgetFeature* render_widget_feature); |
| 33 BlimpCompositorManagerClient* client); | |
| 34 ~BlimpCompositorManager() override; | 28 ~BlimpCompositorManager() override; |
| 35 | 29 |
| 36 void SetVisible(bool visible); | 30 void SetVisible(bool visible); |
| 37 | 31 |
| 38 void SetAcceleratedWidget(gfx::AcceleratedWidget widget); | 32 void SetAcceleratedWidget(gfx::AcceleratedWidget widget); |
| 39 | 33 |
| 40 void ReleaseAcceleratedWidget(); | 34 void ReleaseAcceleratedWidget(); |
| 41 | 35 |
| 42 bool OnTouchEvent(const ui::MotionEvent& motion_event); | 36 bool OnTouchEvent(const ui::MotionEvent& motion_event); |
| 43 | 37 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 60 private: | 54 private: |
| 61 // RenderWidgetFeatureDelegate implementation. | 55 // RenderWidgetFeatureDelegate implementation. |
| 62 void OnRenderWidgetCreated(int render_widget_id) override; | 56 void OnRenderWidgetCreated(int render_widget_id) override; |
| 63 void OnRenderWidgetInitialized(int render_widget_id) override; | 57 void OnRenderWidgetInitialized(int render_widget_id) override; |
| 64 void OnRenderWidgetDeleted(int render_widget_id) override; | 58 void OnRenderWidgetDeleted(int render_widget_id) override; |
| 65 void OnCompositorMessageReceived( | 59 void OnCompositorMessageReceived( |
| 66 int render_widget_id, | 60 int render_widget_id, |
| 67 std::unique_ptr<cc::proto::CompositorMessage> message) override; | 61 std::unique_ptr<cc::proto::CompositorMessage> message) override; |
| 68 | 62 |
| 69 // BlimpCompositorClient implementation. | 63 // BlimpCompositorClient implementation. |
| 70 void DidCompleteSwapBuffers() override; | |
| 71 cc::LayerTreeSettings* GetLayerTreeSettings() override; | 64 cc::LayerTreeSettings* GetLayerTreeSettings() override; |
| 72 scoped_refptr<base::SingleThreadTaskRunner> | 65 scoped_refptr<base::SingleThreadTaskRunner> |
| 73 GetCompositorTaskRunner() override; | 66 GetCompositorTaskRunner() override; |
| 74 cc::TaskGraphRunner* GetTaskGraphRunner() override; | 67 cc::TaskGraphRunner* GetTaskGraphRunner() override; |
| 75 gpu::GpuMemoryBufferManager* GetGpuMemoryBufferManager() override; | 68 gpu::GpuMemoryBufferManager* GetGpuMemoryBufferManager() override; |
| 76 cc::ImageSerializationProcessor* GetImageSerializationProcessor() override; | 69 cc::ImageSerializationProcessor* GetImageSerializationProcessor() override; |
| 77 void SendWebGestureEvent( | 70 void SendWebGestureEvent( |
| 78 int render_widget_id, | 71 int render_widget_id, |
| 79 const blink::WebGestureEvent& gesture_event) override; | 72 const blink::WebGestureEvent& gesture_event) override; |
| 80 void SendCompositorMessage( | 73 void SendCompositorMessage( |
| (...skipping 22 matching lines...) Expand all Loading... |
| 103 BlimpCompositor* active_compositor_; | 96 BlimpCompositor* active_compositor_; |
| 104 | 97 |
| 105 // Lazily created thread that will run the compositor rendering tasks and will | 98 // Lazily created thread that will run the compositor rendering tasks and will |
| 106 // be shared by all compositor instances. | 99 // be shared by all compositor instances. |
| 107 std::unique_ptr<base::Thread> compositor_thread_; | 100 std::unique_ptr<base::Thread> compositor_thread_; |
| 108 | 101 |
| 109 // The bridge to the network layer that does the proto/RenderWidget id work. | 102 // The bridge to the network layer that does the proto/RenderWidget id work. |
| 110 // BlimpCompositorManager does not own this and it is expected to outlive this | 103 // BlimpCompositorManager does not own this and it is expected to outlive this |
| 111 // BlimpCompositorManager instance. | 104 // BlimpCompositorManager instance. |
| 112 RenderWidgetFeature* render_widget_feature_; | 105 RenderWidgetFeature* render_widget_feature_; |
| 113 BlimpCompositorManagerClient* client_; | |
| 114 | 106 |
| 115 DISALLOW_COPY_AND_ASSIGN(BlimpCompositorManager); | 107 DISALLOW_COPY_AND_ASSIGN(BlimpCompositorManager); |
| 116 }; | 108 }; |
| 117 | 109 |
| 118 } // namespace client | 110 } // namespace client |
| 119 } // namespace blimp | 111 } // namespace blimp |
| 120 | 112 |
| 121 #endif // BLIMP_CLIENT_FEATURE_COMPOSITOR_BLIMP_COMPOSITOR_MANAGER_H_ | 113 #endif // BLIMP_CLIENT_FEATURE_COMPOSITOR_BLIMP_COMPOSITOR_MANAGER_H_ |
| OLD | NEW |