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

Unified Diff: include/v8.h

Issue 2628093003: [serializer] change internal field callbacks to take data pointer. (Closed)
Patch Set: Created 3 years, 11 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') | no next file with comments »
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 19b8e2c701f11bf66b595306d89127a960159172..3c503d0c06ed3ff52370ac92c889821b3755aa1d 100644
--- a/include/v8.h
+++ b/include/v8.h
@@ -6281,17 +6281,33 @@ class V8_EXPORT EmbedderHeapTracer {
};
/**
- * Callback to the embedder used in SnapshotCreator to handle internal fields.
- */
-typedef StartupData (*SerializeInternalFieldsCallback)(Local<Object> holder,
- int index);
+ * Callback and supporting data used in SnapshotCreator to implement embedder
+ * logic to serialize internal fields.
+ */
+struct SerializeInternalFieldsCallback {
+ typedef StartupData (*CallbackFunction)(Local<Object> holder, int index,
+ void* data);
+ SerializeInternalFieldsCallback(CallbackFunction function = nullptr,
+ void* data_arg = nullptr)
+ : callback(function), data(data_arg) {}
+ CallbackFunction callback;
+ void* data;
+};
/**
- * Callback to the embedder used to deserialize internal fields.
+ * Callback and supporting data used to implement embedder logic to deserialize
+ * internal fields.
*/
-typedef void (*DeserializeInternalFieldsCallback)(Local<Object> holder,
- int index,
- StartupData payload);
+struct DeserializeInternalFieldsCallback {
+ typedef void (*CallbackFunction)(Local<Object> holder, int index,
+ StartupData payload, void* data);
+ DeserializeInternalFieldsCallback(CallbackFunction function = nullptr,
+ void* data_arg = nullptr)
+ : callback(function), data(data_arg) {}
+ void (*callback)(Local<Object> holder, int index, StartupData payload,
+ void* data);
+ void* data;
+};
/**
* Isolate represents an isolated instance of the V8 engine. V8 isolates have
@@ -7688,7 +7704,8 @@ class V8_EXPORT SnapshotCreator {
* \returns the index of the context in the snapshot blob.
*/
size_t AddContext(Local<Context> context,
- SerializeInternalFieldsCallback callback = nullptr);
+ SerializeInternalFieldsCallback callback =
+ SerializeInternalFieldsCallback());
/**
* Add a template to be included in the snapshot blob.
@@ -8028,7 +8045,8 @@ class V8_EXPORT Context {
static MaybeLocal<Context> FromSnapshot(
Isolate* isolate, size_t context_snapshot_index,
- DeserializeInternalFieldsCallback internal_fields_deserializer = nullptr,
+ DeserializeInternalFieldsCallback internal_fields_deserializer =
+ DeserializeInternalFieldsCallback(),
ExtensionConfiguration* extensions = nullptr,
MaybeLocal<Value> global_object = MaybeLocal<Value>());
« no previous file with comments | « no previous file | src/api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698