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

Unified Diff: shell/dynamic_application_loader.cc

Issue 884303002: Launch nexes from mojo_shell. Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Whitepace Created 5 years, 11 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/dynamic_application_loader.cc
diff --git a/shell/dynamic_application_loader.cc b/shell/dynamic_application_loader.cc
index 6b2a1c9d8a5261ad93b5b48512b1c0f62271e199..02a787048dea426364c9839f9e6db491697fd5cd 100644
--- a/shell/dynamic_application_loader.cc
+++ b/shell/dynamic_application_loader.cc
@@ -26,6 +26,9 @@
#include "shell/context.h"
#include "shell/data_pipe_peek.h"
#include "shell/filename_util.h"
+#if MOJO_USE_NACL
+#include "shell/nacl/nacl_service_runner.h"
+#endif
#include "shell/switches.h"
#include "url/url_util.h"
@@ -141,10 +144,23 @@ class DynamicApplicationLoader::Loader {
return;
}
- runner_ = runner_factory_->Create(context_);
- runner_->Start(
- path, cleanup_behavior_, application_request_.Pass(),
- base::Bind(&Loader::ReportComplete, weak_ptr_factory_.GetWeakPtr()));
+ // TODO(ncbray) sniff or infer the content type at a previous stage in the
+ // pipeline.
+ if (path.Extension() == FILE_PATH_LITERAL(".nexe")) {
+#if MOJO_USE_NACL
+ nacl_runner_ = scoped_ptr<NaClServiceRunner>(
jamesr 2015/01/28 23:11:30 nacl_runner_.reset(new ....);
Nick Bray (chromium) 2015/01/29 22:31:34 Done.
+ new NaClServiceRunner(context_));
+ nacl_runner_->Start(path, application_request_.Pass());
jamesr 2015/01/28 23:11:30 add a return; here and leave the last bit un-inden
Nick Bray (chromium) 2015/01/29 22:31:34 Done.
+#else
+ LOG(ERROR) << "Library not started because Native Client is not enabled.";
+ ReportComplete();
jamesr 2015/01/28 23:11:30 return;
Nick Bray (chromium) 2015/01/29 22:31:34 Done.
+#endif
+ } else {
+ runner_ = runner_factory_->Create(context_);
+ runner_->Start(
+ path, cleanup_behavior_, application_request_.Pass(),
+ base::Bind(&Loader::ReportComplete, weak_ptr_factory_.GetWeakPtr()));
+ }
}
DynamicServiceRunner::CleanupBehavior cleanup_behavior_;
@@ -155,6 +171,9 @@ class DynamicApplicationLoader::Loader {
MimeTypeToURLMap* mime_type_to_url_;
DynamicServiceRunnerFactory* runner_factory_;
scoped_ptr<DynamicServiceRunner> runner_;
+#if MOJO_USE_NACL
+ scoped_ptr<NaClServiceRunner> nacl_runner_;
+#endif
base::WeakPtrFactory<Loader> weak_ptr_factory_;
};

Powered by Google App Engine
This is Rietveld 408576698