OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "services/js/js_app_runner_delegate.h" |
| 6 |
| 7 #include "base/path_service.h" |
| 8 #include "gin/modules/console.h" |
| 9 #include "mojo/edk/js/core.h" |
| 10 #include "mojo/edk/js/handle.h" |
| 11 #include "mojo/edk/js/support.h" |
| 12 #include "mojo/edk/js/threading.h" |
| 13 |
| 14 namespace mojo { |
| 15 namespace js { |
| 16 |
| 17 namespace { |
| 18 |
| 19 std::vector<base::FilePath> GetModuleSearchPaths() { |
| 20 std::vector<base::FilePath> search_paths(2); |
| 21 PathService::Get(base::DIR_SOURCE_ROOT, &search_paths[0]); |
| 22 PathService::Get(base::DIR_EXE, &search_paths[1]); |
| 23 search_paths[1] = search_paths[1].AppendASCII("gen"); |
| 24 return search_paths; |
| 25 } |
| 26 |
| 27 } // namespace |
| 28 |
| 29 JSAppRunnerDelegate::JSAppRunnerDelegate() |
| 30 : ModuleRunnerDelegate(GetModuleSearchPaths()) { |
| 31 AddBuiltinModule(gin::Console::kModuleName, gin::Console::GetModule); |
| 32 AddBuiltinModule(js::Core::kModuleName, js::Core::GetModule); |
| 33 AddBuiltinModule(js::Support::kModuleName, js::Support::GetModule); |
| 34 AddBuiltinModule(js::Threading::kModuleName, js::Threading::GetModule); |
| 35 } |
| 36 |
| 37 JSAppRunnerDelegate::~JSAppRunnerDelegate() { |
| 38 } |
| 39 |
| 40 void JSAppRunnerDelegate::UnhandledException(gin::ShellRunner* runner, |
| 41 gin::TryCatch& try_catch) { |
| 42 gin::ModuleRunnerDelegate::UnhandledException(runner, try_catch); |
| 43 LOG(ERROR) << try_catch.GetStackTrace(); |
| 44 } |
| 45 |
| 46 } // namespace mojo |
| 47 } // namespace js |
| 48 |
OLD | NEW |