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