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 3308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3319 v8::Isolate::SuppressMicrotaskExecutionScope suppress(isolate); | 3319 v8::Isolate::SuppressMicrotaskExecutionScope suppress(isolate); |
3320 for (int i = 0; i < call_completed_callbacks_.length(); i++) { | 3320 for (int i = 0; i < call_completed_callbacks_.length(); i++) { |
3321 call_completed_callbacks_.at(i)(isolate); | 3321 call_completed_callbacks_.at(i)(isolate); |
3322 } | 3322 } |
3323 } | 3323 } |
3324 | 3324 |
3325 void Isolate::DebugStateUpdated() { | 3325 void Isolate::DebugStateUpdated() { |
3326 promise_hook_or_debug_is_active_ = promise_hook_ || debug()->is_active(); | 3326 promise_hook_or_debug_is_active_ = promise_hook_ || debug()->is_active(); |
3327 } | 3327 } |
3328 | 3328 |
| 3329 void Isolate::RunHostImportModuleDynamicallyCallback( |
| 3330 Handle<String> source_url, Handle<String> specifier, |
| 3331 Handle<JSPromise> promise) { |
| 3332 if (host_import_module_dynamically_callback_ == nullptr) return; |
| 3333 |
| 3334 host_import_module_dynamically_callback_( |
| 3335 reinterpret_cast<v8::Isolate*>(this), v8::Utils::ToLocal(source_url), |
| 3336 v8::Utils::ToLocal(specifier), v8::Utils::PromiseToLocal(promise)); |
| 3337 } |
| 3338 |
| 3339 void Isolate::SetHostImportModuleDynamicallyCallback( |
| 3340 HostImportModuleDynamicallyCallback callback) { |
| 3341 host_import_module_dynamically_callback_ = callback; |
| 3342 } |
| 3343 |
3329 void Isolate::SetPromiseHook(PromiseHook hook) { | 3344 void Isolate::SetPromiseHook(PromiseHook hook) { |
3330 promise_hook_ = hook; | 3345 promise_hook_ = hook; |
3331 DebugStateUpdated(); | 3346 DebugStateUpdated(); |
3332 } | 3347 } |
3333 | 3348 |
3334 void Isolate::RunPromiseHook(PromiseHookType type, Handle<JSPromise> promise, | 3349 void Isolate::RunPromiseHook(PromiseHookType type, Handle<JSPromise> promise, |
3335 Handle<Object> parent) { | 3350 Handle<Object> parent) { |
3336 if (debug()->is_active()) debug()->RunPromiseHook(type, promise, parent); | 3351 if (debug()->is_active()) debug()->RunPromiseHook(type, promise, parent); |
3337 if (promise_hook_ == nullptr) return; | 3352 if (promise_hook_ == nullptr) return; |
3338 promise_hook_(type, v8::Utils::PromiseToLocal(promise), | 3353 promise_hook_(type, v8::Utils::PromiseToLocal(promise), |
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3724 // Then check whether this scope intercepts. | 3739 // Then check whether this scope intercepts. |
3725 if ((flag & intercept_mask_)) { | 3740 if ((flag & intercept_mask_)) { |
3726 intercepted_flags_ |= flag; | 3741 intercepted_flags_ |= flag; |
3727 return true; | 3742 return true; |
3728 } | 3743 } |
3729 return false; | 3744 return false; |
3730 } | 3745 } |
3731 | 3746 |
3732 } // namespace internal | 3747 } // namespace internal |
3733 } // namespace v8 | 3748 } // namespace v8 |
OLD | NEW |