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

Side by Side Diff: src/debug-agent.h

Issue 6070009: Added labelled thread names to help with some debugging activity. Right now,... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 26 matching lines...) Expand all
37 37
38 // Forward decelrations. 38 // Forward decelrations.
39 class DebuggerAgentSession; 39 class DebuggerAgentSession;
40 40
41 41
42 // Debugger agent which starts a socket listener on the debugger port and 42 // Debugger agent which starts a socket listener on the debugger port and
43 // handles connection from a remote debugger. 43 // handles connection from a remote debugger.
44 class DebuggerAgent: public Thread { 44 class DebuggerAgent: public Thread {
45 public: 45 public:
46 explicit DebuggerAgent(const char* name, int port) 46 explicit DebuggerAgent(const char* name, int port)
47 : name_(StrDup(name)), port_(port), 47 :
48 #ifdef DEBUG_THREAD_NAMES
49 Thread(name),
50 #endif
51 name_(StrDup(name)), port_(port),
48 server_(OS::CreateSocket()), terminate_(false), 52 server_(OS::CreateSocket()), terminate_(false),
49 session_access_(OS::CreateMutex()), session_(NULL), 53 session_access_(OS::CreateMutex()), session_(NULL),
50 terminate_now_(OS::CreateSemaphore(0)), 54 terminate_now_(OS::CreateSemaphore(0)),
51 listening_(OS::CreateSemaphore(0)) { 55 listening_(OS::CreateSemaphore(0)) {
52 ASSERT(instance_ == NULL); 56 ASSERT(instance_ == NULL);
53 instance_ = this; 57 instance_ = this;
54 } 58 }
55 ~DebuggerAgent() { 59 ~DebuggerAgent() {
56 instance_ = NULL; 60 instance_ = NULL;
57 delete server_; 61 delete server_;
(...skipping 25 matching lines...) Expand all
83 87
84 DISALLOW_COPY_AND_ASSIGN(DebuggerAgent); 88 DISALLOW_COPY_AND_ASSIGN(DebuggerAgent);
85 }; 89 };
86 90
87 91
88 // Debugger agent session. The session receives requests from the remote 92 // Debugger agent session. The session receives requests from the remote
89 // debugger and sends debugger events/responses to the remote debugger. 93 // debugger and sends debugger events/responses to the remote debugger.
90 class DebuggerAgentSession: public Thread { 94 class DebuggerAgentSession: public Thread {
91 public: 95 public:
92 DebuggerAgentSession(DebuggerAgent* agent, Socket* client) 96 DebuggerAgentSession(DebuggerAgent* agent, Socket* client)
93 : agent_(agent), client_(client) {} 97 :
98 #ifdef DEBUG_THREAD_NAMES
99 Thread("v8:DbgAgntSessn"),
100 #endif
101 agent_(agent), client_(client) {}
94 102
95 void DebuggerMessage(Vector<uint16_t> message); 103 void DebuggerMessage(Vector<uint16_t> message);
96 void Shutdown(); 104 void Shutdown();
97 105
98 private: 106 private:
99 void Run(); 107 void Run();
100 108
101 void DebuggerMessage(Vector<char> message); 109 void DebuggerMessage(Vector<char> message);
102 110
103 DebuggerAgent* agent_; 111 DebuggerAgent* agent_;
(...skipping 16 matching lines...) Expand all
120 static bool SendMessage(const Socket* conn, 128 static bool SendMessage(const Socket* conn,
121 const v8::Handle<v8::String> message); 129 const v8::Handle<v8::String> message);
122 static int ReceiveAll(const Socket* conn, char* data, int len); 130 static int ReceiveAll(const Socket* conn, char* data, int len);
123 }; 131 };
124 132
125 } } // namespace v8::internal 133 } } // namespace v8::internal
126 134
127 #endif // ENABLE_DEBUGGER_SUPPORT 135 #endif // ENABLE_DEBUGGER_SUPPORT
128 136
129 #endif // V8_DEBUG_AGENT_H_ 137 #endif // V8_DEBUG_AGENT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698