| 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/application/connect.h" | 9 #include "mojo/public/cpp/application/connect.h" |
| 10 #include "mojo/public/interfaces/service_provider/service_provider.mojom.h" | 10 #include "mojo/public/interfaces/service_provider/service_provider.mojom.h" |
| (...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 439 : view_manager_(view_manager), | 439 : view_manager_(view_manager), |
| 440 connected_(false), | 440 connected_(false), |
| 441 connection_id_(0), | 441 connection_id_(0), |
| 442 next_id_(1), | 442 next_id_(1), |
| 443 next_server_change_id_(0), | 443 next_server_change_id_(0), |
| 444 sync_factory_(this) { | 444 sync_factory_(this) { |
| 445 ViewManagerPrivate(view_manager).set_synchronizer(this); | 445 ViewManagerPrivate(view_manager).set_synchronizer(this); |
| 446 } | 446 } |
| 447 | 447 |
| 448 ViewManagerSynchronizer::~ViewManagerSynchronizer() { | 448 ViewManagerSynchronizer::~ViewManagerSynchronizer() { |
| 449 Sync(); | 449 view_manager_.reset(); |
| 450 } | 450 } |
| 451 | 451 |
| 452 TransportNodeId ViewManagerSynchronizer::CreateViewTreeNode() { | 452 TransportNodeId ViewManagerSynchronizer::CreateViewTreeNode() { |
| 453 DCHECK(connected_); | 453 DCHECK(connected_); |
| 454 const TransportNodeId node_id( | 454 const TransportNodeId node_id( |
| 455 MakeTransportId(connection_id_, ++next_id_)); | 455 MakeTransportId(connection_id_, ++next_id_)); |
| 456 pending_transactions_.push_back( | 456 pending_transactions_.push_back( |
| 457 new CreateViewTreeNodeTransaction(node_id, this)); | 457 new CreateViewTreeNodeTransaction(node_id, this)); |
| 458 Sync(); | 458 Sync(); |
| 459 return node_id; | 459 return node_id; |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 652 void ViewManagerSynchronizer::RemoveFromPendingQueue( | 652 void ViewManagerSynchronizer::RemoveFromPendingQueue( |
| 653 ViewManagerTransaction* transaction) { | 653 ViewManagerTransaction* transaction) { |
| 654 DCHECK_EQ(transaction, pending_transactions_.front()); | 654 DCHECK_EQ(transaction, pending_transactions_.front()); |
| 655 pending_transactions_.erase(pending_transactions_.begin()); | 655 pending_transactions_.erase(pending_transactions_.begin()); |
| 656 if (pending_transactions_.empty() && !changes_acked_callback_.is_null()) | 656 if (pending_transactions_.empty() && !changes_acked_callback_.is_null()) |
| 657 changes_acked_callback_.Run(); | 657 changes_acked_callback_.Run(); |
| 658 } | 658 } |
| 659 | 659 |
| 660 } // namespace view_manager | 660 } // namespace view_manager |
| 661 } // namespace mojo | 661 } // namespace mojo |
| OLD | NEW |