OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "mojo/services/public/cpp/view_manager/lib/view_manager_synchronizer.h" | 5 #include "mojo/services/public/cpp/view_manager/lib/view_manager_synchronizer.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
10 #include "mojo/public/cpp/bindings/allocation_scope.h" | 10 #include "mojo/public/cpp/shell/service.h" |
11 #include "mojo/public/interfaces/shell/shell.mojom.h" | 11 #include "mojo/public/interfaces/shell/shell.mojom.h" |
12 #include "mojo/services/public/cpp/view_manager/lib/view_manager_observer.h" | 12 #include "mojo/services/public/cpp/view_manager/lib/view_manager_observer.h" |
13 #include "mojo/services/public/cpp/view_manager/lib/view_manager_private.h" | 13 #include "mojo/services/public/cpp/view_manager/lib/view_manager_private.h" |
14 #include "mojo/services/public/cpp/view_manager/lib/view_tree_node_private.h" | 14 #include "mojo/services/public/cpp/view_manager/lib/view_tree_node_private.h" |
15 #include "mojo/services/public/cpp/view_manager/util.h" | 15 #include "mojo/services/public/cpp/view_manager/util.h" |
16 | 16 |
17 namespace mojo { | 17 namespace mojo { |
18 namespace services { | 18 namespace services { |
19 namespace view_manager { | 19 namespace view_manager { |
20 | 20 |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 DISALLOW_COPY_AND_ASSIGN(HierarchyTransaction); | 182 DISALLOW_COPY_AND_ASSIGN(HierarchyTransaction); |
183 }; | 183 }; |
184 | 184 |
185 ViewManagerSynchronizer::ViewManagerSynchronizer(ViewManager* view_manager) | 185 ViewManagerSynchronizer::ViewManagerSynchronizer(ViewManager* view_manager) |
186 : view_manager_(view_manager), | 186 : view_manager_(view_manager), |
187 connected_(false), | 187 connected_(false), |
188 connection_id_(0), | 188 connection_id_(0), |
189 next_id_(1), | 189 next_id_(1), |
190 next_change_id_(0), | 190 next_change_id_(0), |
191 init_loop_(NULL) { | 191 init_loop_(NULL) { |
192 InterfacePipe<services::view_manager::IViewManager, AnyInterface> | 192 ConnectTo(ViewManagerPrivate(view_manager_).shell(), "mojo:mojo_view_manager", |
193 view_manager_pipe; | 193 &service_); |
194 AllocationScope scope; | 194 service_->SetClient(this); |
195 MessagePipeHandle client_handle = view_manager_pipe.handle_to_peer.get(); | 195 |
196 ViewManagerPrivate(view_manager_).shell()->Connect( | |
197 "mojo:mojo_view_manager", view_manager_pipe.handle_to_peer.Pass()); | |
198 service_.reset(view_manager_pipe.handle_to_self.Pass(), this); | |
199 base::RunLoop loop; | 196 base::RunLoop loop; |
200 init_loop_ = &loop; | 197 init_loop_ = &loop; |
201 init_loop_->Run(); | 198 init_loop_->Run(); |
202 init_loop_ = NULL; | 199 init_loop_ = NULL; |
203 } | 200 } |
204 | 201 |
205 ViewManagerSynchronizer::~ViewManagerSynchronizer() { | 202 ViewManagerSynchronizer::~ViewManagerSynchronizer() { |
206 } | 203 } |
207 | 204 |
208 TransportNodeId ViewManagerSynchronizer::CreateViewTreeNode() { | 205 TransportNodeId ViewManagerSynchronizer::CreateViewTreeNode() { |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
353 root = node; | 350 root = node; |
354 last_node = node; | 351 last_node = node; |
355 } | 352 } |
356 ViewManagerPrivate(view_manager_).set_tree(root); | 353 ViewManagerPrivate(view_manager_).set_tree(root); |
357 callback.Run(); | 354 callback.Run(); |
358 } | 355 } |
359 | 356 |
360 } // namespace view_manager | 357 } // namespace view_manager |
361 } // namespace services | 358 } // namespace services |
362 } // namespace mojo | 359 } // namespace mojo |
OLD | NEW |