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

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

Issue 23484014: Cleanup Socket class and remove it from the platform files. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Cleanup leftover junk, and rename test-sockets to test-socket. Created 7 years, 3 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/debug.cc ('k') | src/debug-agent.cc » ('j') | src/platform.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 19 matching lines...) Expand all
30 30
31 #ifdef ENABLE_DEBUGGER_SUPPORT 31 #ifdef ENABLE_DEBUGGER_SUPPORT
32 #include "../include/v8-debug.h" 32 #include "../include/v8-debug.h"
33 #include "platform.h" 33 #include "platform.h"
34 34
35 namespace v8 { 35 namespace v8 {
36 namespace internal { 36 namespace internal {
37 37
38 // Forward decelrations. 38 // Forward decelrations.
39 class DebuggerAgentSession; 39 class DebuggerAgentSession;
40 class Socket;
40 41
41 42
42 // Debugger agent which starts a socket listener on the debugger port and 43 // Debugger agent which starts a socket listener on the debugger port and
43 // handles connection from a remote debugger. 44 // handles connection from a remote debugger.
44 class DebuggerAgent: public Thread { 45 class DebuggerAgent: public Thread {
45 public: 46 public:
46 DebuggerAgent(Isolate* isolate, const char* name, int port) 47 DebuggerAgent(Isolate* isolate, const char* name, int port);
47 : Thread(name), 48 ~DebuggerAgent();
48 isolate_(isolate),
49 name_(StrDup(name)), port_(port),
50 server_(OS::CreateSocket()), terminate_(false),
51 session_(NULL),
52 terminate_now_(0),
53 listening_(0) {
54 ASSERT(isolate_->debugger_agent_instance() == NULL);
55 isolate_->set_debugger_agent_instance(this);
56 }
57 ~DebuggerAgent() {
58 isolate_->set_debugger_agent_instance(NULL);
59 delete server_;
60 }
61 49
62 void Shutdown(); 50 void Shutdown();
63 void WaitUntilListening(); 51 void WaitUntilListening();
64 52
65 Isolate* isolate() { return isolate_; } 53 Isolate* isolate() { return isolate_; }
66 54
67 private: 55 private:
68 void Run(); 56 void Run();
69 void CreateSession(Socket* socket); 57 void CreateSession(Socket* socket);
70 void DebuggerMessage(const v8::Debug::Message& message); 58 void DebuggerMessage(const v8::Debug::Message& message);
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 97
110 DISALLOW_COPY_AND_ASSIGN(DebuggerAgentSession); 98 DISALLOW_COPY_AND_ASSIGN(DebuggerAgentSession);
111 }; 99 };
112 100
113 101
114 // Utility methods factored out to be used by the D8 shell as well. 102 // Utility methods factored out to be used by the D8 shell as well.
115 class DebuggerAgentUtil { 103 class DebuggerAgentUtil {
116 public: 104 public:
117 static const char* const kContentLength; 105 static const char* const kContentLength;
118 106
119 static SmartArrayPointer<char> ReceiveMessage(const Socket* conn); 107 static SmartArrayPointer<char> ReceiveMessage(Socket* conn);
120 static bool SendConnectMessage(const Socket* conn, 108 static bool SendConnectMessage(Socket* conn, const char* embedding_host);
121 const char* embedding_host); 109 static bool SendMessage(Socket* conn, const Vector<uint16_t> message);
122 static bool SendMessage(const Socket* conn, const Vector<uint16_t> message); 110 static bool SendMessage(Socket* conn, const v8::Handle<v8::String> message);
123 static bool SendMessage(const Socket* conn, 111 static int ReceiveAll(Socket* conn, char* data, int len);
124 const v8::Handle<v8::String> message);
125 static int ReceiveAll(const Socket* conn, char* data, int len);
126 }; 112 };
127 113
128 } } // namespace v8::internal 114 } } // namespace v8::internal
129 115
130 #endif // ENABLE_DEBUGGER_SUPPORT 116 #endif // ENABLE_DEBUGGER_SUPPORT
131 117
132 #endif // V8_DEBUG_AGENT_H_ 118 #endif // V8_DEBUG_AGENT_H_
OLDNEW
« no previous file with comments | « src/debug.cc ('k') | src/debug-agent.cc » ('j') | src/platform.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698