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

Side by Side Diff: services/shell/shell.cc

Issue 2112543002: Convert UtilityProcessHost to bootstrap Mojo Channel using the Shell connection (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@p9x
Patch Set: . Created 4 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
« no previous file with comments | « extensions/browser/sandboxed_unpacker_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "services/shell/shell.h" 5 #include "services/shell/shell.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <utility> 9 #include <utility>
10 10
(...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after
572 572
573 mojom::ShellResolverPtr resolver_ptr; 573 mojom::ShellResolverPtr resolver_ptr;
574 ConnectToInterface(this, identity, CreateCatalogIdentity(), &resolver_ptr); 574 ConnectToInterface(this, identity, CreateCatalogIdentity(), &resolver_ptr);
575 mojom::ShellResolver* resolver = resolver_ptr.get(); 575 mojom::ShellResolver* resolver = resolver_ptr.get();
576 identity_to_resolver_[identity] = std::move(resolver_ptr); 576 identity_to_resolver_[identity] = std::move(resolver_ptr);
577 return resolver; 577 return resolver;
578 } 578 }
579 579
580 void Shell::TerminateShellConnections() { 580 void Shell::TerminateShellConnections() {
581 Instance* instance = GetExistingInstance(CreateShellIdentity()); 581 Instance* instance = GetExistingInstance(CreateShellIdentity());
582 DCHECK(instance); 582 // The Shell instance may have been destructed as a result of the client
583 OnInstanceError(instance); 583 // closing its connector.
584 if (instance)
585 OnInstanceError(instance);
584 } 586 }
585 587
586 void Shell::OnInstanceError(Instance* instance) { 588 void Shell::OnInstanceError(Instance* instance) {
587 const Identity identity = instance->identity(); 589 const Identity identity = instance->identity();
588 // Remove the shell. 590 // Remove the shell.
589 auto it = identity_to_instance_.find(identity); 591 auto it = identity_to_instance_.find(identity);
590 DCHECK(it != identity_to_instance_.end()); 592 DCHECK(it != identity_to_instance_.end());
591 int id = instance->id(); 593 int id = instance->id();
592 identity_to_instance_.erase(it); 594 identity_to_instance_.erase(it);
593 instance_listeners_.ForAllPtrs([this, id](mojom::InstanceListener* listener) { 595 instance_listeners_.ForAllPtrs([this, id](mojom::InstanceListener* listener) {
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
789 // Now that the instance has a ShellClient, we can connect to it. 791 // Now that the instance has a ShellClient, we can connect to it.
790 bool connected = instance->ConnectToClient(&params); 792 bool connected = instance->ConnectToClient(&params);
791 DCHECK(connected); 793 DCHECK(connected);
792 } 794 }
793 795
794 base::WeakPtr<Shell> Shell::GetWeakPtr() { 796 base::WeakPtr<Shell> Shell::GetWeakPtr() {
795 return weak_ptr_factory_.GetWeakPtr(); 797 return weak_ptr_factory_.GetWeakPtr();
796 } 798 }
797 799
798 } // namespace shell 800 } // namespace shell
OLDNEW
« no previous file with comments | « extensions/browser/sandboxed_unpacker_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698