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 3323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3334 v8::Isolate::SuppressMicrotaskExecutionScope suppress(isolate); | 3334 v8::Isolate::SuppressMicrotaskExecutionScope suppress(isolate); |
3335 for (int i = 0; i < call_completed_callbacks_.length(); i++) { | 3335 for (int i = 0; i < call_completed_callbacks_.length(); i++) { |
3336 call_completed_callbacks_.at(i)(isolate); | 3336 call_completed_callbacks_.at(i)(isolate); |
3337 } | 3337 } |
3338 } | 3338 } |
3339 | 3339 |
3340 void Isolate::DebugStateUpdated() { | 3340 void Isolate::DebugStateUpdated() { |
3341 promise_hook_or_debug_is_active_ = promise_hook_ || debug()->is_active(); | 3341 promise_hook_or_debug_is_active_ = promise_hook_ || debug()->is_active(); |
3342 } | 3342 } |
3343 | 3343 |
3344 void Isolate::RunHostImportModuleDynamicallyCallback( | |
3345 Handle<String> source_url, Handle<String> specifier, | |
3346 Handle<JSPromise> promise) { | |
3347 if (host_import_module_dynamically_callback_ == nullptr) return; | |
neis
2017/03/17 10:36:32
I think we talked about this case. Didn't we agree
gsathya
2017/03/17 21:47:59
I'm not sure tbh. there could be cases where the e
neis
2017/03/20 09:36:03
Hmm, I would imagine that if an embedder for some
gsathya
2017/03/22 03:08:34
Jochen --
For dynamic import to work, we require
| |
3348 | |
3349 host_import_module_dynamically_callback_( | |
3350 reinterpret_cast<v8::Isolate*>(this), v8::Utils::ToLocal(source_url), | |
3351 v8::Utils::ToLocal(specifier), v8::Utils::PromiseToLocal(promise)); | |
3352 } | |
3353 | |
3354 void Isolate::SetHostImportModuleDynamicallyCallback( | |
3355 HostImportModuleDynamicallyCallback callback) { | |
3356 host_import_module_dynamically_callback_ = callback; | |
3357 } | |
3358 | |
3344 void Isolate::SetPromiseHook(PromiseHook hook) { | 3359 void Isolate::SetPromiseHook(PromiseHook hook) { |
3345 promise_hook_ = hook; | 3360 promise_hook_ = hook; |
3346 DebugStateUpdated(); | 3361 DebugStateUpdated(); |
3347 } | 3362 } |
3348 | 3363 |
3349 void Isolate::RunPromiseHook(PromiseHookType type, Handle<JSPromise> promise, | 3364 void Isolate::RunPromiseHook(PromiseHookType type, Handle<JSPromise> promise, |
3350 Handle<Object> parent) { | 3365 Handle<Object> parent) { |
3351 if (debug()->is_active()) debug()->RunPromiseHook(type, promise, parent); | 3366 if (debug()->is_active()) debug()->RunPromiseHook(type, promise, parent); |
3352 if (promise_hook_ == nullptr) return; | 3367 if (promise_hook_ == nullptr) return; |
3353 promise_hook_(type, v8::Utils::PromiseToLocal(promise), | 3368 promise_hook_(type, v8::Utils::PromiseToLocal(promise), |
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3739 // Then check whether this scope intercepts. | 3754 // Then check whether this scope intercepts. |
3740 if ((flag & intercept_mask_)) { | 3755 if ((flag & intercept_mask_)) { |
3741 intercepted_flags_ |= flag; | 3756 intercepted_flags_ |= flag; |
3742 return true; | 3757 return true; |
3743 } | 3758 } |
3744 return false; | 3759 return false; |
3745 } | 3760 } |
3746 | 3761 |
3747 } // namespace internal | 3762 } // namespace internal |
3748 } // namespace v8 | 3763 } // namespace v8 |
OLD | NEW |