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