| Index: third_party/WebKit/Source/platform/bindings/V8PerIsolateData.h
|
| diff --git a/third_party/WebKit/Source/platform/bindings/V8PerIsolateData.h b/third_party/WebKit/Source/platform/bindings/V8PerIsolateData.h
|
| index dbb2c0e48ce297657a6a427b3789bb7ba8675364..dfc50e1288b02d4f8a022e52b1864263baf941f4 100644
|
| --- a/third_party/WebKit/Source/platform/bindings/V8PerIsolateData.h
|
| +++ b/third_party/WebKit/Source/platform/bindings/V8PerIsolateData.h
|
| @@ -59,6 +59,12 @@ class PLATFORM_EXPORT V8PerIsolateData {
|
| WTF_MAKE_NONCOPYABLE(V8PerIsolateData);
|
|
|
| public:
|
| + enum class V8ContextMode {
|
| + kTakeSnapshot,
|
| + kDontUseSnapshot,
|
| + kUseSnapshot,
|
| + };
|
| +
|
| class EndOfScopeTask {
|
| USING_FAST_MALLOC(EndOfScopeTask);
|
|
|
| @@ -100,7 +106,9 @@ class PLATFORM_EXPORT V8PerIsolateData {
|
| virtual ~Data() = default;
|
| };
|
|
|
| - static v8::Isolate* Initialize(WebTaskRunner*);
|
| + static v8::Isolate* Initialize(WebTaskRunner*,
|
| + intptr_t* refernce_table,
|
| + V8ContextMode);
|
|
|
| static V8PerIsolateData* From(v8::Isolate* isolate) {
|
| DCHECK(isolate);
|
| @@ -141,6 +149,15 @@ class PLATFORM_EXPORT V8PerIsolateData {
|
| const void* key,
|
| v8::Local<v8::FunctionTemplate>);
|
|
|
| + // When v8::SnapshotCreator::CreateBlob() is called, we must not have
|
| + // persistent handles from Blink. This method clears them.
|
| + void ClearPersistentsForV8Snapshot();
|
| +
|
| + v8::SnapshotCreator* GetSnapshotCreator() const {
|
| + return isolate_holder_.snapshot_creator();
|
| + }
|
| + V8ContextMode GetV8ContextMode() const { return v8_context_mode_; }
|
| +
|
| // Accessor to the cache of cross-origin accessible operation's templates.
|
| // Created templates get automatically cached.
|
| v8::Local<v8::FunctionTemplate> FindOrCreateOperationTemplate(
|
| @@ -221,11 +238,12 @@ class PLATFORM_EXPORT V8PerIsolateData {
|
| }
|
|
|
| private:
|
| - explicit V8PerIsolateData(WebTaskRunner*);
|
| + V8PerIsolateData(WebTaskRunner*, intptr_t* reference_table, V8ContextMode);
|
| + V8PerIsolateData(intptr_t* reference_table);
|
| ~V8PerIsolateData();
|
|
|
| - typedef HashMap<const void*, v8::Eternal<v8::FunctionTemplate>>
|
| - V8FunctionTemplateMap;
|
| + using V8FunctionTemplateMap =
|
| + HashMap<const void*, v8::Eternal<v8::FunctionTemplate>>;
|
| V8FunctionTemplateMap& SelectInterfaceTemplateMap(const DOMWrapperWorld&);
|
| V8FunctionTemplateMap& SelectOperationTemplateMap(const DOMWrapperWorld&);
|
| bool HasInstance(const WrapperTypeInfo* untrusted,
|
| @@ -235,12 +253,28 @@ class PLATFORM_EXPORT V8PerIsolateData {
|
| v8::Local<v8::Value>,
|
| V8FunctionTemplateMap&);
|
|
|
| + // Members requried for snapshotted context.
|
| + // Snapshotted blob data image to create v8::Context's from. Needs to be
|
| + // instantiated before |isoalte_holder_| gets instantiated.
|
| + v8::StartupData startup_data_;
|
| + // In taking V8 snapshot, we can't keep V8 objects with eternal handles.
|
| + // So we keep some function templates with clearable handles when we take
|
| + // snapshots.
|
| + using CopyablePersistent =
|
| + v8::Persistent<v8::FunctionTemplate,
|
| + v8::CopyablePersistentTraits<v8::FunctionTemplate>>;
|
| + using V8FunctionTemplatePersistentMap =
|
| + HashMap<const void*, CopyablePersistent>;
|
| + V8FunctionTemplatePersistentMap interface_template_map_for_v8_snapshot_;
|
| +
|
| + V8ContextMode v8_context_mode_;
|
| gin::IsolateHolder isolate_holder_;
|
|
|
| - // m_interfaceTemplateMapFor{,Non}MainWorld holds function templates for
|
| + // interface_template_map_for_{,non_}main_world holds function templates for
|
| // the inerface objects.
|
| V8FunctionTemplateMap interface_template_map_for_main_world_;
|
| V8FunctionTemplateMap interface_template_map_for_non_main_world_;
|
| +
|
| // m_operationTemplateMapFor{,Non}MainWorld holds function templates for
|
| // the cross-origin accessible DOM operations.
|
| V8FunctionTemplateMap operation_template_map_for_main_world_;
|
|
|