Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(313)

Side by Side Diff: content/renderer/mus/compositor_mus_connection.cc

Issue 2018823002: Eliminate WindowTreeConnection (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@connection
Patch Set: . Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « content/renderer/mus/compositor_mus_connection.h ('k') | mash/browser/browser.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/common/input/web_input_event_traits.h" 8 #include "content/common/input/web_input_event_traits.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 18 matching lines...) Expand all
29 mojo::InterfaceRequest<mus::mojom::WindowTreeClient> request, 29 mojo::InterfaceRequest<mus::mojom::WindowTreeClient> request,
30 InputHandlerManager* input_handler_manager) 30 InputHandlerManager* input_handler_manager)
31 : routing_id_(routing_id), 31 : routing_id_(routing_id),
32 root_(nullptr), 32 root_(nullptr),
33 main_task_runner_(main_task_runner), 33 main_task_runner_(main_task_runner),
34 compositor_task_runner_(compositor_task_runner), 34 compositor_task_runner_(compositor_task_runner),
35 input_handler_manager_(input_handler_manager) { 35 input_handler_manager_(input_handler_manager) {
36 DCHECK(main_task_runner_->BelongsToCurrentThread()); 36 DCHECK(main_task_runner_->BelongsToCurrentThread());
37 compositor_task_runner_->PostTask( 37 compositor_task_runner_->PostTask(
38 FROM_HERE, base::Bind(&CompositorMusConnection:: 38 FROM_HERE, base::Bind(&CompositorMusConnection::
39 CreateWindowTreeConnectionOnCompositorThread, 39 CreateWindowTreeClientOnCompositorThread,
40 this, base::Passed(std::move(request)))); 40 this, base::Passed(std::move(request))));
41 } 41 }
42 42
43 void CompositorMusConnection::AttachSurfaceOnMainThread( 43 void CompositorMusConnection::AttachSurfaceOnMainThread(
44 std::unique_ptr<mus::WindowSurfaceBinding> surface_binding) { 44 std::unique_ptr<mus::WindowSurfaceBinding> surface_binding) {
45 DCHECK(main_task_runner_->BelongsToCurrentThread()); 45 DCHECK(main_task_runner_->BelongsToCurrentThread());
46 compositor_task_runner_->PostTask( 46 compositor_task_runner_->PostTask(
47 FROM_HERE, 47 FROM_HERE,
48 base::Bind(&CompositorMusConnection::AttachSurfaceOnCompositorThread, 48 base::Bind(&CompositorMusConnection::AttachSurfaceOnCompositorThread,
49 this, base::Passed(std::move(surface_binding)))); 49 this, base::Passed(std::move(surface_binding))));
50 } 50 }
51 51
52 CompositorMusConnection::~CompositorMusConnection() {} 52 CompositorMusConnection::~CompositorMusConnection() {}
53 53
54 void CompositorMusConnection::AttachSurfaceOnCompositorThread( 54 void CompositorMusConnection::AttachSurfaceOnCompositorThread(
55 std::unique_ptr<mus::WindowSurfaceBinding> surface_binding) { 55 std::unique_ptr<mus::WindowSurfaceBinding> surface_binding) {
56 DCHECK(compositor_task_runner_->BelongsToCurrentThread()); 56 DCHECK(compositor_task_runner_->BelongsToCurrentThread());
57 window_surface_binding_ = std::move(surface_binding); 57 window_surface_binding_ = std::move(surface_binding);
58 if (root_) { 58 if (root_) {
59 root_->AttachSurface(mus::mojom::SurfaceType::DEFAULT, 59 root_->AttachSurface(mus::mojom::SurfaceType::DEFAULT,
60 std::move(window_surface_binding_)); 60 std::move(window_surface_binding_));
61 } 61 }
62 } 62 }
63 63
64 void CompositorMusConnection::CreateWindowTreeConnectionOnCompositorThread( 64 void CompositorMusConnection::CreateWindowTreeClientOnCompositorThread(
65 mojo::InterfaceRequest<mus::mojom::WindowTreeClient> request) { 65 mojo::InterfaceRequest<mus::mojom::WindowTreeClient> request) {
66 DCHECK(compositor_task_runner_->BelongsToCurrentThread()); 66 DCHECK(compositor_task_runner_->BelongsToCurrentThread());
67 mus::WindowTreeConnection::Create( 67 new mus::WindowTreeClient(this, nullptr, std::move(request));
68 this, std::move(request),
69 mus::WindowTreeConnection::CreateType::DONT_WAIT_FOR_EMBED);
70 } 68 }
71 69
72 void CompositorMusConnection::OnConnectionLostOnMainThread() { 70 void CompositorMusConnection::OnConnectionLostOnMainThread() {
73 DCHECK(main_task_runner_->BelongsToCurrentThread()); 71 DCHECK(main_task_runner_->BelongsToCurrentThread());
74 RenderWidgetMusConnection* connection = 72 RenderWidgetMusConnection* connection =
75 RenderWidgetMusConnection::Get(routing_id_); 73 RenderWidgetMusConnection::Get(routing_id_);
76 if (!connection) 74 if (!connection)
77 return; 75 return;
78 connection->OnConnectionLost(); 76 connection->OnConnectionLost();
79 } 77 }
(...skipping 11 matching lines...) Expand all
91 connection->OnWindowInputEvent(std::move(web_event), ack); 89 connection->OnWindowInputEvent(std::move(web_event), ack);
92 } 90 }
93 91
94 void CompositorMusConnection::OnWindowInputEventAckOnMainThread( 92 void CompositorMusConnection::OnWindowInputEventAckOnMainThread(
95 const base::Callback<void(EventResult)>& ack, 93 const base::Callback<void(EventResult)>& ack,
96 EventResult result) { 94 EventResult result) {
97 DCHECK(main_task_runner_->BelongsToCurrentThread()); 95 DCHECK(main_task_runner_->BelongsToCurrentThread());
98 compositor_task_runner_->PostTask(FROM_HERE, base::Bind(ack, result)); 96 compositor_task_runner_->PostTask(FROM_HERE, base::Bind(ack, result));
99 } 97 }
100 98
101 void CompositorMusConnection::OnConnectionLost( 99 void CompositorMusConnection::OnWindowTreeClientDestroyed(
102 mus::WindowTreeConnection* connection) { 100 mus::WindowTreeClient* client) {
103 DCHECK(compositor_task_runner_->BelongsToCurrentThread()); 101 DCHECK(compositor_task_runner_->BelongsToCurrentThread());
104 main_task_runner_->PostTask( 102 main_task_runner_->PostTask(
105 FROM_HERE, 103 FROM_HERE,
106 base::Bind(&CompositorMusConnection::OnConnectionLostOnMainThread, this)); 104 base::Bind(&CompositorMusConnection::OnConnectionLostOnMainThread, this));
107 } 105 }
108 106
109 void CompositorMusConnection::OnEmbed(mus::Window* root) { 107 void CompositorMusConnection::OnEmbed(mus::Window* root) {
110 DCHECK(compositor_task_runner_->BelongsToCurrentThread()); 108 DCHECK(compositor_task_runner_->BelongsToCurrentThread());
111 root_ = root; 109 root_ = root;
112 root_->set_input_event_handler(this); 110 root_->set_input_event_handler(this);
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 this, *ack_callback->get()); 148 this, *ack_callback->get());
151 ack_callback->reset(); 149 ack_callback->reset();
152 } 150 }
153 main_task_runner_->PostTask( 151 main_task_runner_->PostTask(
154 FROM_HERE, 152 FROM_HERE,
155 base::Bind(&CompositorMusConnection::OnWindowInputEventOnMainThread, this, 153 base::Bind(&CompositorMusConnection::OnWindowInputEventOnMainThread, this,
156 base::Passed(std::move(web_event)), ack)); 154 base::Passed(std::move(web_event)), ack));
157 } 155 }
158 156
159 } // namespace content 157 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/mus/compositor_mus_connection.h ('k') | mash/browser/browser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698