Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(65)

Side by Side Diff: mojo/services/public/cpp/view_manager/lib/view_manager_client_impl.cc

Issue 380413003: Mojo: Use InterfaceFactory<Interface> for service registration (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix message loop destruction order Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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_client_impl.h" 5 #include "mojo/services/public/cpp/view_manager/lib/view_manager_client_impl.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/application_connection.h" 9 #include "mojo/public/cpp/application/application_connection.h"
10 #include "mojo/public/cpp/application/connect.h" 10 #include "mojo/public/cpp/application/connect.h"
(...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after
516 virtual void DoActionCompleted(bool success) OVERRIDE { 516 virtual void DoActionCompleted(bool success) OVERRIDE {
517 // TODO(beng): recovery? 517 // TODO(beng): recovery?
518 } 518 }
519 519
520 const Id node_id_; 520 const Id node_id_;
521 const bool visible_; 521 const bool visible_;
522 522
523 DISALLOW_COPY_AND_ASSIGN(SetVisibleTransaction); 523 DISALLOW_COPY_AND_ASSIGN(SetVisibleTransaction);
524 }; 524 };
525 525
526 ViewManagerClientImpl::ViewManagerClientImpl(ApplicationConnection* connection, 526 ViewManagerClientImpl::ViewManagerClientImpl(ViewManagerDelegate* delegate)
527 ViewManagerDelegate* delegate)
528 : connected_(false), 527 : connected_(false),
529 connection_id_(0), 528 connection_id_(0),
530 next_id_(1), 529 next_id_(1),
531 delegate_(delegate), 530 delegate_(delegate),
532 dispatcher_(NULL) {} 531 dispatcher_(NULL) {
532 }
533 533
534 ViewManagerClientImpl::~ViewManagerClientImpl() { 534 ViewManagerClientImpl::~ViewManagerClientImpl() {
535 while (!nodes_.empty()) { 535 while (!nodes_.empty()) {
536 IdToNodeMap::iterator it = nodes_.begin(); 536 IdToNodeMap::iterator it = nodes_.begin();
537 if (OwnsNode(it->second->id())) 537 if (OwnsNode(it->second->id()))
538 it->second->Destroy(); 538 it->second->Destroy();
539 else 539 else
540 nodes_.erase(it); 540 nodes_.erase(it);
541 } 541 }
542 while (!views_.empty()) { 542 while (!views_.empty()) {
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
866 delegate_->OnRootAdded(this, root); 866 delegate_->OnRootAdded(this, root);
867 } 867 }
868 868
869 void ViewManagerClientImpl::RemoveRoot(Node* root) { 869 void ViewManagerClientImpl::RemoveRoot(Node* root) {
870 std::vector<Node*>::iterator it = 870 std::vector<Node*>::iterator it =
871 std::find(roots_.begin(), roots_.end(), root); 871 std::find(roots_.begin(), roots_.end(), root);
872 if (it != roots_.end()) 872 if (it != roots_.end())
873 roots_.erase(it); 873 roots_.erase(it);
874 } 874 }
875 875
876 ////////////////////////////////////////////////////////////////////////////////
877 // ViewManager, public:
878
879 // static
880 void ViewManager::ConfigureIncomingConnection(
881 ApplicationConnection* connection,
882 ViewManagerDelegate* delegate) {
883 connection->AddService<ViewManagerClientImpl>(delegate);
884 }
885
886 } // namespace view_manager 876 } // namespace view_manager
887 } // namespace mojo 877 } // namespace mojo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698