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