| 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 <map> |
| 9 |
| 8 #include "base/macros.h" | 10 #include "base/macros.h" |
| 9 #include "blimp/client/feature/compositor/blimp_compositor.h" | 11 #include "blimp/client/feature/compositor/blimp_compositor.h" |
| 10 #include "blimp/client/feature/compositor/blimp_gpu_memory_buffer_manager.h" | 12 #include "blimp/client/feature/compositor/blimp_gpu_memory_buffer_manager.h" |
| 13 #include "blimp/client/feature/compositor/blob_image_serialization_processor.h" |
| 11 #include "blimp/client/feature/render_widget_feature.h" | 14 #include "blimp/client/feature/render_widget_feature.h" |
| 12 #include "cc/trees/layer_tree_settings.h" | 15 #include "cc/trees/layer_tree_settings.h" |
| 13 | 16 |
| 14 namespace blimp { | 17 namespace blimp { |
| 15 namespace client { | 18 namespace client { |
| 16 | 19 |
| 17 class ClientImageSerializationProcessor; | |
| 18 | |
| 19 class BlimpCompositorManagerClient { | 20 class BlimpCompositorManagerClient { |
| 20 public: | 21 public: |
| 21 virtual void OnSwapBuffersCompleted() = 0; | 22 virtual void OnSwapBuffersCompleted() = 0; |
| 22 virtual void DidCommitAndDrawFrame() = 0; | 23 virtual void DidCommitAndDrawFrame() = 0; |
| 23 }; | 24 }; |
| 24 | 25 |
| 25 // The BlimpCompositorManager manages multiple BlimpCompositor instances, each | 26 // The BlimpCompositorManager manages multiple BlimpCompositor instances, each |
| 26 // mapped to a render widget on the engine. The compositor corresponding to | 27 // mapped to a render widget on the engine. The compositor corresponding to |
| 27 // the render widget initialized on the engine will be the |active_compositor_|. | 28 // the render widget initialized on the engine will be the |active_compositor_|. |
| 28 // Only the |active_compositor_| holds the accelerated widget and builds the | 29 // Only the |active_compositor_| holds the accelerated widget and builds the |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 const cc::proto::CompositorMessage& message) override; | 87 const cc::proto::CompositorMessage& message) override; |
| 87 | 88 |
| 88 bool visible_; | 89 bool visible_; |
| 89 | 90 |
| 90 gfx::AcceleratedWidget window_; | 91 gfx::AcceleratedWidget window_; |
| 91 | 92 |
| 92 std::unique_ptr<cc::LayerTreeSettings> settings_; | 93 std::unique_ptr<cc::LayerTreeSettings> settings_; |
| 93 | 94 |
| 94 std::unique_ptr<BlimpGpuMemoryBufferManager> gpu_memory_buffer_manager_; | 95 std::unique_ptr<BlimpGpuMemoryBufferManager> gpu_memory_buffer_manager_; |
| 95 | 96 |
| 96 // Provides the functionality to deserialize images in SkPicture. | |
| 97 std::unique_ptr<ClientImageSerializationProcessor> | |
| 98 image_serialization_processor_; | |
| 99 | |
| 100 // A map of render_widget_ids to the BlimpCompositor instance. | 97 // A map of render_widget_ids to the BlimpCompositor instance. |
| 101 typedef std::map<int, std::unique_ptr<BlimpCompositor>> CompositorMap; | 98 typedef std::map<int, std::unique_ptr<BlimpCompositor>> CompositorMap; |
| 102 CompositorMap compositors_; | 99 CompositorMap compositors_; |
| 103 | 100 |
| 104 // The |active_compositor_| represents the compositor from the CompositorMap | 101 // The |active_compositor_| represents the compositor from the CompositorMap |
| 105 // that is currently visible and has the |window_|. It corresponds to the | 102 // that is currently visible and has the |window_|. It corresponds to the |
| 106 // render widget currently initialized on the engine. | 103 // render widget currently initialized on the engine. |
| 107 BlimpCompositor* active_compositor_; | 104 BlimpCompositor* active_compositor_; |
| 108 | 105 |
| 109 // Lazily created thread that will run the compositor rendering tasks and will | 106 // Lazily created thread that will run the compositor rendering tasks and will |
| 110 // be shared by all compositor instances. | 107 // be shared by all compositor instances. |
| 111 std::unique_ptr<base::Thread> compositor_thread_; | 108 std::unique_ptr<base::Thread> compositor_thread_; |
| 112 | 109 |
| 113 // The bridge to the network layer that does the proto/RenderWidget id work. | 110 // The bridge to the network layer that does the proto/RenderWidget id work. |
| 114 // BlimpCompositorManager does not own this and it is expected to outlive this | 111 // BlimpCompositorManager does not own this and it is expected to outlive this |
| 115 // BlimpCompositorManager instance. | 112 // BlimpCompositorManager instance. |
| 116 RenderWidgetFeature* render_widget_feature_; | 113 RenderWidgetFeature* render_widget_feature_; |
| 117 BlimpCompositorManagerClient* client_; | 114 BlimpCompositorManagerClient* client_; |
| 118 | 115 |
| 119 DISALLOW_COPY_AND_ASSIGN(BlimpCompositorManager); | 116 DISALLOW_COPY_AND_ASSIGN(BlimpCompositorManager); |
| 120 }; | 117 }; |
| 121 | 118 |
| 122 } // namespace client | 119 } // namespace client |
| 123 } // namespace blimp | 120 } // namespace blimp |
| 124 | 121 |
| 125 #endif // BLIMP_CLIENT_FEATURE_COMPOSITOR_BLIMP_COMPOSITOR_MANAGER_H_ | 122 #endif // BLIMP_CLIENT_FEATURE_COMPOSITOR_BLIMP_COMPOSITOR_MANAGER_H_ |
| OLD | NEW |