| v8.h | | v8.h | |
| | | | |
| skipping to change at line 2577 | | skipping to change at line 2577 | |
| Function(); | | Function(); | |
| static void CheckCast(Value* obj); | | static void CheckCast(Value* obj); | |
| }; | | }; | |
| | | | |
| /** | | /** | |
| * An instance of the built-in Promise constructor (ES6 draft). | | * An instance of the built-in Promise constructor (ES6 draft). | |
| * This API is experimental. Only works with --harmony flag. | | * This API is experimental. Only works with --harmony flag. | |
| */ | | */ | |
| class V8_EXPORT Promise : public Object { | | class V8_EXPORT Promise : public Object { | |
| public: | | public: | |
|
| /** | | class V8_EXPORT Resolver : public Object { | |
| * Create a new Promise in pending state. | | public: | |
| */ | | /** | |
| static Local<Promise> New(Isolate* isolate); | | * Create a new resolver, along with an associated promise in pending s | |
| | | tate. | |
| | | */ | |
| | | static Local<Resolver> New(Isolate* isolate); | |
| | | | |
|
| /** | | /** | |
| * Resolve/reject a promise with a given value. | | * Extract the associated promise. | |
| * Ignored if the promise is not unresolved. | | */ | |
| */ | | Local<Promise> GetPromise(); | |
| void Resolve(Handle<Value> value); | | | |
| void Reject(Handle<Value> value); | | /** | |
| | | * Resolve/reject the associated promise with a given value. | |
| | | * Ignored if the promise is no longer pending. | |
| | | */ | |
| | | void Resolve(Handle<Value> value); | |
| | | void Reject(Handle<Value> value); | |
| | | | |
| | | V8_INLINE static Resolver* Cast(Value* obj); | |
| | | | |
| | | private: | |
| | | Resolver(); | |
| | | static void CheckCast(Value* obj); | |
| | | }; | |
| | | | |
| /** | | /** | |
| * Register a resolution/rejection handler with a promise. | | * Register a resolution/rejection handler with a promise. | |
| * The handler is given the respective resolution/rejection value as | | * The handler is given the respective resolution/rejection value as | |
| * an argument. If the promise is already resolved/rejected, the handler
is | | * an argument. If the promise is already resolved/rejected, the handler
is | |
| * invoked at the end of turn. | | * invoked at the end of turn. | |
| */ | | */ | |
| Local<Promise> Chain(Handle<Function> handler); | | Local<Promise> Chain(Handle<Function> handler); | |
| Local<Promise> Catch(Handle<Function> handler); | | Local<Promise> Catch(Handle<Function> handler); | |
| | | | |
| | | | |
| skipping to change at line 4138 | | skipping to change at line 4152 | |
| | | | |
| typedef void (*GCPrologueCallback)(Isolate* isolate, | | typedef void (*GCPrologueCallback)(Isolate* isolate, | |
| GCType type, | | GCType type, | |
| GCCallbackFlags flags); | | GCCallbackFlags flags); | |
| typedef void (*GCEpilogueCallback)(Isolate* isolate, | | typedef void (*GCEpilogueCallback)(Isolate* isolate, | |
| GCType type, | | GCType type, | |
| GCCallbackFlags flags); | | GCCallbackFlags flags); | |
| | | | |
| /** | | /** | |
| * Enables the host application to receive a notification before a | | * Enables the host application to receive a notification before a | |
|
| * garbage collection. Allocations are not allowed in the | | * garbage collection. Allocations are allowed in the callback function, | |
| * callback function, you therefore cannot manipulate objects (set | | * but the callback is not re-entrant: if the allocation inside it will | |
| * or delete properties for example) since it is possible such | | * trigger the garbage collection, the callback won't be called again. | |
| * operations will result in the allocation of objects. It is possible | | * It is possible to specify the GCType filter for your callback. But it | |
| * to specify the GCType filter for your callback. But it is not possible | | is | |
| to | | * not possible to register the same callback function two times with | |
| * register the same callback function two times with different | | * different GCType filters. | |
| * GCType filters. | | | |
| */ | | */ | |
| void AddGCPrologueCallback( | | void AddGCPrologueCallback( | |
| GCPrologueCallback callback, GCType gc_type_filter = kGCTypeAll); | | GCPrologueCallback callback, GCType gc_type_filter = kGCTypeAll); | |
| | | | |
| /** | | /** | |
| * This function removes callback which was installed by | | * This function removes callback which was installed by | |
| * AddGCPrologueCallback function. | | * AddGCPrologueCallback function. | |
| */ | | */ | |
| void RemoveGCPrologueCallback(GCPrologueCallback callback); | | void RemoveGCPrologueCallback(GCPrologueCallback callback); | |
| | | | |
| /** | | /** | |
| * Enables the host application to receive a notification after a | | * Enables the host application to receive a notification after a | |
|
| * garbage collection. Allocations are not allowed in the | | * garbage collection. Allocations are allowed in the callback function, | |
| * callback function, you therefore cannot manipulate objects (set | | * but the callback is not re-entrant: if the allocation inside it will | |
| * or delete properties for example) since it is possible such | | * trigger the garbage collection, the callback won't be called again. | |
| * operations will result in the allocation of objects. It is possible | | * It is possible to specify the GCType filter for your callback. But it | |
| * to specify the GCType filter for your callback. But it is not possible | | is | |
| to | | * not possible to register the same callback function two times with | |
| * register the same callback function two times with different | | * different GCType filters. | |
| * GCType filters. | | | |
| */ | | */ | |
| void AddGCEpilogueCallback( | | void AddGCEpilogueCallback( | |
| GCEpilogueCallback callback, GCType gc_type_filter = kGCTypeAll); | | GCEpilogueCallback callback, GCType gc_type_filter = kGCTypeAll); | |
| | | | |
| /** | | /** | |
| * This function removes callback which was installed by | | * This function removes callback which was installed by | |
| * AddGCEpilogueCallback function. | | * AddGCEpilogueCallback function. | |
| */ | | */ | |
| void RemoveGCEpilogueCallback(GCEpilogueCallback callback); | | void RemoveGCEpilogueCallback(GCEpilogueCallback callback); | |
| | | | |
| | | | |
| skipping to change at line 5245 | | skipping to change at line 5257 | |
| bool top_level_; | | bool top_level_; | |
| internal::Isolate* isolate_; | | internal::Isolate* isolate_; | |
| | | | |
| static bool active_; | | static bool active_; | |
| | | | |
| // Disallow copying and assigning. | | // Disallow copying and assigning. | |
| Locker(const Locker&); | | Locker(const Locker&); | |
| void operator=(const Locker&); | | void operator=(const Locker&); | |
| }; | | }; | |
| | | | |
|
| /** | | | |
| * A struct for exporting HeapStats data from V8, using "push" model. | | | |
| */ | | | |
| struct HeapStatsUpdate; | | | |
| | | | |
| /** | | | |
| * An interface for exporting data from V8, using "push" model. | | | |
| */ | | | |
| class V8_EXPORT OutputStream { // NOLINT | | | |
| public: | | | |
| enum OutputEncoding { | | | |
| kAscii = 0 // 7-bit ASCII. | | | |
| }; | | | |
| enum WriteResult { | | | |
| kContinue = 0, | | | |
| kAbort = 1 | | | |
| }; | | | |
| virtual ~OutputStream() {} | | | |
| /** Notify about the end of stream. */ | | | |
| virtual void EndOfStream() = 0; | | | |
| /** Get preferred output chunk size. Called only once. */ | | | |
| virtual int GetChunkSize() { return 1024; } | | | |
| /** Get preferred output encoding. Called only once. */ | | | |
| virtual OutputEncoding GetOutputEncoding() { return kAscii; } | | | |
| /** | | | |
| * Writes the next chunk of snapshot data into the stream. Writing | | | |
| * can be stopped by returning kAbort as function result. EndOfStream | | | |
| * will not be called in case writing was aborted. | | | |
| */ | | | |
| virtual WriteResult WriteAsciiChunk(char* data, int size) = 0; | | | |
| /** | | | |
| * Writes the next chunk of heap stats data into the stream. Writing | | | |
| * can be stopped by returning kAbort as function result. EndOfStream | | | |
| * will not be called in case writing was aborted. | | | |
| */ | | | |
| virtual WriteResult WriteHeapStatsChunk(HeapStatsUpdate* data, int count) | | | |
| { | | | |
| return kAbort; | | | |
| }; | | | |
| }; | | | |
| | | | |
| /** | | | |
| * An interface for reporting progress and controlling long-running | | | |
| * activities. | | | |
| */ | | | |
| class V8_EXPORT 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; | | | |
| }; | | | |
| | | | |
| // --- Implementation --- | | // --- Implementation --- | |
| | | | |
| namespace internal { | | namespace internal { | |
| | | | |
| const int kApiPointerSize = sizeof(void*); // NOLINT | | const int kApiPointerSize = sizeof(void*); // NOLINT | |
| const int kApiIntSize = sizeof(int); // NOLINT | | 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; | |
| | | | |
| skipping to change at line 6135 | | skipping to change at line 6089 | |
| return static_cast<Array*>(value); | | return static_cast<Array*>(value); | |
| } | | } | |
| | | | |
| Promise* Promise::Cast(v8::Value* value) { | | Promise* Promise::Cast(v8::Value* value) { | |
| #ifdef V8_ENABLE_CHECKS | | #ifdef V8_ENABLE_CHECKS | |
| CheckCast(value); | | CheckCast(value); | |
| #endif | | #endif | |
| return static_cast<Promise*>(value); | | return static_cast<Promise*>(value); | |
| } | | } | |
| | | | |
|
| | | Promise::Resolver* Promise::Resolver::Cast(v8::Value* value) { | |
| | | #ifdef V8_ENABLE_CHECKS | |
| | | CheckCast(value); | |
| | | #endif | |
| | | return static_cast<Promise::Resolver*>(value); | |
| | | } | |
| | | | |
| ArrayBuffer* ArrayBuffer::Cast(v8::Value* value) { | | ArrayBuffer* ArrayBuffer::Cast(v8::Value* value) { | |
| #ifdef V8_ENABLE_CHECKS | | #ifdef V8_ENABLE_CHECKS | |
| CheckCast(value); | | CheckCast(value); | |
| #endif | | #endif | |
| return static_cast<ArrayBuffer*>(value); | | return static_cast<ArrayBuffer*>(value); | |
| } | | } | |
| | | | |
| ArrayBufferView* ArrayBufferView::Cast(v8::Value* value) { | | ArrayBufferView* ArrayBufferView::Cast(v8::Value* value) { | |
| #ifdef V8_ENABLE_CHECKS | | #ifdef V8_ENABLE_CHECKS | |
| CheckCast(value); | | CheckCast(value); | |
| | | | |
End of changes. 6 change blocks. |
| 85 lines changed or deleted | | 46 lines changed or added | |
|