OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "base/message_loop/message_loop.h" | 5 #include "base/message_loop/message_loop.h" |
6 #include "gin/public/isolate_holder.h" | 6 #include "gin/public/isolate_holder.h" |
7 #include "mojo/apps/js/mojo_runner_delegate.h" | 7 #include "mojo/apps/js/mojo_runner_delegate.h" |
8 #include "mojo/public/gles2/gles2_cpp.h" | 8 #include "mojo/public/gles2/gles2_cpp.h" |
9 #include "mojo/public/system/core_cpp.h" | 9 #include "mojo/public/system/core_cpp.h" |
10 #include "mojo/public/system/macros.h" | 10 #include "mojo/public/system/macros.h" |
11 | 11 |
12 #if defined(WIN32) | 12 #if defined(WIN32) |
13 #if !defined(CDECL) | 13 #if !defined(CDECL) |
14 #define CDECL __cdecl | 14 #define CDECL __cdecl |
15 #endif | 15 #endif |
16 #define MOJO_APPS_JS_EXPORT __declspec(dllexport) | 16 #define MOJO_APPS_JS_EXPORT __declspec(dllexport) |
17 #else | 17 #else |
18 #define CDECL | 18 #define CDECL |
19 #define MOJO_APPS_JS_EXPORT __attribute__((visibility("default"))) | 19 #define MOJO_APPS_JS_EXPORT __attribute__((visibility("default"))) |
20 #endif | 20 #endif |
21 | 21 |
22 namespace mojo { | 22 namespace mojo { |
23 namespace apps { | 23 namespace apps { |
24 | 24 |
25 void Start(MojoHandle pipe, const std::string& module) { | 25 void Start(MojoHandle pipe, const std::string& module) { |
26 base::MessageLoop loop; | 26 base::MessageLoop loop; |
27 | 27 |
28 gin::IsolateHolder instance; | 28 gin::IsolateHolder instance; |
29 MojoRunnerDelegate delegate; | 29 MojoRunnerDelegate delegate; |
30 gin::Runner runner(&delegate, instance.isolate()); | 30 gin::ShellRunner runner(&delegate, instance.isolate()); |
31 delegate.Start(&runner, pipe, module); | 31 delegate.Start(&runner, pipe, module); |
32 | 32 |
33 base::MessageLoop::current()->Run(); | 33 base::MessageLoop::current()->Run(); |
34 } | 34 } |
35 | 35 |
36 } // namespace apps | 36 } // namespace apps |
37 } // namespace mojo | 37 } // namespace mojo |
38 | 38 |
39 extern "C" MOJO_APPS_JS_EXPORT MojoResult CDECL MojoMain(MojoHandle pipe) { | 39 extern "C" MOJO_APPS_JS_EXPORT MojoResult CDECL MojoMain(MojoHandle pipe) { |
40 mojo::GLES2Initializer gles2; | 40 mojo::GLES2Initializer gles2; |
41 mojo::apps::Start(pipe, "mojo/apps/js/main"); | 41 mojo::apps::Start(pipe, "mojo/apps/js/main"); |
42 return MOJO_RESULT_OK; | 42 return MOJO_RESULT_OK; |
43 } | 43 } |
OLD | NEW |