| 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/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
| 8 #include "base/single_thread_task_runner.h" | 8 #include "base/single_thread_task_runner.h" |
| 9 #include "content/renderer/input/input_handler_manager.h" | 9 #include "content/renderer/input/input_handler_manager.h" |
| 10 #include "content/renderer/mus/render_widget_mus_connection.h" | 10 #include "content/renderer/mus/render_widget_mus_connection.h" |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 } | 64 } |
| 65 | 65 |
| 66 void CompositorMusConnection::AttachCompositorFrameSinkOnCompositorThread( | 66 void CompositorMusConnection::AttachCompositorFrameSinkOnCompositorThread( |
| 67 std::unique_ptr<ui::WindowCompositorFrameSinkBinding> | 67 std::unique_ptr<ui::WindowCompositorFrameSinkBinding> |
| 68 compositor_frame_sink_binding) { | 68 compositor_frame_sink_binding) { |
| 69 DCHECK(compositor_task_runner_->BelongsToCurrentThread()); | 69 DCHECK(compositor_task_runner_->BelongsToCurrentThread()); |
| 70 window_compositor_frame_sink_binding_ = | 70 window_compositor_frame_sink_binding_ = |
| 71 std::move(compositor_frame_sink_binding); | 71 std::move(compositor_frame_sink_binding); |
| 72 if (root_) { | 72 if (root_) { |
| 73 root_->AttachCompositorFrameSink( | 73 root_->AttachCompositorFrameSink( |
| 74 ui::mojom::CompositorFrameSinkType::DEFAULT, | |
| 75 std::move(window_compositor_frame_sink_binding_)); | 74 std::move(window_compositor_frame_sink_binding_)); |
| 76 } | 75 } |
| 77 } | 76 } |
| 78 | 77 |
| 79 void CompositorMusConnection::CreateWindowTreeClientOnCompositorThread( | 78 void CompositorMusConnection::CreateWindowTreeClientOnCompositorThread( |
| 80 mojo::InterfaceRequest<ui::mojom::WindowTreeClient> request) { | 79 mojo::InterfaceRequest<ui::mojom::WindowTreeClient> request) { |
| 81 DCHECK(compositor_task_runner_->BelongsToCurrentThread()); | 80 DCHECK(compositor_task_runner_->BelongsToCurrentThread()); |
| 82 DCHECK(!window_tree_client_); | 81 DCHECK(!window_tree_client_); |
| 83 std::unique_ptr<ui::WindowTreeClient> window_tree_client = | 82 std::unique_ptr<ui::WindowTreeClient> window_tree_client = |
| 84 base::MakeUnique<ui::WindowTreeClient>(this, nullptr, std::move(request)); | 83 base::MakeUnique<ui::WindowTreeClient>(this, nullptr, std::move(request)); |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 FROM_HERE, | 151 FROM_HERE, |
| 153 base::Bind(&CompositorMusConnection::OnConnectionLostOnMainThread, this)); | 152 base::Bind(&CompositorMusConnection::OnConnectionLostOnMainThread, this)); |
| 154 } | 153 } |
| 155 | 154 |
| 156 void CompositorMusConnection::OnEmbed(ui::Window* root) { | 155 void CompositorMusConnection::OnEmbed(ui::Window* root) { |
| 157 DCHECK(compositor_task_runner_->BelongsToCurrentThread()); | 156 DCHECK(compositor_task_runner_->BelongsToCurrentThread()); |
| 158 root_ = root; | 157 root_ = root; |
| 159 root_->set_input_event_handler(this); | 158 root_->set_input_event_handler(this); |
| 160 if (window_compositor_frame_sink_binding_) { | 159 if (window_compositor_frame_sink_binding_) { |
| 161 root->AttachCompositorFrameSink( | 160 root->AttachCompositorFrameSink( |
| 162 ui::mojom::CompositorFrameSinkType::DEFAULT, | |
| 163 std::move(window_compositor_frame_sink_binding_)); | 161 std::move(window_compositor_frame_sink_binding_)); |
| 164 } | 162 } |
| 165 } | 163 } |
| 166 | 164 |
| 167 void CompositorMusConnection::OnEmbedRootDestroyed(ui::Window* window) { | 165 void CompositorMusConnection::OnEmbedRootDestroyed(ui::Window* window) { |
| 168 DeleteWindowTreeClient(); | 166 DeleteWindowTreeClient(); |
| 169 } | 167 } |
| 170 | 168 |
| 171 void CompositorMusConnection::OnLostConnection(ui::WindowTreeClient* client) { | 169 void CompositorMusConnection::OnLostConnection(ui::WindowTreeClient* client) { |
| 172 DeleteWindowTreeClient(); | 170 DeleteWindowTreeClient(); |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 230 } | 228 } |
| 231 ack_callback.reset(); | 229 ack_callback.reset(); |
| 232 | 230 |
| 233 main_task_runner_->PostTask( | 231 main_task_runner_->PostTask( |
| 234 FROM_HERE, | 232 FROM_HERE, |
| 235 base::Bind(&CompositorMusConnection::OnWindowInputEventOnMainThread, this, | 233 base::Bind(&CompositorMusConnection::OnWindowInputEventOnMainThread, this, |
| 236 base::Passed(std::move(web_event)), ack)); | 234 base::Passed(std::move(web_event)), ack)); |
| 237 } | 235 } |
| 238 | 236 |
| 239 } // namespace content | 237 } // namespace content |
| OLD | NEW |