summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorLeon Clarke <leonclarke@google.com>2010-01-19 14:06:41 +0000
committerLeon Clarke <leonclarke@google.com>2010-01-19 16:34:04 +0000
commite46be819fca9468a0cd4e74859ce0f778eb8ca60 (patch)
treef9c37105a3367f2ad5d31fbc2cb37b84fa67b59a /include
parentd0582a6c46733687d045e4188a1bcd0123c758a1 (diff)
downloadandroid_external_v8-e46be819fca9468a0cd4e74859ce0f778eb8ca60.tar.gz
android_external_v8-e46be819fca9468a0cd4e74859ce0f778eb8ca60.tar.bz2
android_external_v8-e46be819fca9468a0cd4e74859ce0f778eb8ca60.zip
New version of v8 from bleeding edge at revision 3649
Diffstat (limited to 'include')
-rw-r--r--include/v8-debug.h46
-rw-r--r--include/v8.h27
2 files changed, 61 insertions, 12 deletions
diff --git a/include/v8-debug.h b/include/v8-debug.h
index b27bacc1..2e5fb3fd 100644
--- a/include/v8-debug.h
+++ b/include/v8-debug.h
@@ -224,9 +224,11 @@ class EXPORT Debug {
* be processed. Note that debug messages will only be processed if there is
* a V8 break. This can happen automatically by using the option
* --debugger-auto-break.
+ * \param provide_locker requires that V8 acquires v8::Locker for you before
+ * calling handler
*/
static void SetDebugMessageDispatchHandler(
- DebugMessageDispatchHandler handler);
+ DebugMessageDispatchHandler handler, bool provide_locker = false);
/**
* Run a JavaScript function in the debugger.
@@ -258,8 +260,48 @@ class EXPORT Debug {
* supplied TCP/IP port for remote debugger connection.
* \param name the name of the embedding application
* \param port the TCP/IP port to listen on
+ * \param wait_for_connection whether V8 should pause on a first statement
+ * allowing remote debugger to connect before anything interesting happened
*/
- static bool EnableAgent(const char* name, int port);
+ static bool EnableAgent(const char* name, int port,
+ bool wait_for_connection = false);
+
+ /**
+ * Makes V8 process all pending debug messages.
+ *
+ * From V8 point of view all debug messages come asynchronously (e.g. from
+ * remote debugger) but they all must be handled synchronously: V8 cannot
+ * do 2 things at one time so normal script execution must be interrupted
+ * for a while.
+ *
+ * Generally when message arrives V8 may be in one of 3 states:
+ * 1. V8 is running script; V8 will automatically interrupt and process all
+ * pending messages (however auto_break flag should be enabled);
+ * 2. V8 is suspended on debug breakpoint; in this state V8 is dedicated
+ * to reading and processing debug messages;
+ * 3. V8 is not running at all or has called some long-working C++ function;
+ * by default it means that processing of all debug message will be deferred
+ * until V8 gets control again; however, embedding application may improve
+ * this by manually calling this method.
+ *
+ * It makes sense to call this method whenever a new debug message arrived and
+ * V8 is not already running. Method v8::Debug::SetDebugMessageDispatchHandler
+ * should help with the former condition.
+ *
+ * Technically this method in many senses is equivalent to executing empty
+ * script:
+ * 1. It does nothing except for processing all pending debug messages.
+ * 2. It should be invoked with the same precautions and from the same context
+ * as V8 script would be invoked from, because:
+ * a. with "evaluate" command it can do whatever normal script can do,
+ * including all native calls;
+ * b. no other thread should call V8 while this method is running
+ * (v8::Locker may be used here).
+ *
+ * "Evaluate" debug command behavior currently is not specified in scope
+ * of this method.
+ */
+ static void ProcessDebugMessages();
};
diff --git a/include/v8.h b/include/v8.h
index a8ee8d43..6125286e 100644
--- a/include/v8.h
+++ b/include/v8.h
@@ -503,6 +503,7 @@ class V8EXPORT ScriptData { // NOLINT
virtual int Length() = 0;
virtual unsigned* Data() = 0;
+ virtual bool HasError() = 0;
};
@@ -833,13 +834,26 @@ class V8EXPORT String : public Primitive {
* Returns true if the string is both external and ascii
*/
bool IsExternalAscii() const;
+
+ class V8EXPORT ExternalStringResourceBase {
+ public:
+ virtual ~ExternalStringResourceBase() {}
+ protected:
+ ExternalStringResourceBase() {}
+ private:
+ // Disallow copying and assigning.
+ ExternalStringResourceBase(const ExternalStringResourceBase&);
+ void operator=(const ExternalStringResourceBase&);
+ };
+
/**
* An ExternalStringResource is a wrapper around a two-byte string
* buffer that resides outside V8's heap. Implement an
* ExternalStringResource to manage the life cycle of the underlying
* buffer. Note that the string data must be immutable.
*/
- class V8EXPORT ExternalStringResource { // NOLINT
+ class V8EXPORT ExternalStringResource
+ : public ExternalStringResourceBase {
public:
/**
* Override the destructor to manage the life cycle of the underlying
@@ -852,10 +866,6 @@ class V8EXPORT String : public Primitive {
virtual size_t length() const = 0;
protected:
ExternalStringResource() {}
- private:
- // Disallow copying and assigning.
- ExternalStringResource(const ExternalStringResource&);
- void operator=(const ExternalStringResource&);
};
/**
@@ -869,7 +879,8 @@ class V8EXPORT String : public Primitive {
* Use String::New or convert to 16 bit data for non-ASCII.
*/
- class V8EXPORT ExternalAsciiStringResource { // NOLINT
+ class V8EXPORT ExternalAsciiStringResource
+ : public ExternalStringResourceBase {
public:
/**
* Override the destructor to manage the life cycle of the underlying
@@ -882,10 +893,6 @@ class V8EXPORT String : public Primitive {
virtual size_t length() const = 0;
protected:
ExternalAsciiStringResource() {}
- private:
- // Disallow copying and assigning.
- ExternalAsciiStringResource(const ExternalAsciiStringResource&);
- void operator=(const ExternalAsciiStringResource&);
};
/**