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

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: 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
« shell/nacl/nacl_service_runner.h ('K') | « 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..016bfefd9720df4cd4c903bf4892153004048955
--- /dev/null
+++ b/shell/nacl/nacl_service_runner.cc
@@ -0,0 +1,53 @@
+// 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)
jamesr 2015/01/28 23:11:30 looks oddly wrapped - did you 'git cl format' ?
Nick Bray (chromium) 2015/01/29 22:31:35 Done. The code in the NaCl repo is too far gone t
+ : 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_core.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, NULL, handle);
jamesr 2015/01/28 23:11:30 nullptr ?
Nick Bray (chromium) 2015/01/29 22:31:35 Done.
+ NOTREACHED();
+}
+
+} // namespace shell
+} // namespace mojo
« shell/nacl/nacl_service_runner.h ('K') | « shell/nacl/nacl_service_runner.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698