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

Unified Diff: services/js/js_app_runner_delegate.cc

Issue 757703002: Creates a JavaScript Applicaiton (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Changes per review feedback Created 6 years, 1 month 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: services/js/js_app_runner_delegate.cc
diff --git a/services/js/js_app_runner_delegate.cc b/services/js/js_app_runner_delegate.cc
new file mode 100644
index 0000000000000000000000000000000000000000..4036e8cc66d07249e96f6f3706f27803947cc35e
--- /dev/null
+++ b/services/js/js_app_runner_delegate.cc
@@ -0,0 +1,48 @@
+// Copyright 2014 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 "services/js/js_app_runner_delegate.h"
+
+#include "base/path_service.h"
+#include "gin/modules/console.h"
+#include "mojo/edk/js/core.h"
+#include "mojo/edk/js/handle.h"
+#include "mojo/edk/js/support.h"
+#include "mojo/edk/js/threading.h"
+
+namespace mojo {
+namespace js {
+
+namespace {
+
+std::vector<base::FilePath> GetModuleSearchPaths() {
+ std::vector<base::FilePath> search_paths(2);
+ PathService::Get(base::DIR_SOURCE_ROOT, &search_paths[0]);
+ PathService::Get(base::DIR_EXE, &search_paths[1]);
+ search_paths[1] = search_paths[1].AppendASCII("gen");
+ return search_paths;
+}
+
+} // namespace
+
+JSAppRunnerDelegate::JSAppRunnerDelegate()
+ : ModuleRunnerDelegate(GetModuleSearchPaths()) {
+ AddBuiltinModule(gin::Console::kModuleName, gin::Console::GetModule);
+ AddBuiltinModule(js::Core::kModuleName, js::Core::GetModule);
+ AddBuiltinModule(js::Support::kModuleName, js::Support::GetModule);
+ AddBuiltinModule(js::Threading::kModuleName, js::Threading::GetModule);
+}
+
+JSAppRunnerDelegate::~JSAppRunnerDelegate() {
+}
+
+void JSAppRunnerDelegate::UnhandledException(gin::ShellRunner* runner,
+ gin::TryCatch& try_catch) {
+ gin::ModuleRunnerDelegate::UnhandledException(runner, try_catch);
+ LOG(ERROR) << try_catch.GetStackTrace();
+}
+
+} // namespace mojo
+} // namespace js
+

Powered by Google App Engine
This is Rietveld 408576698