OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "mojo/apps/js/js_app.h" | 5 #include "mojo/apps/js/js_app.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "gin/array_buffer.h" | 8 #include "gin/array_buffer.h" |
9 #include "gin/converter.h" | 9 #include "gin/converter.h" |
10 #include "mojo/apps/js/application_delegate_impl.h" | 10 #include "mojo/apps/js/application_delegate_impl.h" |
11 #include "mojo/apps/js/mojo_module.h" | 11 #include "mojo/apps/js/mojo_internals_module.h" |
12 | 12 |
13 namespace mojo { | 13 namespace mojo { |
14 namespace apps { | 14 namespace apps { |
15 | 15 |
16 JSApp::JSApp(ApplicationDelegateImpl* app_delegate_impl) | 16 JSApp::JSApp(ApplicationDelegateImpl* app_delegate_impl) |
17 : app_delegate_impl_(app_delegate_impl), | 17 : app_delegate_impl_(app_delegate_impl), |
18 thread_("Mojo JS"), | 18 thread_("Mojo JS"), |
19 app_delegate_impl_task_runner_( | 19 app_delegate_impl_task_runner_( |
20 base::MessageLoop::current()->task_runner()) { | 20 base::MessageLoop::current()->task_runner()) { |
21 CHECK(on_app_delegate_impl_thread()); | 21 CHECK(on_app_delegate_impl_thread()); |
22 runner_delegate_.AddBuiltinModule(Mojo::kModuleName, | 22 runner_delegate_.AddBuiltinModule(MojoInternals::kModuleName, |
23 base::Bind(Mojo::GetModule, this)); | 23 base::Bind(MojoInternals::GetModule, this)); |
24 } | 24 } |
25 | 25 |
26 JSApp::~JSApp() { | 26 JSApp::~JSApp() { |
27 } | 27 } |
28 | 28 |
29 bool JSApp::Start() { | 29 bool JSApp::Start() { |
30 CHECK(!js_app_task_runner_.get() && on_app_delegate_impl_thread()); | 30 CHECK(!js_app_task_runner_.get() && on_app_delegate_impl_thread()); |
31 base::Thread::Options thread_options(base::MessageLoop::TYPE_IO, 0); | 31 base::Thread::Options thread_options(base::MessageLoop::TYPE_IO, 0); |
32 thread_.StartWithOptions(thread_options); | 32 thread_.StartWithOptions(thread_options); |
33 | 33 |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 } | 103 } |
104 | 104 |
105 bool JSApp::on_js_app_thread() const { | 105 bool JSApp::on_js_app_thread() const { |
106 return js_app_task_runner_.get() && | 106 return js_app_task_runner_.get() && |
107 js_app_task_runner_.get() == | 107 js_app_task_runner_.get() == |
108 base::MessageLoop::current()->task_runner().get(); | 108 base::MessageLoop::current()->task_runner().get(); |
109 } | 109 } |
110 | 110 |
111 } // namespace apps | 111 } // namespace apps |
112 } // namespace mojo | 112 } // namespace mojo |
OLD | NEW |