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

Side by Side Diff: include/v8.h

Issue 2492943002: ValueSerializer: Replace use of std::vector with a delegate-allocated buffer. (Closed)
Patch Set: correct comment Created 4 years, 1 month 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 1693 matching lines...) Expand 10 before | Expand all | Expand 10 after
1704 * type. 1704 * type.
1705 */ 1705 */
1706 virtual void ThrowDataCloneError(Local<String> message) = 0; 1706 virtual void ThrowDataCloneError(Local<String> message) = 0;
1707 1707
1708 /* 1708 /*
1709 * The embedder overrides this method to write some kind of host object, if 1709 * The embedder overrides this method to write some kind of host object, if
1710 * possible. If not, a suitable exception should be thrown and 1710 * possible. If not, a suitable exception should be thrown and
1711 * Nothing<bool>() returned. 1711 * Nothing<bool>() returned.
1712 */ 1712 */
1713 virtual Maybe<bool> WriteHostObject(Isolate* isolate, Local<Object> object); 1713 virtual Maybe<bool> WriteHostObject(Isolate* isolate, Local<Object> object);
1714
1715 /*
1716 * 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
1718 * buffer has been allocated yet, nullptr will be provided.
1719 */
1720 virtual void* ReallocateBufferMemory(void* old_buffer, size_t size,
1721 size_t* actual_size);
1722
1723 /*
1724 * Frees a buffer allocated with |ReallocateBufferMemory|.
1725 */
1726 virtual void FreeBufferMemory(void* buffer);
1714 }; 1727 };
1715 1728
1716 explicit ValueSerializer(Isolate* isolate); 1729 explicit ValueSerializer(Isolate* isolate);
1717 ValueSerializer(Isolate* isolate, Delegate* delegate); 1730 ValueSerializer(Isolate* isolate, Delegate* delegate);
1718 ~ValueSerializer(); 1731 ~ValueSerializer();
1719 1732
1720 /* 1733 /*
1721 * Writes out a header, which includes the format version. 1734 * Writes out a header, which includes the format version.
1722 */ 1735 */
1723 void WriteHeader(); 1736 void WriteHeader();
1724 1737
1725 /* 1738 /*
1726 * Serializes a JavaScript value into the buffer. 1739 * Serializes a JavaScript value into the buffer.
1727 */ 1740 */
1728 V8_WARN_UNUSED_RESULT Maybe<bool> WriteValue(Local<Context> context, 1741 V8_WARN_UNUSED_RESULT Maybe<bool> WriteValue(Local<Context> context,
1729 Local<Value> value); 1742 Local<Value> value);
1730 1743
1731 /* 1744 /*
1732 * Returns the stored data. This serializer should not be used once the buffer 1745 * Returns the stored data. This serializer should not be used once the buffer
1733 * is released. The contents are undefined if a previous write has failed. 1746 * is released. The contents are undefined if a previous write has failed.
1734 */ 1747 */
1735 std::vector<uint8_t> ReleaseBuffer(); 1748 V8_DEPRECATE_SOON("Use Release()", std::vector<uint8_t> ReleaseBuffer());
1749
1750 /*
1751 * Returns the stored data (allocated using the delegate's
1752 * AllocateBufferMemory) and its size. This serializer should not be used once
1753 * the buffer is released. The contents are undefined if a previous write has
1754 * failed.
1755 */
1756 V8_WARN_UNUSED_RESULT std::pair<uint8_t*, size_t> Release();
1736 1757
1737 /* 1758 /*
1738 * Marks an ArrayBuffer as havings its contents transferred out of band. 1759 * Marks an ArrayBuffer as havings its contents transferred out of band.
1739 * Pass the corresponding JSArrayBuffer in the deserializing context to 1760 * Pass the corresponding JSArrayBuffer in the deserializing context to
1740 * ValueDeserializer::TransferArrayBuffer. 1761 * ValueDeserializer::TransferArrayBuffer.
1741 */ 1762 */
1742 void TransferArrayBuffer(uint32_t transfer_id, 1763 void TransferArrayBuffer(uint32_t transfer_id,
1743 Local<ArrayBuffer> array_buffer); 1764 Local<ArrayBuffer> array_buffer);
1744 1765
1745 /* 1766 /*
(...skipping 7922 matching lines...) Expand 10 before | Expand all | Expand 10 after
9668 */ 9689 */
9669 9690
9670 9691
9671 } // namespace v8 9692 } // namespace v8
9672 9693
9673 9694
9674 #undef TYPE_CHECK 9695 #undef TYPE_CHECK
9675 9696
9676 9697
9677 #endif // INCLUDE_V8_H_ 9698 #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