| v8.h | | v8.h | |
| | | | |
| skipping to change at line 975 | | skipping to change at line 975 | |
| */ | | */ | |
| V8EXPORT int Utf8Length() const; | | V8EXPORT int Utf8Length() const; | |
| | | | |
| /** | | /** | |
| * Write the contents of the string to an external buffer. | | * Write the contents of the string to an external buffer. | |
| * If no arguments are given, expects the buffer to be large | | * If no arguments are given, expects the buffer to be large | |
| * enough to hold the entire string and NULL terminator. Copies | | * enough to hold the entire string and NULL terminator. Copies | |
| * the contents of the string and the NULL terminator into the | | * the contents of the string and the NULL terminator into the | |
| * buffer. | | * buffer. | |
| * | | * | |
|
| | | * WriteUtf8 will not write partial UTF-8 sequences, preferring to stop | |
| | | * before the end of the buffer. | |
| | | * | |
| * Copies up to length characters into the output buffer. | | * Copies up to length characters into the output buffer. | |
| * Only null-terminates if there is enough space in the buffer. | | * Only null-terminates if there is enough space in the buffer. | |
| * | | * | |
| * \param buffer The buffer into which the string will be copied. | | * \param buffer The buffer into which the string will be copied. | |
| * \param start The starting position within the string at which | | * \param start The starting position within the string at which | |
| * copying begins. | | * copying begins. | |
|
| * \param length The number of bytes to copy from the string. | | * \param length The number of characters to copy from the string. For | |
| | | * WriteUtf8 the number of bytes in the buffer. | |
| * \param nchars_ref The number of characters written, can be NULL. | | * \param nchars_ref The number of characters written, can be NULL. | |
| * \param hints Various hints that might affect performance of this or | | * \param hints Various hints that might affect performance of this or | |
| * subsequent operations. | | * subsequent operations. | |
|
| * \return The number of bytes copied to the buffer | | * \return The number of characters copied to the buffer excluding the nu | |
| * excluding the NULL terminator. | | ll | |
| | | * terminator. For WriteUtf8: The number of bytes copied to the buffe | |
| | | r | |
| | | * including the null terminator. | |
| */ | | */ | |
| enum WriteHints { | | enum WriteHints { | |
| NO_HINTS = 0, | | NO_HINTS = 0, | |
| HINT_MANY_WRITES_EXPECTED = 1 | | HINT_MANY_WRITES_EXPECTED = 1 | |
| }; | | }; | |
| | | | |
| V8EXPORT int Write(uint16_t* buffer, | | V8EXPORT int Write(uint16_t* buffer, | |
| int start = 0, | | int start = 0, | |
| int length = -1, | | int length = -1, | |
| WriteHints hints = NO_HINTS) const; // UTF-16 | | WriteHints hints = NO_HINTS) const; // UTF-16 | |
| | | | |
| skipping to change at line 3209 | | skipping to change at line 3214 | |
| /** Get preferred output encoding. Called only once. */ | | /** Get preferred output encoding. Called only once. */ | |
| virtual OutputEncoding GetOutputEncoding() { return kAscii; } | | virtual OutputEncoding GetOutputEncoding() { return kAscii; } | |
| /** | | /** | |
| * Writes the next chunk of snapshot data into the stream. Writing | | * Writes the next chunk of snapshot data into the stream. Writing | |
| * can be stopped by returning kAbort as function result. EndOfStream | | * can be stopped by returning kAbort as function result. EndOfStream | |
| * will not be called in case writing was aborted. | | * will not be called in case writing was aborted. | |
| */ | | */ | |
| virtual WriteResult WriteAsciiChunk(char* data, int size) = 0; | | virtual WriteResult WriteAsciiChunk(char* data, int size) = 0; | |
| }; | | }; | |
| | | | |
|
| | | /** | |
| | | * An interface for reporting progress and controlling long-running | |
| | | * activities. | |
| | | */ | |
| | | class V8EXPORT ActivityControl { // NOLINT | |
| | | public: | |
| | | enum ControlOption { | |
| | | kContinue = 0, | |
| | | kAbort = 1 | |
| | | }; | |
| | | virtual ~ActivityControl() {} | |
| | | /** | |
| | | * Notify about current progress. The activity can be stopped by | |
| | | * returning kAbort as the callback result. | |
| | | */ | |
| | | virtual ControlOption ReportProgressValue(int done, int total) = 0; | |
| | | }; | |
| | | | |
| // --- I m p l e m e n t a t i o n --- | | // --- I m p l e m e n t a t i o n --- | |
| | | | |
| namespace internal { | | namespace internal { | |
| | | | |
| static const int kApiPointerSize = sizeof(void*); // NOLINT | | static const int kApiPointerSize = sizeof(void*); // NOLINT | |
| static const int kApiIntSize = sizeof(int); // NOLINT | | static const int kApiIntSize = sizeof(int); // NOLINT | |
| | | | |
| // Tag information for HeapObject. | | // Tag information for HeapObject. | |
| const int kHeapObjectTag = 1; | | const int kHeapObjectTag = 1; | |
| const int kHeapObjectTagSize = 2; | | const int kHeapObjectTagSize = 2; | |
| | | | |
End of changes. 4 change blocks. |
| 3 lines changed or deleted | | 28 lines changed or added | |
|