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

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

Issue 637373002: Mojo JS bindings: simplify mojo.connectToService() usage - Part 2 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Renamed the mojo_internals module, made Connection localFactory optional Created 6 years, 2 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 | « mojo/apps/js/js_app.h ('k') | mojo/apps/js/main.js » ('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 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_bridge_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
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
OLDNEW
« no previous file with comments | « mojo/apps/js/js_app.h ('k') | mojo/apps/js/main.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698