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

Side by Side Diff: mojo/services/public/cpp/view_manager/lib/view_manager_synchronizer.cc

Issue 265793015: Mojo: Replace RemotePtr with InterfacePtr and InterfaceImpl (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 7 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 | Annotate | Revision Log
OLDNEW
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_private.h" 12 #include "mojo/services/public/cpp/view_manager/lib/view_manager_private.h"
13 #include "mojo/services/public/cpp/view_manager/lib/view_tree_node_private.h" 13 #include "mojo/services/public/cpp/view_manager/lib/view_tree_node_private.h"
14 #include "mojo/services/public/cpp/view_manager/util.h" 14 #include "mojo/services/public/cpp/view_manager/util.h"
15 15
16 namespace mojo { 16 namespace mojo {
17 namespace services { 17 namespace services {
18 namespace view_manager { 18 namespace view_manager {
19 19
20 TransportNodeId MakeTransportNodeId(uint16_t connection_id, 20 TransportNodeId MakeTransportNodeId(uint16_t connection_id,
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 }; 180 };
181 181
182 ViewManagerSynchronizer::ViewManagerSynchronizer(ViewManager* view_manager) 182 ViewManagerSynchronizer::ViewManagerSynchronizer(ViewManager* view_manager)
183 : view_manager_(view_manager), 183 : view_manager_(view_manager),
184 connected_(false), 184 connected_(false),
185 connection_id_(0), 185 connection_id_(0),
186 next_id_(1), 186 next_id_(1),
187 next_change_id_(0), 187 next_change_id_(0),
188 sync_factory_(this), 188 sync_factory_(this),
189 init_loop_(NULL) { 189 init_loop_(NULL) {
190 InterfacePipe<services::view_manager::IViewManager, AnyInterface> 190 ConnectTo(ViewManagerPrivate(view_manager_).shell(), "mojo:mojo_view_manager",
191 view_manager_pipe; 191 &service_);
192 service_->SetClient(this);
193
192 AllocationScope scope; 194 AllocationScope scope;
193 MessagePipeHandle client_handle = view_manager_pipe.handle_to_peer.get();
194 ViewManagerPrivate(view_manager_).shell()->Connect(
195 "mojo:mojo_view_manager", view_manager_pipe.handle_to_peer.Pass());
196 service_.reset(view_manager_pipe.handle_to_self.Pass(), this);
197 service_->GetNodeTree( 195 service_->GetNodeTree(
198 1, 196 1,
199 base::Bind(&ViewManagerSynchronizer::OnRootTreeReceived, 197 base::Bind(&ViewManagerSynchronizer::OnRootTreeReceived,
200 base::Unretained(this))); 198 base::Unretained(this)));
199
201 base::RunLoop loop; 200 base::RunLoop loop;
202 init_loop_ = &loop; 201 init_loop_ = &loop;
203 init_loop_->Run(); 202 init_loop_->Run();
204 init_loop_ = NULL; 203 init_loop_ = NULL;
205 } 204 }
206 205
207 ViewManagerSynchronizer::~ViewManagerSynchronizer() { 206 ViewManagerSynchronizer::~ViewManagerSynchronizer() {
208 DoSync(); 207 DoSync();
209 } 208 }
210 209
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 ViewManagerPrivate(view_manager_).AddNode(node->id(), node); 366 ViewManagerPrivate(view_manager_).AddNode(node->id(), node);
368 } 367 }
369 ViewManagerPrivate(view_manager_).set_root(root); 368 ViewManagerPrivate(view_manager_).set_root(root);
370 if (init_loop_) 369 if (init_loop_)
371 init_loop_->Quit(); 370 init_loop_->Quit();
372 } 371 }
373 372
374 } // namespace view_manager 373 } // namespace view_manager
375 } // namespace services 374 } // namespace services
376 } // namespace mojo 375 } // namespace mojo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698