v8.h | v8.h | |||
---|---|---|---|---|
skipping to change at line 822 | skipping to change at line 822 | |||
* Creates a new external string using the data defined in the given | * Creates a new external string using the data defined in the given | |||
* resource. The resource is deleted when the external string is no | * resource. The resource is deleted when the external string is no | |||
* longer live on V8's heap. The caller of this function should not | * longer live on V8's heap. The caller of this function should not | |||
* delete or modify the resource. Neither should the underlying buffer be | * delete or modify the resource. Neither should the underlying buffer be | |||
* deallocated or modified except through the destructor of the | * deallocated or modified except through the destructor of the | |||
* external string resource. | * external string resource. | |||
*/ | */ | |||
static Local<String> NewExternal(ExternalStringResource* resource); | static Local<String> NewExternal(ExternalStringResource* resource); | |||
/** | /** | |||
* Associate an external string resource with this string by transforming | ||||
it | ||||
* in place so that existing references to this string in the JavaScript | ||||
heap | ||||
* will use the external string resource. The external string resource's | ||||
* character contents needs to be equivalent to this string. | ||||
* Returns true if the string has been changed to be an external string. | ||||
* The string is not modified if the operation fails. | ||||
*/ | ||||
bool MakeExternal(ExternalStringResource* resource); | ||||
/** | ||||
* Creates a new external string using the ascii data defined in the give n | * Creates a new external string using the ascii data defined in the give n | |||
* resource. The resource is deleted when the external string is no | * resource. The resource is deleted when the external string is no | |||
* longer live on V8's heap. The caller of this function should not | * longer live on V8's heap. The caller of this function should not | |||
* delete or modify the resource. Neither should the underlying buffer be | * delete or modify the resource. Neither should the underlying buffer be | |||
* deallocated or modified except through the destructor of the | * deallocated or modified except through the destructor of the | |||
* external string resource. | * external string resource. | |||
*/ | */ | |||
static Local<String> NewExternal(ExternalAsciiStringResource* resource); | static Local<String> NewExternal(ExternalAsciiStringResource* resource); | |||
/** | ||||
* Associate an external string resource with this string by transforming | ||||
it | ||||
* in place so that existing references to this string in the JavaScript | ||||
heap | ||||
* will use the external string resource. The external string resource's | ||||
* character contents needs to be equivalent to this string. | ||||
* Returns true if the string has been changed to be an external string. | ||||
* The string is not modified if the operation fails. | ||||
*/ | ||||
bool MakeExternal(ExternalAsciiStringResource* resource); | ||||
/** Creates an undetectable string from the supplied ascii or utf-8 data. */ | /** Creates an undetectable string from the supplied ascii or utf-8 data. */ | |||
static Local<String> NewUndetectable(const char* data, int length = -1); | static Local<String> NewUndetectable(const char* data, int length = -1); | |||
/** Creates an undetectable string from the supplied utf-16 data.*/ | /** Creates an undetectable string from the supplied utf-16 data.*/ | |||
static Local<String> NewUndetectable(const uint16_t* data, int length = - 1); | static Local<String> NewUndetectable(const uint16_t* data, int length = - 1); | |||
/** | /** | |||
* Converts an object to a utf8-encoded character array. Useful if | * Converts an object to a utf8-encoded character array. Useful if | |||
* you want to print the object. | * you want to print the object. | |||
*/ | */ | |||
class EXPORT Utf8Value { | class EXPORT Utf8Value { | |||
public: | public: | |||
explicit Utf8Value(Handle<v8::Value> obj); | explicit Utf8Value(Handle<v8::Value> obj); | |||
~Utf8Value(); | ~Utf8Value(); | |||
char* operator*() { return str_; } | char* operator*() const { return str_; } | |||
int length() { return length_; } | int length() { return length_; } | |||
private: | private: | |||
char* str_; | char* str_; | |||
int length_; | int length_; | |||
// Disallow copying and assigning. | // Disallow copying and assigning. | |||
Utf8Value(const Utf8Value&); | Utf8Value(const Utf8Value&); | |||
void operator=(const Utf8Value&); | void operator=(const Utf8Value&); | |||
}; | }; | |||
/** | /** | |||
* Converts an object to an ascii string. | * Converts an object to an ascii string. | |||
* Useful if you want to print the object. | * Useful if you want to print the object. | |||
*/ | */ | |||
class EXPORT AsciiValue { | class EXPORT AsciiValue { | |||
public: | public: | |||
explicit AsciiValue(Handle<v8::Value> obj); | explicit AsciiValue(Handle<v8::Value> obj); | |||
~AsciiValue(); | ~AsciiValue(); | |||
char* operator*() { return str_; } | char* operator*() const { return str_; } | |||
int length() { return length_; } | int length() { return length_; } | |||
private: | private: | |||
char* str_; | char* str_; | |||
int length_; | int length_; | |||
// Disallow copying and assigning. | // Disallow copying and assigning. | |||
AsciiValue(const AsciiValue&); | AsciiValue(const AsciiValue&); | |||
void operator=(const AsciiValue&); | void operator=(const AsciiValue&); | |||
}; | }; | |||
/** | /** | |||
* Converts an object to a two-byte string. | * Converts an object to a two-byte string. | |||
*/ | */ | |||
class EXPORT Value { | class EXPORT Value { | |||
public: | public: | |||
explicit Value(Handle<v8::Value> obj); | explicit Value(Handle<v8::Value> obj); | |||
~Value(); | ~Value(); | |||
uint16_t* operator*() { return str_; } | uint16_t* operator*() const { return str_; } | |||
int length() { return length_; } | int length() { return length_; } | |||
private: | private: | |||
uint16_t* str_; | uint16_t* str_; | |||
int length_; | int length_; | |||
// Disallow copying and assigning. | // Disallow copying and assigning. | |||
Value(const Value&); | Value(const Value&); | |||
void operator=(const Value&); | void operator=(const Value&); | |||
}; | }; | |||
}; | }; | |||
skipping to change at line 1749 | skipping to change at line 1769 | |||
/** | /** | |||
* Applications can register a callback function which is called | * Applications can register a callback function which is called | |||
* before and after a major garbage collection. Allocations are not | * before and after a major garbage collection. Allocations are not | |||
* allowed in the callback function, you therefore cannot manipulate | * allowed in the callback function, you therefore cannot manipulate | |||
* objects (set or delete properties for example) since it is possible | * objects (set or delete properties for example) since it is possible | |||
* such operations will result in the allocation of objects. | * such operations will result in the allocation of objects. | |||
*/ | */ | |||
typedef void (*GCCallback)(); | typedef void (*GCCallback)(); | |||
// --- E x t e r n a l S y m b o l C a l l b a c k --- | ||||
/** | ||||
* Callback used to allocate certain V8 symbols as external strings. | ||||
* | ||||
* The data passed to the callback is utf8 encoded. | ||||
* | ||||
* Allocations are not allowed in the callback function, you therefore | ||||
* cannot manipulate objects (set or delete properties for example) | ||||
* since it is possible such operations will result in the allocation | ||||
* of objects. | ||||
*/ | ||||
typedef String::ExternalStringResource* (*ExternalSymbolCallback)( | ||||
const char* utf8, | ||||
size_t length); | ||||
// --- C o n t e x t G e n e r a t o r --- | // --- C o n t e x t G e n e r a t o r --- | |||
/** | /** | |||
* Applications must provide a callback function which is called to generat e | * Applications must provide a callback function which is called to generat e | |||
* a context if a context was not deserialized from the snapshot. | * a context if a context was not deserialized from the snapshot. | |||
*/ | */ | |||
typedef Persistent<Context> (*ContextGenerator)(); | typedef Persistent<Context> (*ContextGenerator)(); | |||
/** | /** | |||
* Container class for static utility functions. | * Container class for static utility functions. | |||
skipping to change at line 1864 | skipping to change at line 1868 | |||
/** | /** | |||
* Enables the host application to receive a notification after a | * Enables the host application to receive a notification after a | |||
* major garbage collection. Allocations are not allowed in the | * major garbage collection. Allocations are not allowed in the | |||
* callback function, you therefore cannot manipulate objects (set | * callback function, you therefore cannot manipulate objects (set | |||
* or delete properties for example) since it is possible such | * or delete properties for example) since it is possible such | |||
* operations will result in the allocation of objects. | * operations will result in the allocation of objects. | |||
*/ | */ | |||
static void SetGlobalGCEpilogueCallback(GCCallback); | static void SetGlobalGCEpilogueCallback(GCCallback); | |||
/** | /** | |||
* Applications can register a callback that will be used when | ||||
* allocating most of the V8 symbols. The callback must return an | ||||
* external string resource that represents the symbols. | ||||
* | ||||
* Most often when performing a property lookup the key will be a | ||||
* symbol. Allocating symbols as external strings can reduce the | ||||
* amount of string conversions needed when using interceptors and | ||||
* accessors. | ||||
* | ||||
* \note This is an experimental feature and it might be removed. | ||||
*/ | ||||
static void SetExternalSymbolCallback(ExternalSymbolCallback); | ||||
/** | ||||
* Allows the host application to group objects together. If one | * Allows the host application to group objects together. If one | |||
* object in the group is alive, all objects in the group are alive. | * object in the group is alive, all objects in the group are alive. | |||
* After each garbage collection, object groups are removed. It is | * After each garbage collection, object groups are removed. It is | |||
* intended to be used in the before-garbage-collection callback | * intended to be used in the before-garbage-collection callback | |||
* function, for instance to simulate DOM tree connections among JS | * function, for instance to simulate DOM tree connections among JS | |||
* wrapper objects. | * wrapper objects. | |||
*/ | */ | |||
static void AddObjectGroup(Persistent<Value>* objects, size_t length); | static void AddObjectGroup(Persistent<Value>* objects, size_t length); | |||
/** | /** | |||
skipping to change at line 1909 | skipping to change at line 1899 | |||
* collections more often than otherwise in an attempt to garbage | * collections more often than otherwise in an attempt to garbage | |||
* collect the JavaScript objects keeping the externally allocated | * collect the JavaScript objects keeping the externally allocated | |||
* memory alive. | * memory alive. | |||
* | * | |||
* \param change_in_bytes the change in externally allocated memory | * \param change_in_bytes the change in externally allocated memory | |||
* that is kept alive by JavaScript objects. | * that is kept alive by JavaScript objects. | |||
* \returns the adjusted value. | * \returns the adjusted value. | |||
*/ | */ | |||
static int AdjustAmountOfExternalAllocatedMemory(int change_in_bytes); | static int AdjustAmountOfExternalAllocatedMemory(int change_in_bytes); | |||
/** | ||||
* Suspends recording of tick samples in the profiler. | ||||
* When the V8 profiling mode is enabled (usually via command line | ||||
* switches) this function suspends recording of tick samples. | ||||
* Profiling ticks are discarded until ResumeProfiler() is called. | ||||
* | ||||
* See also the --prof and --prof_auto command line switches to | ||||
* enable V8 profiling. | ||||
*/ | ||||
static void PauseProfiler(); | ||||
/** | ||||
* Resumes recording of tick samples in the profiler. | ||||
* See also PauseProfiler(). | ||||
*/ | ||||
static void ResumeProfiler(); | ||||
private: | private: | |||
V8(); | V8(); | |||
static void** GlobalizeReference(void** handle); | static void** GlobalizeReference(void** handle); | |||
static void DisposeGlobal(void** global_handle); | static void DisposeGlobal(void** global_handle); | |||
static void MakeWeak(void** global_handle, void* data, WeakReferenceCallb ack); | static void MakeWeak(void** global_handle, void* data, WeakReferenceCallb ack); | |||
static void ClearWeak(void** global_handle); | static void ClearWeak(void** global_handle); | |||
static bool IsGlobalNearDeath(void** global_handle); | static bool IsGlobalNearDeath(void** global_handle); | |||
static bool IsGlobalWeak(void** global_handle); | static bool IsGlobalWeak(void** global_handle); | |||
End of changes. 8 change blocks. | ||||
33 lines changed or deleted | 44 lines changed or added | |||