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

Unified Diff: include/v8.h

Issue 2768923002: WIP: Allow ValueSerializer clients to transfer long strings out of band.
Patch Set: Created 3 years, 9 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 38584e8af06efdd848ae92d5c8b8ad412108f528..c1d40b315012fff9c7ad1be6b8d7e7f816c8b0bd 100644
--- a/include/v8.h
+++ b/include/v8.h
@@ -1712,6 +1712,15 @@ class V8_EXPORT ValueSerializer {
virtual Maybe<uint32_t> GetWasmModuleTransferId(
Isolate* isolate, Local<WasmCompiledModule> module);
+
+ /*
+ * Called when the ValueSerializer encounters a string at least as long as
+ * the value passed to |SetMinimumLongStringLength|. The embedder is
+ * expected to return an ID for the string.
+ */
+ virtual Maybe<uint32_t> GetLongStringId(Isolate* isolate,
+ Local<String> string);
+
/*
* Allocates memory for the buffer of at least the size provided. The actual
* size (which may be greater or equal) is written to |actual_size|. If no
@@ -1785,6 +1794,14 @@ class V8_EXPORT ValueSerializer {
void SetTreatArrayBufferViewsAsHostObjects(bool mode);
/*
+ * If a positive values is assigned, strings of at least this length will be
+ * passed to the delegate instead of serialized inline into the buffer.
+ * This option is recommended only if the delegate has a more efficient means
+ * of delivering those strings. By default, this feature is disabled.
+ */
+ void SetMinimumLongStringLength(int size);
+
+ /*
* Write raw data in various common formats to the buffer.
* Note that integer types are written in base-128 varint format, not with a
* binary copy. For use during an override of Delegate::WriteHostObject.
@@ -1863,6 +1880,12 @@ class V8_EXPORT ValueDeserializer {
Local<SharedArrayBuffer> shared_array_buffer);
/*
+ * Similar to TransferArrayBuffer, but for IDs obtained from
+ * |GetLongStringId|.
+ */
+ void TransferLongString(uint32_t id, Local<String> string);
+
+ /*
* Must be called before ReadHeader to enable support for reading the legacy
* wire format (i.e., which predates this being shipped).
*
« 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