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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « no previous file | src/api.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 /** \mainpage V8 API Reference Guide 5 /** \mainpage V8 API Reference Guide
6 * 6 *
7 * V8 is Google's open source JavaScript engine. 7 * V8 is Google's open source JavaScript engine.
8 * 8 *
9 * This set of documents provides reference material generated from the 9 * This set of documents provides reference material generated from the
10 * V8 header file, include/v8.h. 10 * V8 header file, include/v8.h.
(...skipping 1694 matching lines...) Expand 10 before | Expand all | Expand 10 after
1705 * ValueDeserializer::TransferSharedArrayBuffer as |transfer_id|. 1705 * ValueDeserializer::TransferSharedArrayBuffer as |transfer_id|.
1706 * 1706 *
1707 * If the object cannot be serialized, an 1707 * If the object cannot be serialized, an
1708 * exception should be thrown and Nothing<uint32_t>() returned. 1708 * exception should be thrown and Nothing<uint32_t>() returned.
1709 */ 1709 */
1710 virtual Maybe<uint32_t> GetSharedArrayBufferId( 1710 virtual Maybe<uint32_t> GetSharedArrayBufferId(
1711 Isolate* isolate, Local<SharedArrayBuffer> shared_array_buffer); 1711 Isolate* isolate, Local<SharedArrayBuffer> shared_array_buffer);
1712 1712
1713 virtual Maybe<uint32_t> GetWasmModuleTransferId( 1713 virtual Maybe<uint32_t> GetWasmModuleTransferId(
1714 Isolate* isolate, Local<WasmCompiledModule> module); 1714 Isolate* isolate, Local<WasmCompiledModule> module);
1715
1716 /*
1717 * Called when the ValueSerializer encounters a string at least as long as
1718 * the value passed to |SetMinimumLongStringLength|. The embedder is
1719 * expected to return an ID for the string.
1720 */
1721 virtual Maybe<uint32_t> GetLongStringId(Isolate* isolate,
1722 Local<String> string);
1723
1715 /* 1724 /*
1716 * Allocates memory for the buffer of at least the size provided. The actual 1725 * Allocates memory for the buffer of at least the size provided. The actual
1717 * size (which may be greater or equal) is written to |actual_size|. If no 1726 * size (which may be greater or equal) is written to |actual_size|. If no
1718 * buffer has been allocated yet, nullptr will be provided. 1727 * buffer has been allocated yet, nullptr will be provided.
1719 * 1728 *
1720 * If the memory cannot be allocated, nullptr should be returned. 1729 * If the memory cannot be allocated, nullptr should be returned.
1721 * |actual_size| will be ignored. It is assumed that |old_buffer| is still 1730 * |actual_size| will be ignored. It is assumed that |old_buffer| is still
1722 * valid in this case and has not been modified. 1731 * valid in this case and has not been modified.
1723 */ 1732 */
1724 virtual void* ReallocateBufferMemory(void* old_buffer, size_t size, 1733 virtual void* ReallocateBufferMemory(void* old_buffer, size_t size,
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
1778 /* 1787 /*
1779 * Indicate whether to treat ArrayBufferView objects as host objects, 1788 * Indicate whether to treat ArrayBufferView objects as host objects,
1780 * i.e. pass them to Delegate::WriteHostObject. This should not be 1789 * i.e. pass them to Delegate::WriteHostObject. This should not be
1781 * called when no Delegate was passed. 1790 * called when no Delegate was passed.
1782 * 1791 *
1783 * The default is not to treat ArrayBufferViews as host objects. 1792 * The default is not to treat ArrayBufferViews as host objects.
1784 */ 1793 */
1785 void SetTreatArrayBufferViewsAsHostObjects(bool mode); 1794 void SetTreatArrayBufferViewsAsHostObjects(bool mode);
1786 1795
1787 /* 1796 /*
1797 * If a positive values is assigned, strings of at least this length will be
1798 * passed to the delegate instead of serialized inline into the buffer.
1799 * This option is recommended only if the delegate has a more efficient means
1800 * of delivering those strings. By default, this feature is disabled.
1801 */
1802 void SetMinimumLongStringLength(int size);
1803
1804 /*
1788 * Write raw data in various common formats to the buffer. 1805 * Write raw data in various common formats to the buffer.
1789 * Note that integer types are written in base-128 varint format, not with a 1806 * Note that integer types are written in base-128 varint format, not with a
1790 * binary copy. For use during an override of Delegate::WriteHostObject. 1807 * binary copy. For use during an override of Delegate::WriteHostObject.
1791 */ 1808 */
1792 void WriteUint32(uint32_t value); 1809 void WriteUint32(uint32_t value);
1793 void WriteUint64(uint64_t value); 1810 void WriteUint64(uint64_t value);
1794 void WriteDouble(double value); 1811 void WriteDouble(double value);
1795 void WriteRawBytes(const void* source, size_t length); 1812 void WriteRawBytes(const void* source, size_t length);
1796 1813
1797 private: 1814 private:
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
1856 1873
1857 /* 1874 /*
1858 * Similar to TransferArrayBuffer, but for SharedArrayBuffer. 1875 * Similar to TransferArrayBuffer, but for SharedArrayBuffer.
1859 * The id is not necessarily in the same namespace as unshared ArrayBuffer 1876 * The id is not necessarily in the same namespace as unshared ArrayBuffer
1860 * objects. 1877 * objects.
1861 */ 1878 */
1862 void TransferSharedArrayBuffer(uint32_t id, 1879 void TransferSharedArrayBuffer(uint32_t id,
1863 Local<SharedArrayBuffer> shared_array_buffer); 1880 Local<SharedArrayBuffer> shared_array_buffer);
1864 1881
1865 /* 1882 /*
1883 * Similar to TransferArrayBuffer, but for IDs obtained from
1884 * |GetLongStringId|.
1885 */
1886 void TransferLongString(uint32_t id, Local<String> string);
1887
1888 /*
1866 * Must be called before ReadHeader to enable support for reading the legacy 1889 * Must be called before ReadHeader to enable support for reading the legacy
1867 * wire format (i.e., which predates this being shipped). 1890 * wire format (i.e., which predates this being shipped).
1868 * 1891 *
1869 * Don't use this unless you need to read data written by previous versions of 1892 * Don't use this unless you need to read data written by previous versions of
1870 * blink::ScriptValueSerializer. 1893 * blink::ScriptValueSerializer.
1871 */ 1894 */
1872 void SetSupportsLegacyWireFormat(bool supports_legacy_wire_format); 1895 void SetSupportsLegacyWireFormat(bool supports_legacy_wire_format);
1873 1896
1874 /* 1897 /*
1875 * Expect inline wasm in the data stream (rather than in-memory transfer) 1898 * Expect inline wasm in the data stream (rather than in-memory transfer)
(...skipping 8011 matching lines...) Expand 10 before | Expand all | Expand 10 after
9887 */ 9910 */
9888 9911
9889 9912
9890 } // namespace v8 9913 } // namespace v8
9891 9914
9892 9915
9893 #undef TYPE_CHECK 9916 #undef TYPE_CHECK
9894 9917
9895 9918
9896 #endif // INCLUDE_V8_H_ 9919 #endif // INCLUDE_V8_H_
OLDNEW
« 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