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

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
Index: shell/application_manager/application_manager.cc
diff --git a/shell/application_manager/application_manager.cc b/shell/application_manager/application_manager.cc
index 11f875945dee83c6c999cfa50efee9d24e62ed28..9cd9dccf55a1c375c9f4af4f088e9d84ca28c1c7 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_url_and_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;
+ ShellImpl* shell = new ShellImpl(application.Pass(), this, original_url,
+ app_url_and_identity);
+ identity_to_shell_impl_[app_url_and_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;
}
@@ -337,8 +337,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 url_and_identity(url);
+ ShellImpl* shell_impl =
+ new ShellImpl(application.Pass(), this, url, url_and_identity);
+ identity_to_shell_impl_[url_and_identity] = shell_impl;
shell_impl->InitializeApplication(Array<String>::From(args));
}
@@ -414,13 +416,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 url_and_identity = shell_impl->url_and_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(url_and_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);
}

Powered by Google App Engine
This is Rietveld 408576698