| 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/run_loop.h" | 8 #include "base/run_loop.h" |
| 9 #include "mojo/public/cpp/shell/connect.h" | 9 #include "mojo/public/cpp/application/connect.h" |
| 10 #include "mojo/public/interfaces/shell/shell.mojom.h" | 10 #include "mojo/public/interfaces/service_provider/service_provider.mojom.h" |
| 11 #include "mojo/services/public/cpp/view_manager/lib/view_manager_private.h" | 11 #include "mojo/services/public/cpp/view_manager/lib/view_manager_private.h" |
| 12 #include "mojo/services/public/cpp/view_manager/lib/view_private.h" | 12 #include "mojo/services/public/cpp/view_manager/lib/view_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 #include "third_party/skia/include/core/SkBitmap.h" | 15 #include "third_party/skia/include/core/SkBitmap.h" |
| 16 #include "ui/gfx/codec/png_codec.h" | 16 #include "ui/gfx/codec/png_codec.h" |
| 17 | 17 |
| 18 namespace mojo { | 18 namespace mojo { |
| 19 namespace view_manager { | 19 namespace view_manager { |
| 20 | 20 |
| (...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 404 }; | 404 }; |
| 405 | 405 |
| 406 ViewManagerSynchronizer::ViewManagerSynchronizer(ViewManager* view_manager) | 406 ViewManagerSynchronizer::ViewManagerSynchronizer(ViewManager* view_manager) |
| 407 : view_manager_(view_manager), | 407 : view_manager_(view_manager), |
| 408 connected_(false), | 408 connected_(false), |
| 409 connection_id_(0), | 409 connection_id_(0), |
| 410 next_id_(1), | 410 next_id_(1), |
| 411 next_server_change_id_(0), | 411 next_server_change_id_(0), |
| 412 sync_factory_(this), | 412 sync_factory_(this), |
| 413 init_loop_(NULL) { | 413 init_loop_(NULL) { |
| 414 ConnectTo(ViewManagerPrivate(view_manager_).shell(), "mojo:mojo_view_manager", | 414 ConnectToService( |
| 415 &service_); | 415 ViewManagerPrivate(view_manager_).service_provider(), |
| 416 "mojo:mojo_view_manager", |
| 417 &service_); |
| 416 service_.set_client(this); | 418 service_.set_client(this); |
| 417 | 419 |
| 418 // Start a runloop. This loop is quit when the server tells us about the | 420 // Start a runloop. This loop is quit when the server tells us about the |
| 419 // connection (OnConnectionEstablished()). | 421 // connection (OnConnectionEstablished()). |
| 420 base::RunLoop loop; | 422 base::RunLoop loop; |
| 421 init_loop_ = &loop; | 423 init_loop_ = &loop; |
| 422 init_loop_->Run(); | 424 init_loop_->Run(); |
| 423 init_loop_ = NULL; | 425 init_loop_ = NULL; |
| 424 } | 426 } |
| 425 | 427 |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 617 void ViewManagerSynchronizer::RemoveFromPendingQueue( | 619 void ViewManagerSynchronizer::RemoveFromPendingQueue( |
| 618 ViewManagerTransaction* transaction) { | 620 ViewManagerTransaction* transaction) { |
| 619 DCHECK_EQ(transaction, pending_transactions_.front()); | 621 DCHECK_EQ(transaction, pending_transactions_.front()); |
| 620 pending_transactions_.erase(pending_transactions_.begin()); | 622 pending_transactions_.erase(pending_transactions_.begin()); |
| 621 if (pending_transactions_.empty() && !changes_acked_callback_.is_null()) | 623 if (pending_transactions_.empty() && !changes_acked_callback_.is_null()) |
| 622 changes_acked_callback_.Run(); | 624 changes_acked_callback_.Run(); |
| 623 } | 625 } |
| 624 | 626 |
| 625 } // namespace view_manager | 627 } // namespace view_manager |
| 626 } // namespace mojo | 628 } // namespace mojo |
| OLD | NEW |