Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(76)

Unified Diff: third_party/WebKit/Source/platform/bindings/V8PerIsolateData.h

Issue 2841443005: [Bindings] Create and use V8 context snapshots (Closed)
Patch Set: . Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 f5c9f0b1a3cd0db6c850a30789689b5a13c51b0d..a4541966bb33d6ff2ea07b3cbbda15d8d37ff507 100644
--- a/third_party/WebKit/Source/platform/bindings/V8PerIsolateData.h
+++ b/third_party/WebKit/Source/platform/bindings/V8PerIsolateData.h
@@ -98,7 +98,7 @@ class PLATFORM_EXPORT V8PerIsolateData {
virtual ~Data() = default;
};
- static v8::Isolate* Initialize(WebTaskRunner*);
+ static v8::Isolate* Initialize(WebTaskRunner*, intptr_t*, bool);
static V8PerIsolateData* From(v8::Isolate* isolate) {
DCHECK(isolate);
@@ -115,6 +115,9 @@ class PLATFORM_EXPORT V8PerIsolateData {
std::unique_ptr<gin::V8IdleTaskRunner>);
v8::Isolate* GetIsolate() { return isolate_holder_.isolate(); }
+ v8::SnapshotCreator* GetSnapshotCreator() {
+ return isolate_holder_.snapshot_creator();
+ }
StringCache* GetStringCache() { return string_cache_.get(); }
@@ -137,9 +140,16 @@ class PLATFORM_EXPORT V8PerIsolateData {
// Accessors to the cache of interface templates.
v8::Local<v8::FunctionTemplate> FindInterfaceTemplate(const DOMWrapperWorld&,
const void* key);
+ v8::Local<v8::FunctionTemplate> FindInterfaceTemplateTemp(
+ const DOMWrapperWorld&,
+ const void* key);
void SetInterfaceTemplate(const DOMWrapperWorld&,
const void* key,
v8::Local<v8::FunctionTemplate>);
+ void SetInterfaceTemplateTemp(const DOMWrapperWorld&,
+ const void* key,
+ v8::Local<v8::FunctionTemplate>);
+ void ClearAll();
// Accessor to the cache of cross-origin accessible operation's templates.
// Created templates get automatically cached.
@@ -220,10 +230,21 @@ class PLATFORM_EXPORT V8PerIsolateData {
return script_wrappable_visitor_.get();
}
+ bool UseSnapshot() const {
+ return isolate_holder_.v8_context_mode() ==
+ gin::IsolateHolder::kUseSnapshot;
+ }
+
private:
- explicit V8PerIsolateData(WebTaskRunner*);
+ explicit V8PerIsolateData(WebTaskRunner*, intptr_t*, bool);
~V8PerIsolateData();
+ using CopyableTraits = v8::CopyablePersistentTraits<v8::FunctionTemplate>;
+ using CopyablePersistent =
+ v8::Persistent<v8::FunctionTemplate, CopyableTraits>;
+ using V8TemporaryFunctionTemplateMap =
+ HashMap<const void*, CopyablePersistent>;
+
typedef HashMap<const void*, v8::Eternal<v8::FunctionTemplate>>
V8FunctionTemplateMap;
V8FunctionTemplateMap& SelectInterfaceTemplateMap(const DOMWrapperWorld&);
@@ -237,10 +258,13 @@ class PLATFORM_EXPORT V8PerIsolateData {
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_;
+
+ V8TemporaryFunctionTemplateMap interface_template_temp_map_;
+
// m_operationTemplateMapFor{,Non}MainWorld holds function templates for
// the cross-origin accessible DOM operations.
V8FunctionTemplateMap operation_template_map_for_main_world_;

Powered by Google App Engine
This is Rietveld 408576698