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

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

Issue 2841443005: [Bindings] Create and use V8 context snapshots (Closed)
Patch Set: Work for some comments Created 3 years, 7 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 dbb2c0e48ce297657a6a427b3789bb7ba8675364..693837e624032ea46bab039e556afb07b8b22f30 100644
--- a/third_party/WebKit/Source/platform/bindings/V8PerIsolateData.h
+++ b/third_party/WebKit/Source/platform/bindings/V8PerIsolateData.h
@@ -100,7 +100,9 @@ class PLATFORM_EXPORT V8PerIsolateData {
virtual ~Data() = default;
};
- static v8::Isolate* Initialize(WebTaskRunner*);
+ static v8::Isolate* Initialize(WebTaskRunner*,
+ intptr_t*,
+ gin::IsolateHolder::V8ContextMode);
static V8PerIsolateData* From(v8::Isolate* isolate) {
DCHECK(isolate);
@@ -117,6 +119,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(); }
@@ -140,6 +145,10 @@ class PLATFORM_EXPORT V8PerIsolateData {
void SetInterfaceTemplate(const DOMWrapperWorld&,
const void* key,
v8::Local<v8::FunctionTemplate>);
+ void ClearPersistents();
+ gin::IsolateHolder::V8ContextMode GetV8ContextMode() const {
+ return isolate_holder_.v8_context_mode();
+ }
// Accessor to the cache of cross-origin accessible operation's templates.
// Created templates get automatically cached.
@@ -221,11 +230,13 @@ class PLATFORM_EXPORT V8PerIsolateData {
}
private:
- explicit V8PerIsolateData(WebTaskRunner*);
+ explicit V8PerIsolateData(WebTaskRunner*,
+ intptr_t*,
+ gin::IsolateHolder::V8ContextMode);
~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,
@@ -237,10 +248,18 @@ 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_;
+
+ using CopyablePersistent =
haraken 2017/05/20 19:10:03 Would you help me understand why you need to use C
peria 2017/05/30 08:25:44 Will replace with ScopedPersistent or something us
+ v8::Persistent<v8::FunctionTemplate,
+ v8::CopyablePersistentTraits<v8::FunctionTemplate>>;
+ using V8FunctionTemplatePersistentMap =
+ HashMap<const void*, CopyablePersistent>;
+ V8FunctionTemplatePersistentMap interface_template_persistent_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