summaryrefslogtreecommitdiffstats
path: root/src/debug.h
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 /src/debug.h
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 'src/debug.h')
-rw-r--r--src/debug.h38
1 files changed, 35 insertions, 3 deletions
diff --git a/src/debug.h b/src/debug.h
index 24f0db41..5ea2e522 100644
--- a/src/debug.h
+++ b/src/debug.h
@@ -559,6 +559,9 @@ class CommandMessageQueue BASE_EMBEDDED {
};
+class MessageDispatchHelperThread;
+
+
// LockingCommandMessageQueue is a thread-safe circular buffer of CommandMessage
// messages. The message data is not managed by LockingCommandMessageQueue.
// Pointers to the data are passed in and out. Implemented by adding a
@@ -619,7 +622,8 @@ class Debugger {
static void SetHostDispatchHandler(v8::Debug::HostDispatchHandler handler,
int period);
static void SetDebugMessageDispatchHandler(
- v8::Debug::DebugMessageDispatchHandler handler);
+ v8::Debug::DebugMessageDispatchHandler handler,
+ bool provide_locker);
// Invoke the message handler function.
static void InvokeMessageHandler(MessageImpl message);
@@ -636,7 +640,8 @@ class Debugger {
bool* pending_exception);
// Start the debugger agent listening on the provided port.
- static bool StartAgent(const char* name, int port);
+ static bool StartAgent(const char* name, int port,
+ bool wait_for_connection = false);
// Stop the debugger agent.
static void StopAgent();
@@ -644,6 +649,8 @@ class Debugger {
// Blocks until the agent has started listening for connections
static void WaitForAgent();
+ static void CallMessageDispatchHandler();
+
// Unload the debugger if possible. Only called when no debugger is currently
// active.
static void UnloadDebugger();
@@ -653,7 +660,9 @@ class Debugger {
// Check whether the message handler was been cleared.
if (debugger_unload_pending_) {
- UnloadDebugger();
+ if (Debug::debugger_entry() == NULL) {
+ UnloadDebugger();
+ }
}
// Currently argument event is not used.
@@ -680,7 +689,9 @@ class Debugger {
static v8::Debug::MessageHandler2 message_handler_;
static bool debugger_unload_pending_; // Was message handler cleared?
static v8::Debug::HostDispatchHandler host_dispatch_handler_;
+ static Mutex* dispatch_handler_access_; // Mutex guarding dispatch handler.
static v8::Debug::DebugMessageDispatchHandler debug_message_dispatch_handler_;
+ static MessageDispatchHelperThread* message_dispatch_helper_thread_;
static int host_dispatch_micros_;
static DebuggerAgent* agent_;
@@ -857,6 +868,27 @@ class Debug_Address {
int reg_;
};
+// The optional thread that Debug Agent may use to temporary call V8 to process
+// pending debug requests if debuggee is not running V8 at the moment.
+// Techincally it does not call V8 itself, rather it asks embedding program
+// to do this via v8::Debug::HostDispatchHandler
+class MessageDispatchHelperThread: public Thread {
+ public:
+ MessageDispatchHelperThread();
+ ~MessageDispatchHelperThread();
+
+ void Schedule();
+
+ private:
+ void Run();
+
+ Semaphore* const sem_;
+ Mutex* const mutex_;
+ bool already_signalled_;
+
+ DISALLOW_COPY_AND_ASSIGN(MessageDispatchHelperThread);
+};
+
} } // namespace v8::internal