Skip to content

Commit

Permalink
bindings: Bind V8's snapshot file to Blink's snapshot
Browse files Browse the repository at this point in the history
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 <peria@chromium.org>
Reviewed-by: Ross McIlroy <rmcilroy@chromium.org>
Reviewed-by: Yuki Shiino <yukishiino@chromium.org>
Reviewed-by: Kentaro Hara <haraken@chromium.org>
Cr-Commit-Position: refs/heads/master@{#502494}
  • Loading branch information
peria authored and Commit Bot committed Sep 16, 2017
1 parent cf17243 commit 440591c
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 7 deletions.
17 changes: 13 additions & 4 deletions gin/isolate_holder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,19 @@ IsolateHolder::IsolateHolder(

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);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
#include "public/platform/Platform.h"
#include "public/web/WebKit.h"
#include "v8/include/v8-debug.h"
#include "v8/include/v8.h"

namespace blink {

Expand Down Expand Up @@ -97,7 +98,7 @@ V8PerIsolateData::V8PerIsolateData(
// main thread.
V8PerIsolateData::V8PerIsolateData(const intptr_t* reference_table)
: v8_context_snapshot_mode_(V8ContextSnapshotMode::kTakeSnapshot),
isolate_holder_(reference_table, nullptr),
isolate_holder_(reference_table, &startup_data_),
interface_template_map_for_v8_context_snapshot_(GetIsolate()),
string_cache_(WTF::WrapUnique(new StringCache(GetIsolate()))),
private_property_(V8PrivateProperty::Create()),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -288,8 +288,7 @@ class PLATFORM_EXPORT V8PerIsolateData {
HashMap<const void*, Vector<v8::Eternal<v8::Name>>> eternal_name_cache_;

// Members required for the V8 context snapshot.
// v8::Context is created from this blob data image. This needs to be
// instantiated before |isolate_holder_| gets instantiated.
// v8::Context is created from this blob data image.
v8::StartupData startup_data_;
// When taking a V8 context snapshot, we can't keep V8 objects with eternal
// handles. So we use a special interface map that doesn't use eternal handles
Expand Down

0 comments on commit 440591c

Please sign in to comment.