| 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 "gin/shell_runner.h" | 5 #include "gin/shell_runner.h" |
| 6 | 6 |
| 7 #include "gin/converter.h" | 7 #include "gin/converter.h" |
| 8 #include "gin/modules/module_registry.h" | 8 #include "gin/modules/module_registry.h" |
| 9 #include "gin/per_context_data.h" | 9 #include "gin/per_context_data.h" |
| 10 #include "gin/public/context_holder.h" | 10 #include "gin/public/context_holder.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 } | 35 } |
| 36 | 36 |
| 37 void ShellRunnerDelegate::WillRunScript(ShellRunner* runner) { | 37 void ShellRunnerDelegate::WillRunScript(ShellRunner* runner) { |
| 38 } | 38 } |
| 39 | 39 |
| 40 void ShellRunnerDelegate::DidRunScript(ShellRunner* runner) { | 40 void ShellRunnerDelegate::DidRunScript(ShellRunner* runner) { |
| 41 } | 41 } |
| 42 | 42 |
| 43 void ShellRunnerDelegate::UnhandledException(ShellRunner* runner, | 43 void ShellRunnerDelegate::UnhandledException(ShellRunner* runner, |
| 44 TryCatch& try_catch) { | 44 TryCatch& try_catch) { |
| 45 CHECK(false) << try_catch.GetStackTrace(); | 45 LOG(FATAL) << try_catch.GetStackTrace(); |
| 46 } | 46 } |
| 47 | 47 |
| 48 ShellRunner::ShellRunner(ShellRunnerDelegate* delegate, Isolate* isolate) | 48 ShellRunner::ShellRunner(ShellRunnerDelegate* delegate, Isolate* isolate) |
| 49 : delegate_(delegate) { | 49 : delegate_(delegate) { |
| 50 v8::Isolate::Scope isolate_scope(isolate); | 50 v8::Isolate::Scope isolate_scope(isolate); |
| 51 HandleScope handle_scope(isolate); | 51 HandleScope handle_scope(isolate); |
| 52 v8::Local<v8::Context> context = | 52 v8::Local<v8::Context> context = |
| 53 Context::New(isolate, NULL, delegate_->GetGlobalTemplate(this, isolate)); | 53 Context::New(isolate, NULL, delegate_->GetGlobalTemplate(this, isolate)); |
| 54 | 54 |
| 55 context_holder_.reset(new ContextHolder(isolate)); | 55 context_holder_.reset(new ContextHolder(isolate)); |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 auto maybe = script->Run(GetContextHolder()->context()); | 108 auto maybe = script->Run(GetContextHolder()->context()); |
| 109 | 109 |
| 110 delegate_->DidRunScript(this); | 110 delegate_->DidRunScript(this); |
| 111 v8::Local<v8::Value> result; | 111 v8::Local<v8::Value> result; |
| 112 if (!maybe.ToLocal(&result)) { | 112 if (!maybe.ToLocal(&result)) { |
| 113 delegate_->UnhandledException(this, try_catch); | 113 delegate_->UnhandledException(this, try_catch); |
| 114 } | 114 } |
| 115 } | 115 } |
| 116 | 116 |
| 117 } // namespace gin | 117 } // namespace gin |
| OLD | NEW |