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

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

Issue 627563002: Mojo JS standalone app launches files specified with mojo_shell command-line args (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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/application_delegate_impl.cc ('k') | mojo/apps/js/standalone_main.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 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"
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 } 65 }
66 66
67 void JSApp::Run() { 67 void JSApp::Run() {
68 CHECK(!js_app_task_runner_.get() && !on_app_delegate_impl_thread()); 68 CHECK(!js_app_task_runner_.get() && !on_app_delegate_impl_thread());
69 js_app_task_runner_ = base::MessageLoop::current()->task_runner(); 69 js_app_task_runner_ = base::MessageLoop::current()->task_runner();
70 70
71 std::string source; 71 std::string source;
72 std::string file_name; 72 std::string file_name;
73 Load(&source, &file_name); // TODO(hansmuller): handle Load() failure. 73 Load(&source, &file_name); // TODO(hansmuller): handle Load() failure.
74 74
75 gin::IsolateHolder::Initialize(gin::IsolateHolder::kStrictMode,
76 gin::ArrayBufferAllocator::SharedInstance());
77 isolate_holder_.reset(new gin::IsolateHolder()); 75 isolate_holder_.reset(new gin::IsolateHolder());
78 isolate_holder_->AddRunMicrotasksObserver(); 76 isolate_holder_->AddRunMicrotasksObserver();
79 77
80 shell_runner_.reset( 78 shell_runner_.reset(
81 new gin::ShellRunner(&runner_delegate_, isolate_holder_->isolate())); 79 new gin::ShellRunner(&runner_delegate_, isolate_holder_->isolate()));
82 80
83 gin::Runner::Scope scope(shell_runner_.get()); 81 gin::Runner::Scope scope(shell_runner_.get());
84 shell_runner_->Run(source.c_str(), file_name.c_str()); 82 shell_runner_->Run(source.c_str(), file_name.c_str());
85 } 83 }
86 84
(...skipping 18 matching lines...) Expand all
105 } 103 }
106 104
107 bool JSApp::on_js_app_thread() const { 105 bool JSApp::on_js_app_thread() const {
108 return js_app_task_runner_.get() && 106 return js_app_task_runner_.get() &&
109 js_app_task_runner_.get() == 107 js_app_task_runner_.get() ==
110 base::MessageLoop::current()->task_runner().get(); 108 base::MessageLoop::current()->task_runner().get();
111 } 109 }
112 110
113 } // namespace apps 111 } // namespace apps
114 } // namespace mojo 112 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/apps/js/application_delegate_impl.cc ('k') | mojo/apps/js/standalone_main.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698