| 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 "mojo/public/cpp/bindings/allocation_scope.h" | 9 #include "mojo/public/cpp/bindings/allocation_scope.h" |
| 10 #include "mojo/public/interfaces/shell/shell.mojom.h" | 10 #include "mojo/public/interfaces/shell/shell.mojom.h" |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 | 150 |
| 151 DISALLOW_COPY_AND_ASSIGN(HierarchyTransaction); | 151 DISALLOW_COPY_AND_ASSIGN(HierarchyTransaction); |
| 152 }; | 152 }; |
| 153 | 153 |
| 154 ViewManagerSynchronizer::ViewManagerSynchronizer(ViewManager* view_manager) | 154 ViewManagerSynchronizer::ViewManagerSynchronizer(ViewManager* view_manager) |
| 155 : view_manager_(view_manager), | 155 : view_manager_(view_manager), |
| 156 connected_(false), | 156 connected_(false), |
| 157 connection_id_(0), | 157 connection_id_(0), |
| 158 next_id_(0), | 158 next_id_(0), |
| 159 next_change_id_(0) { | 159 next_change_id_(0) { |
| 160 InterfacePipe<services::view_manager::IViewManager, AnyInterface> | 160 MessagePipe pipe; |
| 161 view_manager_pipe; | |
| 162 AllocationScope scope; | 161 AllocationScope scope; |
| 163 ViewManagerPrivate(view_manager_).shell()->Connect( | 162 ViewManagerPrivate(view_manager_).shell()->Connect( |
| 164 "mojo:mojo_view_manager", view_manager_pipe.handle_to_peer.Pass()); | 163 "mojo:mojo_view_manager", pipe.handle0.Pass()); |
| 165 service_.reset(view_manager_pipe.handle_to_self.Pass(), this); | 164 service_ = mojo::MakeProxy<IViewManager>(pipe.handle1.Pass()); |
| 165 // XXX how do we hook |this| up as the client without introducing a cycle? |
| 166 // Could use a WeakPtr but that seems complicated :-/ |
| 166 } | 167 } |
| 167 | 168 |
| 168 ViewManagerSynchronizer::~ViewManagerSynchronizer() { | 169 ViewManagerSynchronizer::~ViewManagerSynchronizer() { |
| 169 } | 170 } |
| 170 | 171 |
| 171 uint16_t ViewManagerSynchronizer::CreateViewTreeNode() { | 172 uint16_t ViewManagerSynchronizer::CreateViewTreeNode() { |
| 172 uint16_t id = next_id_++; | 173 uint16_t id = next_id_++; |
| 173 pending_transactions_.push_back(new CreateViewTreeNodeTransaction(id, this)); | 174 pending_transactions_.push_back(new CreateViewTreeNodeTransaction(id, this)); |
| 174 ScheduleSync(); | 175 ScheduleSync(); |
| 175 return id; | 176 return id; |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 | 253 |
| 253 void ViewManagerSynchronizer::RemoveFromPendingQueue( | 254 void ViewManagerSynchronizer::RemoveFromPendingQueue( |
| 254 ViewManagerTransaction* transaction) { | 255 ViewManagerTransaction* transaction) { |
| 255 DCHECK_EQ(transaction, pending_transactions_.front()); | 256 DCHECK_EQ(transaction, pending_transactions_.front()); |
| 256 pending_transactions_.erase(pending_transactions_.begin()); | 257 pending_transactions_.erase(pending_transactions_.begin()); |
| 257 } | 258 } |
| 258 | 259 |
| 259 } // namespace view_manager | 260 } // namespace view_manager |
| 260 } // namespace services | 261 } // namespace services |
| 261 } // namespace mojo | 262 } // namespace mojo |
| OLD | NEW |