#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "third_party/blink/renderer/bindings/modules/v8/v8_context_snapshot_impl.h"
#include "third_party/blink/public/platform/platform.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_context_snapshot.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_event_target.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_html_document.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_initializer.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_node.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_window_properties.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_document.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_window.h"
#include "third_party/blink/renderer/core/execution_context/execution_context.h"
#include "third_party/blink/renderer/core/html/html_document.h"
#include "third_party/blink/renderer/platform/bindings/dom_data_store.h"
#include "third_party/blink/renderer/platform/bindings/dom_wrapper_world.h"
#include "third_party/blink/renderer/platform/bindings/v8_dom_wrapper.h"
#include "third_party/blink/renderer/platform/bindings/v8_object_constructor.h"
#include "third_party/blink/renderer/platform/bindings/v8_per_context_data.h"
#include "third_party/blink/renderer/platform/bindings/v8_per_isolate_data.h"
#include "third_party/blink/renderer/platform/bindings/v8_private_property.h"
#include "third_party/blink/renderer/platform/wtf/std_lib_extras.h"
#include "tools/v8_context_snapshot/buildflags.h"
#if defined(V8_USE_EXTERNAL_STARTUP_DATA)
#include "gin/public/v8_snapshot_file_type.h"
#endif
namespace blink {
namespace {
bool IsUsingContextSnapshot() { … }
}
void V8ContextSnapshotImpl::Init() { … }
namespace {
constexpr const size_t kNumOfWorlds = …;
inline DOMWrapperWorld* IndexToWorld(v8::Isolate* isolate, size_t index) { … }
inline int WorldToIndex(const DOMWrapperWorld& world) { … }
InstallPropsPerContext;
InstallPropsPerIsolate;
#if defined(COMPONENT_BUILD) && defined(WIN32) && defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wglobal-constructors"
#endif
const struct { … } type_info_table[] = …;
#if defined(COMPONENT_BUILD) && defined(WIN32) && defined(__clang__)
#pragma clang diagnostic pop
#endif
enum class InternalFieldSerializedValue : uint8_t { … };
struct DeserializerData { … };
v8::Local<v8::Function> CreateInterfaceObject(
v8::Isolate* isolate,
v8::Local<v8::Context> context,
const DOMWrapperWorld& world,
const WrapperTypeInfo* wrapper_type_info) { … }
v8::Local<v8::Object> CreatePlatformObject(
v8::Isolate* isolate,
v8::Local<v8::Context> context,
const DOMWrapperWorld& world,
const WrapperTypeInfo* wrapper_type_info) { … }
v8::StartupData SerializeInternalFieldCallback(v8::Local<v8::Object> object,
int index,
void* unused_data) { … }
void DeserializeInternalFieldCallback(v8::Local<v8::Object> object,
int index,
v8::StartupData payload,
void* data) { … }
v8::StartupData SerializeAPIWrapperCallback(v8::Local<v8::Object> holder,
void* cpp_heap_pointer,
void* unused_data) { … }
void DeserializeAPIWrapperCallback(v8::Local<v8::Object> holder,
v8::StartupData payload,
void* data) { … }
class DummyHTMLDocumentForSnapshot : public ScriptWrappable { … };
void TakeSnapshotForWorld(v8::SnapshotCreator* snapshot_creator,
const DOMWrapperWorld& world) { … }
}
v8::Local<v8::Context> V8ContextSnapshotImpl::CreateContext(
v8::Isolate* isolate,
const DOMWrapperWorld& world,
v8::ExtensionConfiguration* extension_config,
v8::Local<v8::Object> global_proxy,
Document* document) { … }
void V8ContextSnapshotImpl::InstallContextIndependentProps(
ScriptState* script_state) { … }
void V8ContextSnapshotImpl::InstallInterfaceTemplates(v8::Isolate* isolate) { … }
v8::StartupData V8ContextSnapshotImpl::TakeSnapshot(v8::Isolate* isolate) { … }
const intptr_t* V8ContextSnapshotImpl::GetReferenceTable() { … }
}