| 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 586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 597 ViewTreeNodePrivate(new_parent).LocalAddChild(node); | 597 ViewTreeNodePrivate(new_parent).LocalAddChild(node); |
| 598 else | 598 else |
| 599 ViewTreeNodePrivate(old_parent).LocalRemoveChild(node); | 599 ViewTreeNodePrivate(old_parent).LocalRemoveChild(node); |
| 600 } | 600 } |
| 601 | 601 |
| 602 void ViewManagerSynchronizer::OnNodeDeleted(uint32_t node_id, | 602 void ViewManagerSynchronizer::OnNodeDeleted(uint32_t node_id, |
| 603 uint32_t server_change_id) { | 603 uint32_t server_change_id) { |
| 604 next_server_change_id_ = server_change_id + 1; | 604 next_server_change_id_ = server_change_id + 1; |
| 605 | 605 |
| 606 ViewTreeNode* node = view_manager()->GetNodeById(node_id); | 606 ViewTreeNode* node = view_manager()->GetNodeById(node_id); |
| 607 if (node) | 607 if (node) { |
| 608 if (view_manager()->tree() == node) |
| 609 ViewManagerPrivate(view_manager()).set_root(NULL); |
| 608 ViewTreeNodePrivate(node).LocalDestroy(); | 610 ViewTreeNodePrivate(node).LocalDestroy(); |
| 611 } |
| 609 } | 612 } |
| 610 | 613 |
| 611 void ViewManagerSynchronizer::OnNodeViewReplaced(uint32_t node_id, | 614 void ViewManagerSynchronizer::OnNodeViewReplaced(uint32_t node_id, |
| 612 uint32_t new_view_id, | 615 uint32_t new_view_id, |
| 613 uint32_t old_view_id) { | 616 uint32_t old_view_id) { |
| 614 ViewTreeNode* node = view_manager()->GetNodeById(node_id); | 617 ViewTreeNode* node = view_manager()->GetNodeById(node_id); |
| 615 View* new_view = view_manager()->GetViewById(new_view_id); | 618 View* new_view = view_manager()->GetViewById(new_view_id); |
| 616 if (!new_view && new_view_id != 0) { | 619 if (!new_view && new_view_id != 0) { |
| 617 // This client wasn't aware of this View until now. | 620 // This client wasn't aware of this View until now. |
| 618 new_view = ViewPrivate::LocalCreate(); | 621 new_view = ViewPrivate::LocalCreate(); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 652 void ViewManagerSynchronizer::RemoveFromPendingQueue( | 655 void ViewManagerSynchronizer::RemoveFromPendingQueue( |
| 653 ViewManagerTransaction* transaction) { | 656 ViewManagerTransaction* transaction) { |
| 654 DCHECK_EQ(transaction, pending_transactions_.front()); | 657 DCHECK_EQ(transaction, pending_transactions_.front()); |
| 655 pending_transactions_.erase(pending_transactions_.begin()); | 658 pending_transactions_.erase(pending_transactions_.begin()); |
| 656 if (pending_transactions_.empty() && !changes_acked_callback_.is_null()) | 659 if (pending_transactions_.empty() && !changes_acked_callback_.is_null()) |
| 657 changes_acked_callback_.Run(); | 660 changes_acked_callback_.Run(); |
| 658 } | 661 } |
| 659 | 662 |
| 660 } // namespace view_manager | 663 } // namespace view_manager |
| 661 } // namespace mojo | 664 } // namespace mojo |
| OLD | NEW |