Index: content/child/process_control_impl.cc |
diff --git a/content/child/process_control_impl.cc b/content/child/process_control_impl.cc |
index 36ec78f5093e0034a02a584a982393b414abdf95..b465db6e94bc53d01cae229a8060b42b93825135 100644 |
--- a/content/child/process_control_impl.cc |
+++ b/content/child/process_control_impl.cc |
@@ -6,8 +6,8 @@ |
#include <utility> |
-#include "base/stl_util.h" |
-#include "content/common/mojo/static_loader.h" |
+#include "base/bind.h" |
+#include "base/memory/ptr_util.h" |
#include "content/public/common/content_client.h" |
namespace content { |
@@ -16,29 +16,36 @@ ProcessControlImpl::ProcessControlImpl() { |
} |
ProcessControlImpl::~ProcessControlImpl() { |
- STLDeleteValues(&name_to_loader_map_); |
} |
void ProcessControlImpl::LoadApplication( |
const mojo::String& name, |
- mojo::InterfaceRequest<shell::mojom::ShellClient> request, |
+ shell::mojom::ShellClientRequest request, |
const LoadApplicationCallback& callback) { |
- // Only register loaders when we need it. |
- if (!has_registered_loaders_) { |
- DCHECK(name_to_loader_map_.empty()); |
- RegisterLoaders(&name_to_loader_map_); |
- has_registered_loaders_ = true; |
+ // Only register apps on first run. |
+ if (!has_registered_apps_) { |
+ DCHECK(apps_.empty()); |
+ ApplicationFactoryMap app_factories; |
+ RegisterApplicationFactories(&app_factories); |
+ for (const auto& factory : app_factories) { |
+ std::unique_ptr<EmbeddedApplicationRunner> runner( |
+ new EmbeddedApplicationRunner(factory.second, nullptr)); |
+ runner->SetQuitClosure(base::Bind(&ProcessControlImpl::OnApplicationQuit, |
+ base::Unretained(this))); |
+ apps_.insert(std::make_pair(factory.first, std::move(runner))); |
+ } |
+ has_registered_apps_ = true; |
} |
- auto it = name_to_loader_map_.find(name); |
- if (it == name_to_loader_map_.end()) { |
+ auto it = apps_.find(name); |
+ if (it == apps_.end()) { |
callback.Run(false); |
OnLoadFailed(); |
return; |
} |
callback.Run(true); |
- it->second->Load(name, std::move(request)); |
+ it->second->BindShellClientRequest(std::move(request)); |
} |
} // namespace content |