Commit a408603c authored by Yuki Shiino's avatar Yuki Shiino Committed by Commit Bot

bind-gen: Reduce the code dependencies of v8 context snapshot

Makes V8ContextSnapshotImpl not depend on unnecessary code and data
if !defined(USE_V8_CONTEXT_SNAPSHOT).

Bug: 839389
Change-Id: I349292e52b465e5836e8ade7791be24a1e39af78
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2362066Reviewed-by: default avatarHitoshi Yoshida <peria@chromium.org>
Commit-Queue: Yuki Shiino <yukishiino@chromium.org>
Cr-Commit-Position: refs/heads/master@{#799486}
parent ebfd2db6
......@@ -22,6 +22,51 @@
namespace blink {
void V8ContextSnapshotImpl::Init() {
V8ContextSnapshot::SetCreateContextFromSnapshotFunc(CreateContext);
V8ContextSnapshot::SetInstallContextIndependentPropsFunc(
InstallContextIndependentProps);
V8ContextSnapshot::SetEnsureInterfaceTemplatesFunc(InstallInterfaceTemplates);
V8ContextSnapshot::SetTakeSnapshotFunc(TakeSnapshot);
V8ContextSnapshot::SetGetReferenceTableFunc(GetReferenceTable);
}
#if !defined(USE_V8_CONTEXT_SNAPSHOT)
v8::Local<v8::Context> V8ContextSnapshotImpl::CreateContext(
v8::Isolate* isolate,
const DOMWrapperWorld& world,
v8::ExtensionConfiguration* extension_config,
v8::Local<v8::Object> global_proxy,
Document* document) {
DCHECK(document);
return v8::Local<v8::Context>();
}
void V8ContextSnapshotImpl::InstallContextIndependentProps(
ScriptState* script_state) {}
void V8ContextSnapshotImpl::InstallInterfaceTemplates(v8::Isolate* isolate) {}
v8::StartupData V8ContextSnapshotImpl::TakeSnapshot() {
v8::Isolate* isolate = V8PerIsolateData::MainThreadIsolate();
CHECK_EQ(isolate, v8::Isolate::GetCurrent());
V8PerIsolateData* per_isolate_data = V8PerIsolateData::From(isolate);
CHECK_EQ(per_isolate_data->GetV8ContextSnapshotMode(),
V8PerIsolateData::V8ContextSnapshotMode::kTakeSnapshot);
return {nullptr, 0};
}
const intptr_t* V8ContextSnapshotImpl::GetReferenceTable() {
DCHECK(IsMainThread());
return nullptr;
}
#else // !defined(USE_V8_CONTEXT_SNAPSHOT)
namespace {
// Layout of the snapshot
......@@ -286,15 +331,6 @@ void TakeSnapshotForWorld(v8::SnapshotCreator* snapshot_creator,
} // namespace
void V8ContextSnapshotImpl::Init() {
V8ContextSnapshot::SetCreateContextFromSnapshotFunc(CreateContext);
V8ContextSnapshot::SetInstallContextIndependentPropsFunc(
InstallContextIndependentProps);
V8ContextSnapshot::SetEnsureInterfaceTemplatesFunc(InstallInterfaceTemplates);
V8ContextSnapshot::SetTakeSnapshotFunc(TakeSnapshot);
V8ContextSnapshot::SetGetReferenceTableFunc(GetReferenceTable);
}
v8::Local<v8::Context> V8ContextSnapshotImpl::CreateContext(
v8::Isolate* isolate,
const DOMWrapperWorld& world,
......@@ -457,4 +493,6 @@ const intptr_t* V8ContextSnapshotImpl::GetReferenceTable() {
return reference_table;
}
#endif // !defined(USE_V8_CONTEXT_SNAPSHOT)
} // namespace blink
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment