Index: src/debug.h |
diff --git a/src/debug.h b/src/debug.h |
index fe9ff3596c405d003c722917d89ebf8f1d58c067..5ea2e522465494a457e6abc6f4a413ef2b8fdbb1 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); |
@@ -645,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(); |
@@ -683,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_; |
@@ -860,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 |