diff options
author | Leon Clarke <leonclarke@google.com> | 2010-06-03 12:02:55 +0100 |
---|---|---|
committer | Leon Clarke <leonclarke@google.com> | 2010-06-03 12:05:35 +0100 |
commit | f7060e27768c550ace7ec48ad8c093466db52dfa (patch) | |
tree | 43a297e3fcc3fd81c7637fcbe8b31b3d02fd337d /include | |
parent | f4f2cc060fdf724f592c425cced19bc9a3fc7e40 (diff) | |
download | android_external_v8-f7060e27768c550ace7ec48ad8c093466db52dfa.tar.gz android_external_v8-f7060e27768c550ace7ec48ad8c093466db52dfa.tar.bz2 android_external_v8-f7060e27768c550ace7ec48ad8c093466db52dfa.zip |
Update V8 to r4730 as required by WebKit r60469
Diffstat (limited to 'include')
-rw-r--r-- | include/v8-debug.h | 48 | ||||
-rw-r--r-- | include/v8-profiler.h | 25 | ||||
-rw-r--r-- | include/v8.h | 114 |
3 files changed, 144 insertions, 43 deletions
diff --git a/include/v8-debug.h b/include/v8-debug.h index f7b4fa12..c53b6346 100644 --- a/include/v8-debug.h +++ b/include/v8-debug.h @@ -144,6 +144,39 @@ class EXPORT Debug { /** + * An event details object passed to the debug event listener. + */ + class EventDetails { + public: + /** + * Event type. + */ + virtual DebugEvent GetEvent() const = 0; + + /** + * Access to execution state and event data of the debug event. Don't store + * these cross callbacks as their content becomes invalid. + */ + virtual Handle<Object> GetExecutionState() const = 0; + virtual Handle<Object> GetEventData() const = 0; + + /** + * Get the context active when the debug event happened. Note this is not + * the current active context as the JavaScript part of the debugger is + * running in it's own context which is entered at this point. + */ + virtual Handle<Context> GetEventContext() const = 0; + + /** + * Client data passed with the corresponding callbak whet it was registered. + */ + virtual Handle<Value> GetCallbackData() const = 0; + + virtual ~EventDetails() {} + }; + + + /** * Debug event callback function. * * \param event the type of the debug event that triggered the callback @@ -157,6 +190,15 @@ class EXPORT Debug { Handle<Object> event_data, Handle<Value> data); + /** + * Debug event callback function. + * + * \param event_details object providing information about the debug event + * + * A EventCallback2 does not take possession of the event data, + * and must not rely on the data persisting after the handler returns. + */ + typedef void (*EventCallback2)(const EventDetails& event_details); /** * Debug message callback function. @@ -165,7 +207,7 @@ class EXPORT Debug { * \param length length of the message * \param client_data the data value passed when registering the message handler - * A MessageHandler does not take posession of the message string, + * A MessageHandler does not take possession of the message string, * and must not rely on the data persisting after the handler returns. * * This message handler is deprecated. Use MessageHandler2 instead. @@ -178,7 +220,7 @@ class EXPORT Debug { * * \param message the debug message handler message object - * A MessageHandler does not take posession of the message data, + * A MessageHandler does not take possession of the message data, * and must not rely on the data persisting after the handler returns. */ typedef void (*MessageHandler2)(const Message& message); @@ -196,6 +238,8 @@ class EXPORT Debug { // Set a C debug event listener. static bool SetDebugEventListener(EventCallback that, Handle<Value> data = Handle<Value>()); + static bool SetDebugEventListener2(EventCallback2 that, + Handle<Value> data = Handle<Value>()); // Set a JavaScript debug event listener. static bool SetDebugEventListener(v8::Handle<v8::Object> that, diff --git a/include/v8-profiler.h b/include/v8-profiler.h index f1b8ffbb..bb410722 100644 --- a/include/v8-profiler.h +++ b/include/v8-profiler.h @@ -140,22 +140,37 @@ class V8EXPORT CpuProfile { class V8EXPORT CpuProfiler { public: /** + * A note on security tokens usage. As scripts from different + * origins can run inside a single V8 instance, it is possible to + * have functions from different security contexts intermixed in a + * single CPU profile. To avoid exposing function names belonging to + * other contexts, filtering by security token is performed while + * obtaining profiling results. + */ + + /** * Returns the number of profiles collected (doesn't include * profiles that are being collected at the moment of call.) */ static int GetProfilesCount(); /** Returns a profile by index. */ - static const CpuProfile* GetProfile(int index); + static const CpuProfile* GetProfile( + int index, + Handle<Value> security_token = Handle<Value>()); /** Returns a profile by uid. */ - static const CpuProfile* FindProfile(unsigned uid); + static const CpuProfile* FindProfile( + unsigned uid, + Handle<Value> security_token = Handle<Value>()); /** * Starts collecting CPU profile. Title may be an empty string. It * is allowed to have several profiles being collected at * once. Attempts to start collecting several profiles with the same - * title are silently ignored. + * title are silently ignored. While collecting a profile, functions + * from all security contexts are included in it. The token-based + * filtering is only performed when querying for a profile. */ static void StartProfiling(Handle<String> title); @@ -163,7 +178,9 @@ class V8EXPORT CpuProfiler { * Stops collecting CPU profile with a given title and returns it. * If the title given is empty, finishes the last profile started. */ - static const CpuProfile* StopProfiling(Handle<String> title); + static const CpuProfile* StopProfiling( + Handle<String> title, + Handle<Value> security_token = Handle<Value>()); }; diff --git a/include/v8.h b/include/v8.h index eb12de80..5b5dabe3 100644 --- a/include/v8.h +++ b/include/v8.h @@ -126,6 +126,7 @@ template <class T> class Persistent; class FunctionTemplate; class ObjectTemplate; class Data; +class AccessorInfo; class StackTrace; class StackFrame; @@ -512,11 +513,37 @@ class V8EXPORT Data { class V8EXPORT ScriptData { // NOLINT public: virtual ~ScriptData() { } + /** + * Pre-compiles the specified script (context-independent). + * + * \param input Pointer to UTF-8 script source code. + * \param length Length of UTF-8 script source code. + */ static ScriptData* PreCompile(const char* input, int length); - static ScriptData* New(unsigned* data, int length); + /** + * Load previous pre-compilation data. + * + * \param data Pointer to data returned by a call to Data() of a previous + * ScriptData. Ownership is not transferred. + * \param length Length of data. + */ + static ScriptData* New(const char* data, int length); + + /** + * Returns the length of Data(). + */ virtual int Length() = 0; - virtual unsigned* Data() = 0; + + /** + * Returns a serialized representation of this ScriptData that can later be + * passed to New(). NOTE: Serialized data is platform-dependent. + */ + virtual const char* Data() = 0; + + /** + * Returns true if the source code could not be parsed. + */ virtual bool HasError() = 0; }; @@ -1306,6 +1333,41 @@ enum ExternalArrayType { }; /** + * Accessor[Getter|Setter] are used as callback functions when + * setting|getting a particular property. See Object and ObjectTemplate's + * method SetAccessor. + */ +typedef Handle<Value> (*AccessorGetter)(Local<String> property, + const AccessorInfo& info); + + +typedef void (*AccessorSetter)(Local<String> property, + Local<Value> value, + const AccessorInfo& info); + + +/** + * Access control specifications. + * + * Some accessors should be accessible across contexts. These + * accessors have an explicit access control parameter which specifies + * the kind of cross-context access that should be allowed. + * + * Additionally, for security, accessors can prohibit overwriting by + * accessors defined in JavaScript. For objects that have such + * accessors either locally or in their prototype chain it is not + * possible to overwrite the accessor by using __defineGetter__ or + * __defineSetter__ from JavaScript code. + */ +enum AccessControl { + DEFAULT = 0, + ALL_CAN_READ = 1, + ALL_CAN_WRITE = 1 << 1, + PROHIBITS_OVERWRITING = 1 << 2 +}; + + +/** * A JavaScript object (ECMA-262, 4.3.3) */ class V8EXPORT Object : public Value { @@ -1347,6 +1409,13 @@ class V8EXPORT Object : public Value { bool Delete(uint32_t index); + bool SetAccessor(Handle<String> name, + AccessorGetter getter, + AccessorSetter setter = 0, + Handle<Value> data = Handle<Value>(), + AccessControl settings = DEFAULT, + PropertyAttribute attribute = None); + /** * Returns an array containing the names of the enumerable properties * of this object, including properties from prototype objects. The @@ -1642,19 +1711,6 @@ typedef Handle<Value> (*InvocationCallback)(const Arguments& args); typedef int (*LookupCallback)(Local<Object> self, Local<String> name); /** - * Accessor[Getter|Setter] are used as callback functions when - * setting|getting a particular property. See objectTemplate::SetAccessor. - */ -typedef Handle<Value> (*AccessorGetter)(Local<String> property, - const AccessorInfo& info); - - -typedef void (*AccessorSetter)(Local<String> property, - Local<Value> value, - const AccessorInfo& info); - - -/** * NamedProperty[Getter|Setter] are used as interceptors on object. * See ObjectTemplate::SetNamedPropertyHandler. */ @@ -1734,27 +1790,6 @@ typedef Handle<Array> (*IndexedPropertyEnumerator)(const AccessorInfo& info); /** - * Access control specifications. - * - * Some accessors should be accessible across contexts. These - * accessors have an explicit access control parameter which specifies - * the kind of cross-context access that should be allowed. - * - * Additionally, for security, accessors can prohibit overwriting by - * accessors defined in JavaScript. For objects that have such - * accessors either locally or in their prototype chain it is not - * possible to overwrite the accessor by using __defineGetter__ or - * __defineSetter__ from JavaScript code. - */ -enum AccessControl { - DEFAULT = 0, - ALL_CAN_READ = 1, - ALL_CAN_WRITE = 1 << 1, - PROHIBITS_OVERWRITING = 1 << 2 -}; - - -/** * Access type specification. */ enum AccessType { @@ -2866,7 +2901,12 @@ class V8EXPORT Context { */ void ReattachGlobal(Handle<Object> global_object); - /** Creates a new context. */ + /** Creates a new context. + * + * Returns a persistent handle to the newly allocated context. This + * persistent handle has to be disposed when the context is no + * longer used so the context can be garbage collected. + */ static Persistent<Context> New( ExtensionConfiguration* extensions = NULL, Handle<ObjectTemplate> global_template = Handle<ObjectTemplate>(), |