| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project 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 "src/isolate.h" | 5 #include "src/isolate.h" |
| 6 | 6 |
| 7 #include <stdlib.h> | 7 #include <stdlib.h> |
| 8 | 8 |
| 9 #include <fstream> // NOLINT(readability/streams) | 9 #include <fstream> // NOLINT(readability/streams) |
| 10 #include <sstream> | 10 #include <sstream> |
| (...skipping 3327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3338 v8::Isolate::SuppressMicrotaskExecutionScope suppress(isolate); | 3338 v8::Isolate::SuppressMicrotaskExecutionScope suppress(isolate); |
| 3339 for (int i = 0; i < call_completed_callbacks_.length(); i++) { | 3339 for (int i = 0; i < call_completed_callbacks_.length(); i++) { |
| 3340 call_completed_callbacks_.at(i)(isolate); | 3340 call_completed_callbacks_.at(i)(isolate); |
| 3341 } | 3341 } |
| 3342 } | 3342 } |
| 3343 | 3343 |
| 3344 void Isolate::DebugStateUpdated() { | 3344 void Isolate::DebugStateUpdated() { |
| 3345 promise_hook_or_debug_is_active_ = promise_hook_ || debug()->is_active(); | 3345 promise_hook_or_debug_is_active_ = promise_hook_ || debug()->is_active(); |
| 3346 } | 3346 } |
| 3347 | 3347 |
| 3348 void Isolate::RunHostImportModuleDynamicallyCallback( |
| 3349 Handle<String> source_url, Handle<String> specifier, |
| 3350 Handle<JSPromise> promise) { |
| 3351 auto result = v8::Utils::PromiseToDynamicImportResult(promise); |
| 3352 if (host_import_module_dynamically_callback_ == nullptr) { |
| 3353 Handle<Object> exception = |
| 3354 factory()->NewError(error_function(), MessageTemplate::kUnsupported); |
| 3355 CHECK(result->FinishDynamicImportFailure( |
| 3356 v8::Utils::ToLocal(handle(context(), this)), |
| 3357 v8::Utils::ToLocal(exception))); |
| 3358 return; |
| 3359 } |
| 3360 |
| 3361 host_import_module_dynamically_callback_( |
| 3362 reinterpret_cast<v8::Isolate*>(this), v8::Utils::ToLocal(source_url), |
| 3363 v8::Utils::ToLocal(specifier), result); |
| 3364 } |
| 3365 |
| 3366 void Isolate::SetHostImportModuleDynamicallyCallback( |
| 3367 HostImportModuleDynamicallyCallback callback) { |
| 3368 host_import_module_dynamically_callback_ = callback; |
| 3369 } |
| 3370 |
| 3348 void Isolate::SetPromiseHook(PromiseHook hook) { | 3371 void Isolate::SetPromiseHook(PromiseHook hook) { |
| 3349 promise_hook_ = hook; | 3372 promise_hook_ = hook; |
| 3350 DebugStateUpdated(); | 3373 DebugStateUpdated(); |
| 3351 } | 3374 } |
| 3352 | 3375 |
| 3353 void Isolate::RunPromiseHook(PromiseHookType type, Handle<JSPromise> promise, | 3376 void Isolate::RunPromiseHook(PromiseHookType type, Handle<JSPromise> promise, |
| 3354 Handle<Object> parent) { | 3377 Handle<Object> parent) { |
| 3355 if (debug()->is_active()) debug()->RunPromiseHook(type, promise, parent); | 3378 if (debug()->is_active()) debug()->RunPromiseHook(type, promise, parent); |
| 3356 if (promise_hook_ == nullptr) return; | 3379 if (promise_hook_ == nullptr) return; |
| 3357 promise_hook_(type, v8::Utils::PromiseToLocal(promise), | 3380 promise_hook_(type, v8::Utils::PromiseToLocal(promise), |
| (...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3743 // Then check whether this scope intercepts. | 3766 // Then check whether this scope intercepts. |
| 3744 if ((flag & intercept_mask_)) { | 3767 if ((flag & intercept_mask_)) { |
| 3745 intercepted_flags_ |= flag; | 3768 intercepted_flags_ |= flag; |
| 3746 return true; | 3769 return true; |
| 3747 } | 3770 } |
| 3748 return false; | 3771 return false; |
| 3749 } | 3772 } |
| 3750 | 3773 |
| 3751 } // namespace internal | 3774 } // namespace internal |
| 3752 } // namespace v8 | 3775 } // namespace v8 |
| OLD | NEW |