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

Unified Diff: shell/application_manager/application_manager.cc

Issue 979203002: Index application by URL and identity for multiprocess. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Follow review Created 5 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « shell/application_manager/application_manager.h ('k') | shell/application_manager/identity.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: shell/application_manager/application_manager.cc
diff --git a/shell/application_manager/application_manager.cc b/shell/application_manager/application_manager.cc
index 90df84643b641f2a7683e13feefc413b7ef0aecf..68d5837d1a471cbce3834fedb08106293074f1eb 100644
--- a/shell/application_manager/application_manager.cc
+++ b/shell/application_manager/application_manager.cc
@@ -85,8 +85,8 @@ bool ApplicationManager::TestAPI::HasCreatedInstance() {
}
bool ApplicationManager::TestAPI::HasFactoryForURL(const GURL& url) const {
- return manager_->url_to_shell_impl_.find(url) !=
- manager_->url_to_shell_impl_.end();
+ return manager_->identity_to_shell_impl_.find(Identity(url)) !=
+ manager_->identity_to_shell_impl_.end();
}
ApplicationManager::ApplicationManager(Delegate* delegate)
@@ -101,7 +101,7 @@ ApplicationManager::~ApplicationManager() {
}
void ApplicationManager::TerminateShellConnections() {
- STLDeleteValues(&url_to_shell_impl_);
+ STLDeleteValues(&identity_to_shell_impl_);
}
void ApplicationManager::ConnectToApplication(
@@ -199,13 +199,13 @@ InterfaceRequest<Application> ApplicationManager::RegisterShell(
const GURL& requestor_url,
InterfaceRequest<ServiceProvider> services,
ServiceProviderPtr exposed_services) {
- GURL app_url = GetBaseURLAndQuery(resolved_url, nullptr);
+ Identity app_identity(resolved_url);
ApplicationPtr application;
InterfaceRequest<Application> application_request = GetProxy(&application);
ShellImpl* shell =
- new ShellImpl(application.Pass(), this, original_url, app_url);
- url_to_shell_impl_[app_url] = shell;
+ new ShellImpl(application.Pass(), this, original_url, app_identity);
+ identity_to_shell_impl_[app_identity] = shell;
shell->InitializeApplication(GetArgsForURL(original_url));
ConnectToClient(shell, resolved_url, requestor_url, services.Pass(),
exposed_services.Pass());
@@ -213,8 +213,8 @@ InterfaceRequest<Application> ApplicationManager::RegisterShell(
}
ShellImpl* ApplicationManager::GetShellImpl(const GURL& url) {
- const auto& shell_it = url_to_shell_impl_.find(url);
- if (shell_it != url_to_shell_impl_.end())
+ const auto& shell_it = identity_to_shell_impl_.find(Identity(url));
+ if (shell_it != identity_to_shell_impl_.end())
return shell_it->second;
return nullptr;
}
@@ -338,8 +338,10 @@ void ApplicationManager::RegisterExternalApplication(
LOG(WARNING) << "--args-for provided for external application " << url
<< " <ignored>";
}
- ShellImpl* shell_impl = new ShellImpl(application.Pass(), this, url, url);
- url_to_shell_impl_[url] = shell_impl;
+ Identity identity(url);
+ ShellImpl* shell_impl =
+ new ShellImpl(application.Pass(), this, url, identity);
+ identity_to_shell_impl_[identity] = shell_impl;
shell_impl->InitializeApplication(Array<String>::From(args));
}
@@ -417,13 +419,13 @@ ApplicationLoader* ApplicationManager::GetLoaderForURL(const GURL& url) {
void ApplicationManager::OnShellImplError(ShellImpl* shell_impl) {
// Called from ~ShellImpl, so we do not need to call Destroy here.
- const GURL url = shell_impl->url();
+ const Identity identity = shell_impl->identity();
const GURL requested_url = shell_impl->requested_url();
// Remove the shell.
- URLToShellImplMap::iterator it = url_to_shell_impl_.find(url);
- DCHECK(it != url_to_shell_impl_.end());
+ auto it = identity_to_shell_impl_.find(identity);
+ DCHECK(it != identity_to_shell_impl_.end());
delete it->second;
- url_to_shell_impl_.erase(it);
+ identity_to_shell_impl_.erase(it);
delegate_->OnApplicationError(requested_url);
}
« no previous file with comments | « shell/application_manager/application_manager.h ('k') | shell/application_manager/identity.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698