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

Unified Diff: content/child/process_control_impl.cc

Issue 1295363003: Add ProcessControlImpl, the default ProcessControl implementation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comments addressed Created 5 years, 4 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 | « content/child/process_control_impl.h ('k') | content/content_child.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/child/process_control_impl.cc
diff --git a/content/child/process_control_impl.cc b/content/child/process_control_impl.cc
new file mode 100644
index 0000000000000000000000000000000000000000..4114df606f550acd40ed96f5851f8dee751ed75f
--- /dev/null
+++ b/content/child/process_control_impl.cc
@@ -0,0 +1,43 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "content/child/process_control_impl.h"
+
+#include "base/stl_util.h"
+#include "content/public/common/content_client.h"
+#include "mojo/shell/static_application_loader.h"
+#include "url/gurl.h"
+
+namespace content {
+
+ProcessControlImpl::ProcessControlImpl() {
+}
+
+ProcessControlImpl::~ProcessControlImpl() {
+ STLDeleteValues(&url_to_loader_map_);
+}
+
+void ProcessControlImpl::LoadApplication(
+ const mojo::String& url,
+ mojo::InterfaceRequest<mojo::Application> request,
+ const LoadApplicationCallback& callback) {
+ // Only register loaders when we need it.
+ if (!has_registered_loaders_) {
+ DCHECK(url_to_loader_map_.empty());
+ RegisterApplicationLoaders(&url_to_loader_map_);
+ has_registered_loaders_ = true;
+ }
+
+ GURL application_url = GURL(url.To<std::string>());
+ auto it = url_to_loader_map_.find(application_url);
+ if (it == url_to_loader_map_.end()) {
+ callback.Run(false);
+ return;
+ }
+
+ callback.Run(true);
+ it->second->Load(application_url, request.Pass());
+}
+
+} // namespace content
« no previous file with comments | « content/child/process_control_impl.h ('k') | content/content_child.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698