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 630 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
641 } | 641 } |
642 | 642 |
643 void ViewManagerSynchronizer::OnViewInputEvent( | 643 void ViewManagerSynchronizer::OnViewInputEvent( |
644 uint32_t view_id, | 644 uint32_t view_id, |
645 EventPtr event, | 645 EventPtr event, |
646 const Callback<void()>& ack_callback) { | 646 const Callback<void()>& ack_callback) { |
647 View* view = view_manager_->GetViewById(view_id); | 647 View* view = view_manager_->GetViewById(view_id); |
648 if (view) { | 648 if (view) { |
649 FOR_EACH_OBSERVER(ViewObserver, | 649 FOR_EACH_OBSERVER(ViewObserver, |
650 *ViewPrivate(view).observers(), | 650 *ViewPrivate(view).observers(), |
651 OnViewInputEvent(view, event.Pass())); | 651 OnViewInputEvent(view, event)); |
652 } | 652 } |
653 ack_callback.Run(); | 653 ack_callback.Run(); |
654 } | 654 } |
655 | 655 |
656 //////////////////////////////////////////////////////////////////////////////// | 656 //////////////////////////////////////////////////////////////////////////////// |
657 // ViewManagerSynchronizer, private: | 657 // ViewManagerSynchronizer, private: |
658 | 658 |
659 void ViewManagerSynchronizer::Sync() { | 659 void ViewManagerSynchronizer::Sync() { |
660 // The service connection may not be set up yet. OnConnectionEstablished() | 660 // The service connection may not be set up yet. OnConnectionEstablished() |
661 // will schedule another sync when it is. | 661 // will schedule another sync when it is. |
(...skipping 10 matching lines...) Expand all Loading... |
672 void ViewManagerSynchronizer::RemoveFromPendingQueue( | 672 void ViewManagerSynchronizer::RemoveFromPendingQueue( |
673 ViewManagerTransaction* transaction) { | 673 ViewManagerTransaction* transaction) { |
674 DCHECK_EQ(transaction, pending_transactions_.front()); | 674 DCHECK_EQ(transaction, pending_transactions_.front()); |
675 pending_transactions_.erase(pending_transactions_.begin()); | 675 pending_transactions_.erase(pending_transactions_.begin()); |
676 if (pending_transactions_.empty() && !changes_acked_callback_.is_null()) | 676 if (pending_transactions_.empty() && !changes_acked_callback_.is_null()) |
677 changes_acked_callback_.Run(); | 677 changes_acked_callback_.Run(); |
678 } | 678 } |
679 | 679 |
680 } // namespace view_manager | 680 } // namespace view_manager |
681 } // namespace mojo | 681 } // namespace mojo |
OLD | NEW |