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

Side by Side Diff: mojo/apps/js/main.cc

Issue 553903003: Refactor IsolateHolder to be able to always create the isolate (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: updates Created 6 years, 3 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 unified diff | Download patch
« no previous file with comments | « gin/test/v8_test.cc ('k') | mojo/apps/js/test/js_to_cpp_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/array_buffer.h"
6 #include "gin/public/isolate_holder.h" 7 #include "gin/public/isolate_holder.h"
7 #include "mojo/apps/js/mojo_runner_delegate.h" 8 #include "mojo/apps/js/mojo_runner_delegate.h"
8 #include "mojo/public/cpp/system/core.h" 9 #include "mojo/public/cpp/system/core.h"
9 #include "mojo/public/cpp/system/macros.h" 10 #include "mojo/public/cpp/system/macros.h"
10 11
11 #if defined(WIN32) 12 #if defined(WIN32)
12 #if !defined(CDECL) 13 #if !defined(CDECL)
13 #define CDECL __cdecl 14 #define CDECL __cdecl
14 #endif 15 #endif
15 #define MOJO_APPS_JS_EXPORT __declspec(dllexport) 16 #define MOJO_APPS_JS_EXPORT __declspec(dllexport)
16 #else 17 #else
17 #define CDECL 18 #define CDECL
18 #define MOJO_APPS_JS_EXPORT __attribute__((visibility("default"))) 19 #define MOJO_APPS_JS_EXPORT __attribute__((visibility("default")))
19 #endif 20 #endif
20 21
21 namespace mojo { 22 namespace mojo {
22 namespace apps { 23 namespace apps {
23 24
24 void Start(MojoHandle pipe, const std::string& module) { 25 void Start(MojoHandle pipe, const std::string& module) {
25 base::MessageLoop loop; 26 base::MessageLoop loop;
26 27
27 gin::IsolateHolder instance(gin::IsolateHolder::kStrictMode); 28 gin::IsolateHolder::Initialize(gin::IsolateHolder::kStrictMode,
29 gin::ArrayBufferAllocator::SharedInstance());
30 gin::IsolateHolder instance;
28 MojoRunnerDelegate delegate; 31 MojoRunnerDelegate delegate;
29 gin::ShellRunner runner(&delegate, instance.isolate()); 32 gin::ShellRunner runner(&delegate, instance.isolate());
30 delegate.Start(&runner, pipe, module); 33 delegate.Start(&runner, pipe, module);
31 34
32 base::MessageLoop::current()->Run(); 35 base::MessageLoop::current()->Run();
33 } 36 }
34 37
35 } // namespace apps 38 } // namespace apps
36 } // namespace mojo 39 } // namespace mojo
37 40
38 extern "C" MOJO_APPS_JS_EXPORT MojoResult CDECL MojoMain(MojoHandle pipe) { 41 extern "C" MOJO_APPS_JS_EXPORT MojoResult CDECL MojoMain(MojoHandle pipe) {
39 mojo::apps::Start(pipe, "mojo/apps/js/main"); 42 mojo::apps::Start(pipe, "mojo/apps/js/main");
40 return MOJO_RESULT_OK; 43 return MOJO_RESULT_OK;
41 } 44 }
OLDNEW
« no previous file with comments | « gin/test/v8_test.cc ('k') | mojo/apps/js/test/js_to_cpp_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698