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

Unified Diff: shell/nacl/nacl_service_runner.cc

Issue 884303002: Launch nexes from mojo_shell. Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Edits 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
« no previous file with comments | « shell/nacl/nacl_service_runner.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: shell/nacl/nacl_service_runner.cc
diff --git a/shell/nacl/nacl_service_runner.cc b/shell/nacl/nacl_service_runner.cc
new file mode 100644
index 0000000000000000000000000000000000000000..0fdf6157eca4fcf593defa6679ec61a884182cb6
--- /dev/null
+++ b/shell/nacl/nacl_service_runner.cc
@@ -0,0 +1,51 @@
+// 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 "shell/nacl/nacl_service_runner.h"
+
+#include "mojo/nacl/monacl_sel_main.h"
+#include "shell/context.h"
+
+namespace mojo {
+namespace shell {
+
+NaClServiceRunner::NaClServiceRunner(Context* context) : context_(context) {
+}
+
+NaClServiceRunner::~NaClServiceRunner() {
+ if (thread_) {
+ DCHECK(thread_->HasBeenStarted());
+ DCHECK(!thread_->HasBeenJoined());
+ thread_->Join();
+ }
+}
+
+void NaClServiceRunner::Start(
+ const base::FilePath& app_path,
+ InterfaceRequest<Application> application_request) {
+ // TODO(ncbray) be more principled about finding the IRT.
+ irt_path_ = base::FilePath(
+ context_->ResolveShellFileURL("irt_x64/irt_mojo.nexe").GetContent());
+
+ app_path_ = app_path;
+
+ DCHECK(!application_request_.is_pending());
+ application_request_ = application_request.Pass();
+
+ DCHECK(!thread_);
+ thread_.reset(new base::DelegateSimpleThread(this, "app_thread"));
+ thread_->Start();
+}
+
+void NaClServiceRunner::Run() {
+ MojoHandle handle = application_request_.PassMessagePipe().release().value();
+
+ // This function will never return - it will take the process down instead.
+ LaunchNaCl(app_path_.AsUTF8Unsafe().c_str(), irt_path_.AsUTF8Unsafe().c_str(),
+ 0, nullptr, handle);
+ NOTREACHED();
+}
+
+} // namespace shell
+} // namespace mojo
« no previous file with comments | « shell/nacl/nacl_service_runner.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698