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 #include "content/renderer/mus/compositor_mus_connection.h" | 5 #include "content/renderer/mus/compositor_mus_connection.h" |
6 | 6 |
7 #include "base/single_thread_task_runner.h" | 7 #include "base/single_thread_task_runner.h" |
8 #include "content/renderer/input/input_handler_manager.h" | 8 #include "content/renderer/input/input_handler_manager.h" |
9 #include "content/renderer/mus/render_widget_mus_connection.h" | 9 #include "content/renderer/mus/render_widget_mus_connection.h" |
10 #include "ui/events/blink/blink_event_util.h" | 10 #include "ui/events/blink/blink_event_util.h" |
(...skipping 28 matching lines...) Expand all Loading... |
39 compositor_task_runner_(compositor_task_runner), | 39 compositor_task_runner_(compositor_task_runner), |
40 input_handler_manager_(input_handler_manager) { | 40 input_handler_manager_(input_handler_manager) { |
41 DCHECK(main_task_runner_->BelongsToCurrentThread()); | 41 DCHECK(main_task_runner_->BelongsToCurrentThread()); |
42 compositor_task_runner_->PostTask( | 42 compositor_task_runner_->PostTask( |
43 FROM_HERE, base::Bind(&CompositorMusConnection:: | 43 FROM_HERE, base::Bind(&CompositorMusConnection:: |
44 CreateWindowTreeClientOnCompositorThread, | 44 CreateWindowTreeClientOnCompositorThread, |
45 this, base::Passed(std::move(request)))); | 45 this, base::Passed(std::move(request)))); |
46 } | 46 } |
47 | 47 |
48 void CompositorMusConnection::AttachCompositorFrameSinkOnMainThread( | 48 void CompositorMusConnection::AttachCompositorFrameSinkOnMainThread( |
49 std::unique_ptr<ui::WindowSurfaceBinding> surface_binding) { | 49 std::unique_ptr<ui::WindowCompositorFrameSinkBinding> |
| 50 compositor_frame_sink_binding) { |
50 DCHECK(main_task_runner_->BelongsToCurrentThread()); | 51 DCHECK(main_task_runner_->BelongsToCurrentThread()); |
51 compositor_task_runner_->PostTask( | 52 compositor_task_runner_->PostTask( |
52 FROM_HERE, | 53 FROM_HERE, |
53 base::Bind( | 54 base::Bind( |
54 &CompositorMusConnection::AttachCompositorFrameSinkOnCompositorThread, | 55 &CompositorMusConnection::AttachCompositorFrameSinkOnCompositorThread, |
55 this, base::Passed(std::move(surface_binding)))); | 56 this, base::Passed(std::move(compositor_frame_sink_binding)))); |
56 } | 57 } |
57 | 58 |
58 CompositorMusConnection::~CompositorMusConnection() { | 59 CompositorMusConnection::~CompositorMusConnection() { |
59 base::AutoLock auto_lock(window_tree_client_lock_); | 60 base::AutoLock auto_lock(window_tree_client_lock_); |
60 // Destruction must happen on the compositor task runner. | 61 // Destruction must happen on the compositor task runner. |
61 DCHECK(!window_tree_client_); | 62 DCHECK(!window_tree_client_); |
62 } | 63 } |
63 | 64 |
64 void CompositorMusConnection::AttachCompositorFrameSinkOnCompositorThread( | 65 void CompositorMusConnection::AttachCompositorFrameSinkOnCompositorThread( |
65 std::unique_ptr<ui::WindowSurfaceBinding> surface_binding) { | 66 std::unique_ptr<ui::WindowCompositorFrameSinkBinding> |
| 67 compositor_frame_sink_binding) { |
66 DCHECK(compositor_task_runner_->BelongsToCurrentThread()); | 68 DCHECK(compositor_task_runner_->BelongsToCurrentThread()); |
67 window_surface_binding_ = std::move(surface_binding); | 69 window_compositor_frame_sink_binding_ = |
| 70 std::move(compositor_frame_sink_binding); |
68 if (root_) { | 71 if (root_) { |
69 root_->AttachCompositorFrameSink(ui::mojom::SurfaceType::DEFAULT, | 72 root_->AttachCompositorFrameSink( |
70 std::move(window_surface_binding_)); | 73 ui::mojom::CompositorFrameSinkType::DEFAULT, |
| 74 std::move(window_compositor_frame_sink_binding_)); |
71 } | 75 } |
72 } | 76 } |
73 | 77 |
74 void CompositorMusConnection::CreateWindowTreeClientOnCompositorThread( | 78 void CompositorMusConnection::CreateWindowTreeClientOnCompositorThread( |
75 mojo::InterfaceRequest<ui::mojom::WindowTreeClient> request) { | 79 mojo::InterfaceRequest<ui::mojom::WindowTreeClient> request) { |
76 DCHECK(compositor_task_runner_->BelongsToCurrentThread()); | 80 DCHECK(compositor_task_runner_->BelongsToCurrentThread()); |
77 DCHECK(!window_tree_client_); | 81 DCHECK(!window_tree_client_); |
78 std::unique_ptr<ui::WindowTreeClient> window_tree_client = | 82 std::unique_ptr<ui::WindowTreeClient> window_tree_client = |
79 base::MakeUnique<ui::WindowTreeClient>(this, nullptr, std::move(request)); | 83 base::MakeUnique<ui::WindowTreeClient>(this, nullptr, std::move(request)); |
80 base::AutoLock auto_lock(window_tree_client_lock_); | 84 base::AutoLock auto_lock(window_tree_client_lock_); |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 } | 149 } |
146 main_task_runner_->PostTask( | 150 main_task_runner_->PostTask( |
147 FROM_HERE, | 151 FROM_HERE, |
148 base::Bind(&CompositorMusConnection::OnConnectionLostOnMainThread, this)); | 152 base::Bind(&CompositorMusConnection::OnConnectionLostOnMainThread, this)); |
149 } | 153 } |
150 | 154 |
151 void CompositorMusConnection::OnEmbed(ui::Window* root) { | 155 void CompositorMusConnection::OnEmbed(ui::Window* root) { |
152 DCHECK(compositor_task_runner_->BelongsToCurrentThread()); | 156 DCHECK(compositor_task_runner_->BelongsToCurrentThread()); |
153 root_ = root; | 157 root_ = root; |
154 root_->set_input_event_handler(this); | 158 root_->set_input_event_handler(this); |
155 if (window_surface_binding_) { | 159 if (window_compositor_frame_sink_binding_) { |
156 root->AttachCompositorFrameSink(ui::mojom::SurfaceType::DEFAULT, | 160 root->AttachCompositorFrameSink( |
157 std::move(window_surface_binding_)); | 161 ui::mojom::CompositorFrameSinkType::DEFAULT, |
| 162 std::move(window_compositor_frame_sink_binding_)); |
158 } | 163 } |
159 } | 164 } |
160 | 165 |
161 void CompositorMusConnection::OnEmbedRootDestroyed(ui::Window* window) { | 166 void CompositorMusConnection::OnEmbedRootDestroyed(ui::Window* window) { |
162 DeleteWindowTreeClient(); | 167 DeleteWindowTreeClient(); |
163 } | 168 } |
164 | 169 |
165 void CompositorMusConnection::OnLostConnection(ui::WindowTreeClient* client) { | 170 void CompositorMusConnection::OnLostConnection(ui::WindowTreeClient* client) { |
166 DeleteWindowTreeClient(); | 171 DeleteWindowTreeClient(); |
167 } | 172 } |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 } | 229 } |
225 ack_callback.reset(); | 230 ack_callback.reset(); |
226 | 231 |
227 main_task_runner_->PostTask( | 232 main_task_runner_->PostTask( |
228 FROM_HERE, | 233 FROM_HERE, |
229 base::Bind(&CompositorMusConnection::OnWindowInputEventOnMainThread, this, | 234 base::Bind(&CompositorMusConnection::OnWindowInputEventOnMainThread, this, |
230 base::Passed(std::move(web_event)), ack)); | 235 base::Passed(std::move(web_event)), ack)); |
231 } | 236 } |
232 | 237 |
233 } // namespace content | 238 } // namespace content |
OLD | NEW |