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

Unified Diff: include/v8.h

Issue 2452333002: [serializer] introduce API to serialize internal fields (Closed)
Patch Set: Created 4 years, 2 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
« no previous file with comments | « no previous file | src/api.cc » ('j') | src/snapshot/partial-serializer.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/v8.h
diff --git a/include/v8.h b/include/v8.h
index caf56656ae5070d1a7cd65445d4d623541ca7c2d..2847c3b515713da28ec58441d24cc373d1538ec2 100644
--- a/include/v8.h
+++ b/include/v8.h
@@ -6241,6 +6241,19 @@ class V8_EXPORT EmbedderHeapTracer {
};
/**
+ * Callback to the embedder used in SnapshotCreator to handle internal fields.
+ */
+typedef StartupData (*SerializeInternalFieldsCallback)(Local<Object> holder,
+ int index);
jochen (gone - plz use gerrit) 2016/10/27 12:40:51 size_t ?
Yang 2016/10/27 12:49:27 v8::Object::SetInternalField uses int, so I'd like
+
+/**
+ * Callback to the embedder used to deserialize internal fields.
+ */
+typedef void (*DeserializeInternalFieldsCallback)(Local<Object> holder,
+ int index,
+ StartupData payload);
+
+/**
* Isolate represents an isolated instance of the V8 engine. V8 isolates have
* completely separate states. Objects from one isolate must not be used in
* other isolates. The embedder can create multiple isolates and use them in
@@ -6262,7 +6275,8 @@ class V8_EXPORT Isolate {
create_histogram_callback(nullptr),
add_histogram_sample_callback(nullptr),
array_buffer_allocator(nullptr),
- external_references(nullptr) {}
+ external_references(nullptr),
+ deserialize_internal_fields_callback(nullptr) {}
/**
* The optional entry_hook allows the host application to provide the
@@ -6318,6 +6332,12 @@ class V8_EXPORT Isolate {
* entire lifetime of the isolate.
*/
intptr_t* external_references;
+
+ /**
+ * Specifies an optional callback to deserialize internal fields. It
+ * should match the SerializeInternalFieldCallback used to serialize.
+ */
+ DeserializeInternalFieldsCallback deserialize_internal_fields_callback;
};
@@ -7583,10 +7603,12 @@ class SnapshotCreator {
* This must not be called from within a handle scope.
* \param function_code_handling whether to include compiled function code
* in the snapshot.
+ * \param callback to serialize embedder-set internal fields.
* \returns { nullptr, 0 } on failure, and a startup snapshot on success. The
* caller acquires ownership of the data array in the return value.
*/
- StartupData CreateBlob(FunctionCodeHandling function_code_handling);
+ StartupData CreateBlob(FunctionCodeHandling function_code_handling,
+ SerializeInternalFieldsCallback callback = nullptr);
// Disallow copying and assigning.
SnapshotCreator(const SnapshotCreator&) = delete;
« no previous file with comments | « no previous file | src/api.cc » ('j') | src/snapshot/partial-serializer.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698