blink/gin: changes blink to load snapshot based on runtime information
In order to do an experiment (finch) that measures the impact of
switching from v8-snapshot to blink context-snapshot I need to support
both at the same time. This patch changes gin to store the type of
snapshot that was loaded, and blink to use that information rather
than ifdefs.
BUG=764576,1257321
TEST=none
Change-Id: I56db96937ef22ddf1c91975a9a4dc355c1c7559c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3212165
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: Richard Coles <torne@chromium.org>
Reviewed-by: Kentaro Hara <haraken@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Reviewed-by: Andrey Kosyakov <caseq@chromium.org>
Reviewed-by: John Abd-El-Malek <jam@chromium.org>
Reviewed-by: Jeremy Roman <jbroman@chromium.org>
Reviewed-by: Yuki Shiino <yukishiino@chromium.org>
Commit-Queue: Scott Violet <sky@chromium.org>
Cr-Commit-Position: refs/heads/main@{#930573}
diff --git a/gin/v8_initializer.h b/gin/v8_initializer.h
index 955be10..543bacd 100644
--- a/gin/v8_initializer.h
+++ b/gin/v8_initializer.h
@@ -15,6 +15,10 @@
#include "gin/public/isolate_holder.h"
#include "gin/public/v8_platform.h"
+#if defined(V8_USE_EXTERNAL_STARTUP_DATA)
+#include "gin/public/v8_snapshot_file_type.h"
+#endif
+
namespace v8 {
class StartupData;
}
@@ -34,15 +38,6 @@
int* snapshot_size_out);
#if defined(V8_USE_EXTERNAL_STARTUP_DATA)
- // Indicates which file to load as a snapshot blob image.
- enum class V8SnapshotFileType {
- kDefault,
-
- // Snapshot augmented with customized contexts, which can be deserialized
- // using v8::Context::FromSnapshot.
- kWithAdditionalContext,
- };
-
// Load V8 snapshot from default resources, if they are available.
static void LoadV8Snapshot(
V8SnapshotFileType snapshot_file_type = V8SnapshotFileType::kDefault);