summaryrefslogtreecommitdiffstats
path: root/mojo/apps/js/main.cc
diff options
context:
space:
mode:
Diffstat (limited to 'mojo/apps/js/main.cc')
-rw-r--r--mojo/apps/js/main.cc19
1 files changed, 7 insertions, 12 deletions
diff --git a/mojo/apps/js/main.cc b/mojo/apps/js/main.cc
index 5a6842a..12ec34e 100644
--- a/mojo/apps/js/main.cc
+++ b/mojo/apps/js/main.cc
@@ -4,7 +4,6 @@
#include "base/message_loop/message_loop.h"
#include "gin/public/isolate_holder.h"
-#include "mojo/apps/js/bootstrap.h"
#include "mojo/apps/js/mojo_runner_delegate.h"
#include "mojo/common/bindings_support_impl.h"
#include "mojo/public/system/core_cpp.h"
@@ -23,18 +22,13 @@
namespace mojo {
namespace apps {
-void RunMojoJS(MojoHandle pipe) {
- gin::IsolateHolder instance;
- Bootstrap::SetInitialHandle(pipe);
+void Start(MojoHandle pipe, const std::string& module) {
+ base::MessageLoop loop;
+ gin::IsolateHolder instance;
MojoRunnerDelegate delegate;
gin::Runner runner(&delegate, instance.isolate());
-
- {
- gin::Runner::Scope scope(&runner);
- runner.Run("define(['mojo/apps/js/main'], function(main) {});",
- "mojo.js");
- }
+ delegate.Start(&runner, pipe, module);
base::MessageLoop::current()->Run();
}
@@ -43,10 +37,11 @@ void RunMojoJS(MojoHandle pipe) {
} // namespace mojo
extern "C" MOJO_APPS_JS_EXPORT MojoResult CDECL MojoMain(MojoHandle pipe) {
- base::MessageLoop loop;
mojo::common::BindingsSupportImpl bindings_support;
mojo::BindingsSupport::Set(&bindings_support);
- mojo::apps::RunMojoJS(pipe);
+
+ mojo::apps::Start(pipe, "mojo/apps/js/main");
+
mojo::BindingsSupport::Set(NULL);
return MOJO_RESULT_OK;
}