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

Unified Diff: src/debug-agent.h

Issue 50007: Better handling of startup and shutdown of the debugger agent (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years, 9 months 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.cc ('k') | src/debug-agent.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/debug-agent.h
===================================================================
--- src/debug-agent.h (revision 1545)
+++ src/debug-agent.h (working copy)
@@ -44,8 +44,9 @@
public:
explicit DebuggerAgent(int port)
: port_(port), server_(OS::CreateSocket()), terminate_(false),
- session_access_(OS::CreateMutex()), session_(NULL) {}
- ~DebuggerAgent() {}
+ session_access_(OS::CreateMutex()), session_(NULL),
+ terminate_now_(OS::CreateSemaphore(0)) {}
+ ~DebuggerAgent() { delete server_; }
void Shutdown();
@@ -53,13 +54,15 @@
void Run();
void CreateSession(Socket* socket);
void DebuggerMessage(const uint16_t* message, int length);
- void SessionClosed(DebuggerAgentSession* session);
+ void CloseSession();
+ void OnSessionClosed(DebuggerAgentSession* session);
int port_; // Port to use for the agent.
Socket* server_; // Server socket for listen/accept.
bool terminate_; // Termination flag.
Mutex* session_access_; // Mutex guarging access to session_.
DebuggerAgentSession* session_; // Current active session if any.
+ Semaphore* terminate_now_; // Semaphore to signal termination.
friend class DebuggerAgentSession;
friend void DebuggerAgentMessageHandler(const uint16_t* message, int length,
@@ -77,6 +80,7 @@
: agent_(agent), client_(client) {}
void DebuggerMessage(Vector<uint16_t> message);
+ void Shutdown();
private:
void Run();
@@ -84,7 +88,7 @@
void DebuggerMessage(Vector<char> message);
DebuggerAgent* agent_;
- const Socket* client_;
+ Socket* client_;
DISALLOW_COPY_AND_ASSIGN(DebuggerAgentSession);
};
« no previous file with comments | « src/debug.cc ('k') | src/debug-agent.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698