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 3318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3329 v8::Isolate::SuppressMicrotaskExecutionScope suppress(isolate); | 3329 v8::Isolate::SuppressMicrotaskExecutionScope suppress(isolate); |
3330 for (int i = 0; i < call_completed_callbacks_.length(); i++) { | 3330 for (int i = 0; i < call_completed_callbacks_.length(); i++) { |
3331 call_completed_callbacks_.at(i)(isolate); | 3331 call_completed_callbacks_.at(i)(isolate); |
3332 } | 3332 } |
3333 } | 3333 } |
3334 | 3334 |
3335 void Isolate::DebugStateUpdated() { | 3335 void Isolate::DebugStateUpdated() { |
3336 promise_hook_or_debug_is_active_ = promise_hook_ || debug()->is_active(); | 3336 promise_hook_or_debug_is_active_ = promise_hook_ || debug()->is_active(); |
3337 } | 3337 } |
3338 | 3338 |
| 3339 void Isolate::RunHostImportModuleDynamicallyCallback( |
| 3340 Handle<String> source_url, Handle<String> specifier, |
| 3341 Handle<JSPromise> promise) { |
| 3342 if (host_import_module_dynamically_callback_ == nullptr) return; |
| 3343 |
| 3344 host_import_module_dynamically_callback_( |
| 3345 reinterpret_cast<v8::Isolate*>(this), v8::Utils::ToLocal(source_url), |
| 3346 v8::Utils::ToLocal(specifier), v8::Utils::PromiseToLocal(promise)); |
| 3347 } |
| 3348 |
| 3349 void Isolate::SetHostImportModuleDynamicallyCallback( |
| 3350 HostImportModuleDynamicallyCallback callback) { |
| 3351 host_import_module_dynamically_callback_ = callback; |
| 3352 } |
| 3353 |
3339 void Isolate::SetPromiseHook(PromiseHook hook) { | 3354 void Isolate::SetPromiseHook(PromiseHook hook) { |
3340 promise_hook_ = hook; | 3355 promise_hook_ = hook; |
3341 DebugStateUpdated(); | 3356 DebugStateUpdated(); |
3342 } | 3357 } |
3343 | 3358 |
3344 void Isolate::RunPromiseHook(PromiseHookType type, Handle<JSPromise> promise, | 3359 void Isolate::RunPromiseHook(PromiseHookType type, Handle<JSPromise> promise, |
3345 Handle<Object> parent) { | 3360 Handle<Object> parent) { |
3346 if (debug()->is_active()) debug()->RunPromiseHook(type, promise, parent); | 3361 if (debug()->is_active()) debug()->RunPromiseHook(type, promise, parent); |
3347 if (promise_hook_ == nullptr) return; | 3362 if (promise_hook_ == nullptr) return; |
3348 promise_hook_(type, v8::Utils::PromiseToLocal(promise), | 3363 promise_hook_(type, v8::Utils::PromiseToLocal(promise), |
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3734 // Then check whether this scope intercepts. | 3749 // Then check whether this scope intercepts. |
3735 if ((flag & intercept_mask_)) { | 3750 if ((flag & intercept_mask_)) { |
3736 intercepted_flags_ |= flag; | 3751 intercepted_flags_ |= flag; |
3737 return true; | 3752 return true; |
3738 } | 3753 } |
3739 return false; | 3754 return false; |
3740 } | 3755 } |
3741 | 3756 |
3742 } // namespace internal | 3757 } // namespace internal |
3743 } // namespace v8 | 3758 } // namespace v8 |
OLD | NEW |