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_CORE_COMPOSITOR_BLIMP_COMPOSITOR_MANAGER_H_ | 5 #ifndef BLIMP_CLIENT_CORE_COMPOSITOR_BLIMP_COMPOSITOR_MANAGER_H_ |
6 #define BLIMP_CLIENT_CORE_COMPOSITOR_BLIMP_COMPOSITOR_MANAGER_H_ | 6 #define BLIMP_CLIENT_CORE_COMPOSITOR_BLIMP_COMPOSITOR_MANAGER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 // mapped to a render widget on the engine. The compositor corresponding to | 21 // mapped to a render widget on the engine. The compositor corresponding to |
22 // the render widget initialized on the engine will be the |active_compositor_|. | 22 // the render widget initialized on the engine will be the |active_compositor_|. |
23 // Only the |active_compositor_| holds the accelerated widget and builds the | 23 // Only the |active_compositor_| holds the accelerated widget and builds the |
24 // output surface from this widget to draw to the view. All events from the | 24 // output surface from this widget to draw to the view. All events from the |
25 // native view are forwarded to this compositor. | 25 // native view are forwarded to this compositor. |
26 class BlimpCompositorManager | 26 class BlimpCompositorManager |
27 : public RenderWidgetFeature::RenderWidgetFeatureDelegate, | 27 : public RenderWidgetFeature::RenderWidgetFeatureDelegate, |
28 public BlimpCompositorClient { | 28 public BlimpCompositorClient { |
29 public: | 29 public: |
30 explicit BlimpCompositorManager( | 30 explicit BlimpCompositorManager( |
| 31 int blimp_contents_id, |
31 RenderWidgetFeature* render_widget_feature, | 32 RenderWidgetFeature* render_widget_feature, |
32 BlimpCompositorDependencies* compositor_dependencies); | 33 BlimpCompositorDependencies* compositor_dependencies); |
33 ~BlimpCompositorManager() override; | 34 ~BlimpCompositorManager() override; |
34 | 35 |
35 void SetVisible(bool visible); | 36 void SetVisible(bool visible); |
36 | 37 |
37 bool OnTouchEvent(const ui::MotionEvent& motion_event); | 38 bool OnTouchEvent(const ui::MotionEvent& motion_event); |
38 | 39 |
39 scoped_refptr<cc::Layer> layer() const { return layer_; } | 40 scoped_refptr<cc::Layer> layer() const { return layer_; } |
40 | 41 |
(...skipping 19 matching lines...) Expand all Loading... |
60 std::unique_ptr<cc::proto::CompositorMessage> message) override; | 61 std::unique_ptr<cc::proto::CompositorMessage> message) override; |
61 | 62 |
62 // BlimpCompositorClient implementation. | 63 // BlimpCompositorClient implementation. |
63 void SendWebGestureEvent( | 64 void SendWebGestureEvent( |
64 int render_widget_id, | 65 int render_widget_id, |
65 const blink::WebGestureEvent& gesture_event) override; | 66 const blink::WebGestureEvent& gesture_event) override; |
66 void SendCompositorMessage( | 67 void SendCompositorMessage( |
67 int render_widget_id, | 68 int render_widget_id, |
68 const cc::proto::CompositorMessage& message) override; | 69 const cc::proto::CompositorMessage& message) override; |
69 | 70 |
| 71 int blimp_contents_id_; |
| 72 |
70 // The bridge to the network layer that does the proto/RenderWidget id work. | 73 // The bridge to the network layer that does the proto/RenderWidget id work. |
71 // BlimpCompositorManager does not own this and it is expected to outlive this | 74 // BlimpCompositorManager does not own this and it is expected to outlive this |
72 // BlimpCompositorManager instance. | 75 // BlimpCompositorManager instance. |
73 RenderWidgetFeature* render_widget_feature_; | 76 RenderWidgetFeature* render_widget_feature_; |
74 | 77 |
75 bool visible_; | 78 bool visible_; |
76 | 79 |
77 // The layer which holds the content from the active compositor. | 80 // The layer which holds the content from the active compositor. |
78 scoped_refptr<cc::Layer> layer_; | 81 scoped_refptr<cc::Layer> layer_; |
79 | 82 |
80 // A map of render_widget_ids to the BlimpCompositor instance. | 83 // A map of render_widget_ids to the BlimpCompositor instance. |
81 using CompositorMap = std::map<int, std::unique_ptr<BlimpCompositor>>; | 84 using CompositorMap = std::map<int, std::unique_ptr<BlimpCompositor>>; |
82 CompositorMap compositors_; | 85 CompositorMap compositors_; |
83 | 86 |
84 // The |active_compositor_| represents the compositor from the CompositorMap | 87 // The |active_compositor_| represents the compositor from the CompositorMap |
85 // that is currently visible and has the |window_|. It corresponds to the | 88 // that is currently visible and has the |window_|. It corresponds to the |
86 // render widget currently initialized on the engine. | 89 // render widget currently initialized on the engine. |
87 BlimpCompositor* active_compositor_; | 90 BlimpCompositor* active_compositor_; |
88 | 91 |
89 BlimpCompositorDependencies* compositor_dependencies_; | 92 BlimpCompositorDependencies* compositor_dependencies_; |
90 | 93 |
91 DISALLOW_COPY_AND_ASSIGN(BlimpCompositorManager); | 94 DISALLOW_COPY_AND_ASSIGN(BlimpCompositorManager); |
92 }; | 95 }; |
93 | 96 |
94 } // namespace client | 97 } // namespace client |
95 } // namespace blimp | 98 } // namespace blimp |
96 | 99 |
97 #endif // BLIMP_CLIENT_CORE_COMPOSITOR_BLIMP_COMPOSITOR_MANAGER_H_ | 100 #endif // BLIMP_CLIENT_CORE_COMPOSITOR_BLIMP_COMPOSITOR_MANAGER_H_ |
OLD | NEW |