Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(949)

Unified Diff: src/debug.cc

Issue 491079: Reapply "wait for connection" feature implementation (Closed)
Patch Set: merge Created 11 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/debug.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/debug.cc
diff --git a/src/debug.cc b/src/debug.cc
index 2c4552effeabb5ab42abea5f91d97a9c7fe99329..fbe09391e27fabe4c9934adb79463a57288565ab 100644
--- a/src/debug.cc
+++ b/src/debug.cc
@@ -2483,7 +2483,24 @@ Handle<Object> Debugger::Call(Handle<JSFunction> fun,
}
-bool Debugger::StartAgent(const char* name, int port) {
+static void StubMessageHandler2(const v8::Debug::Message& message) {
+ // Simply ignore message.
+}
+
+
+bool Debugger::StartAgent(const char* name, int port,
+ bool wait_for_connection) {
+ if (wait_for_connection) {
+ // Suspend V8 if it is already running or set V8 to suspend whenever
+ // it starts.
+ // Provide stub message handler; V8 auto-continues each suspend
+ // when there is no message handler; we doesn't need it.
+ // Once become suspended, V8 will stay so indefinitely long, until remote
+ // debugger connects and issues "continue" command.
+ Debugger::message_handler_ = StubMessageHandler2;
+ v8::Debug::DebugBreak();
+ }
+
if (Socket::Setup()) {
agent_ = new DebuggerAgent(name, port);
agent_->Start();
« no previous file with comments | « src/debug.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698