[api] Add V8::SetIsCrossOriginIsolated method

- Adds a method to tell V8 that the process is cross-origin-isolated
  under COOP+COEP. In this case, SharedArrayBuffer can be enabled.

Bug: chromium:923807
Change-Id: I729093665a50d2b3667c028e05b42d21d76b12d3
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2502448
Reviewed-by: Camillo Bruni <cbruni@chromium.org>
Reviewed-by: Adam Klein <adamk@chromium.org>
Commit-Queue: Bill Budge <bbudge@chromium.org>
Cr-Commit-Position: refs/heads/master@{#70805}
This commit is contained in:
Bill Budge 2020-10-27 05:20:13 -07:00 committed by Commit Bot
parent aa42907747
commit b6ebafa2d5
2 changed files with 10 additions and 0 deletions

View File

@ -9832,6 +9832,12 @@ class V8_EXPORT V8 {
*/
static void GetSharedMemoryStatistics(SharedMemoryStatistics* statistics);
/**
* Notifies V8 that the process is cross-origin-isolated, which enables
* defining the SharedArrayBuffer function on the global object of Contexts.
*/
static void SetIsCrossOriginIsolated();
private:
V8();

View File

@ -5862,6 +5862,10 @@ void V8::GetSharedMemoryStatistics(SharedMemoryStatistics* statistics) {
i::ReadOnlyHeap::PopulateReadOnlySpaceStatistics(statistics);
}
void V8::SetIsCrossOriginIsolated() {
i::FLAG_harmony_sharedarraybuffer = true;
}
template <typename ObjectType>
struct InvokeBootstrapper;