| Index: src/value-serializer.h
|
| diff --git a/src/value-serializer.h b/src/value-serializer.h
|
| index ef424698d0e59d10323d4f5a136ffcabb5710881..393fe2b73bbf190a58c283f93b443427f922c86c 100644
|
| --- a/src/value-serializer.h
|
| +++ b/src/value-serializer.h
|
| @@ -94,6 +94,16 @@ class ValueSerializer {
|
| */
|
| void SetTreatArrayBufferViewsAsHostObjects(bool mode);
|
|
|
| + /*
|
| + * If a positive values is assigned, strings of at least that 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 length) {
|
| + long_string_threshold_ = length;
|
| + }
|
| +
|
| private:
|
| // Managing allocations of the internal buffer.
|
| Maybe<bool> ExpandBuffer(size_t required_capacity);
|
| @@ -112,7 +122,7 @@ class ValueSerializer {
|
| void WriteOddball(Oddball* oddball);
|
| void WriteSmi(Smi* smi);
|
| void WriteHeapNumber(HeapNumber* number);
|
| - void WriteString(Handle<String> string);
|
| + Maybe<bool> WriteString(Handle<String> string);
|
| Maybe<bool> WriteJSReceiver(Handle<JSReceiver> receiver) WARN_UNUSED_RESULT;
|
| Maybe<bool> WriteJSObject(Handle<JSObject> object) WARN_UNUSED_RESULT;
|
| Maybe<bool> WriteJSObjectSlow(Handle<JSObject> object) WARN_UNUSED_RESULT;
|
| @@ -164,6 +174,10 @@ class ValueSerializer {
|
| // A similar map, for transferred array buffers.
|
| IdentityMap<uint32_t, ZoneAllocationPolicy> array_buffer_transfer_map_;
|
|
|
| + // Used for tracking long strings.
|
| + int long_string_threshold_ = -1;
|
| + IdentityMap<uint32_t, ZoneAllocationPolicy> long_string_map_;
|
| +
|
| DISALLOW_COPY_AND_ASSIGN(ValueSerializer);
|
| };
|
|
|
| @@ -212,6 +226,12 @@ class ValueDeserializer {
|
| Handle<JSArrayBuffer> array_buffer);
|
|
|
| /*
|
| + * Accepts a long string corresponding to one passed previously to
|
| + * ValueSerializer::Delegate::GetLongStringId.
|
| + */
|
| + void TransferLongString(uint32_t transfer_id, Handle<String> string);
|
| +
|
| + /*
|
| * Publicly exposed wire format writing methods.
|
| * These are intended for use within the delegate's WriteHostObject method.
|
| */
|
| @@ -254,6 +274,7 @@ class ValueDeserializer {
|
| MaybeHandle<String> ReadUtf8String() WARN_UNUSED_RESULT;
|
| MaybeHandle<String> ReadOneByteString() WARN_UNUSED_RESULT;
|
| MaybeHandle<String> ReadTwoByteString() WARN_UNUSED_RESULT;
|
| + MaybeHandle<String> ReadLongString() WARN_UNUSED_RESULT;
|
| MaybeHandle<JSObject> ReadJSObject() WARN_UNUSED_RESULT;
|
| MaybeHandle<JSArray> ReadSparseJSArray() WARN_UNUSED_RESULT;
|
| MaybeHandle<JSArray> ReadDenseJSArray() WARN_UNUSED_RESULT;
|
| @@ -296,6 +317,7 @@ class ValueDeserializer {
|
| // Always global handles.
|
| Handle<FixedArray> id_map_;
|
| MaybeHandle<SeededNumberDictionary> array_buffer_transfer_map_;
|
| + MaybeHandle<SeededNumberDictionary> long_string_map_;
|
|
|
| DISALLOW_COPY_AND_ASSIGN(ValueDeserializer);
|
| };
|
|
|