bindings: Bind V8's snapshot file to Blink's snapshot
Before this CL, Blink's snapshot was created from scratch, and it meant
something in V8's snapshot could be missed.
After this CL, v8_context_snapshot_gerator will create a snapshot
file which involves all information in V8's snapshot file.
This change is a preparation to remove V8's snapshot file from binded
resources of Chromium.
Bug: 750176
Change-Id: I18050cc8131cd836a7b100c8b28cf0148c4a7f4f
Reviewed-on: https://chromium-review.googlesource.com/656866
Commit-Queue: Hitoshi Yoshida <[email protected]>
Reviewed-by: Ross McIlroy <[email protected]>
Reviewed-by: Yuki Shiino <[email protected]>
Reviewed-by: Kentaro Hara <[email protected]>
Cr-Commit-Position: refs/heads/master@{#502494}
diff --git a/gin/isolate_holder.cc b/gin/isolate_holder.cc
index d7619f9..620e9c8 100644
--- a/gin/isolate_holder.cc
+++ b/gin/isolate_holder.cc
@@ -75,10 +75,19 @@
IsolateHolder::IsolateHolder(const intptr_t* reference_table,
v8::StartupData* existing_blob)
- : snapshot_creator_(
- new v8::SnapshotCreator(reference_table, existing_blob)),
- isolate_(snapshot_creator_->GetIsolate()),
- access_mode_(AccessMode::kSingleThread) {
+ : access_mode_(AccessMode::kSingleThread) {
+ CHECK(existing_blob);
+
+ v8::StartupData unused_natives;
+ V8Initializer::GetV8ExternalSnapshotData(&unused_natives, existing_blob);
+ if (!existing_blob->data) {
+ existing_blob = nullptr;
+ }
+
+ snapshot_creator_.reset(
+ new v8::SnapshotCreator(reference_table, existing_blob));
+ isolate_ = snapshot_creator_->GetIsolate();
+
SetUp(nullptr);
}