OLD | NEW |
1 // Copyright 2008 the V8 project authors. All rights reserved. | 1 // Copyright 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 class RemoteDebugger { | 54 class RemoteDebugger { |
55 public: | 55 public: |
56 explicit RemoteDebugger(int port) | 56 explicit RemoteDebugger(int port) |
57 : port_(port), | 57 : port_(port), |
58 event_access_(i::OS::CreateMutex()), | 58 event_access_(i::OS::CreateMutex()), |
59 event_available_(i::OS::CreateSemaphore(0)), | 59 event_available_(i::OS::CreateSemaphore(0)), |
60 head_(NULL), tail_(NULL) {} | 60 head_(NULL), tail_(NULL) {} |
61 void Run(); | 61 void Run(); |
62 | 62 |
63 // Handle events from the subordinate threads. | 63 // Handle events from the subordinate threads. |
64 void MessageReceived(i::SmartPointer<char> message); | 64 void MessageReceived(i::SmartArrayPointer<char> message); |
65 void KeyboardCommand(i::SmartPointer<char> command); | 65 void KeyboardCommand(i::SmartArrayPointer<char> command); |
66 void ConnectionClosed(); | 66 void ConnectionClosed(); |
67 | 67 |
68 private: | 68 private: |
69 // Add new debugger event to the list. | 69 // Add new debugger event to the list. |
70 void AddEvent(RemoteDebuggerEvent* event); | 70 void AddEvent(RemoteDebuggerEvent* event); |
71 // Read next debugger event from the list. | 71 // Read next debugger event from the list. |
72 RemoteDebuggerEvent* GetEvent(); | 72 RemoteDebuggerEvent* GetEvent(); |
73 | 73 |
74 // Handle a message from the debugged V8. | 74 // Handle a message from the debugged V8. |
75 void HandleMessageReceived(char* message); | 75 void HandleMessageReceived(char* message); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 void Run(); | 120 void Run(); |
121 | 121 |
122 private: | 122 private: |
123 RemoteDebugger* remote_debugger_; | 123 RemoteDebugger* remote_debugger_; |
124 }; | 124 }; |
125 | 125 |
126 | 126 |
127 // Events processed by the main deubgger thread. | 127 // Events processed by the main deubgger thread. |
128 class RemoteDebuggerEvent { | 128 class RemoteDebuggerEvent { |
129 public: | 129 public: |
130 RemoteDebuggerEvent(int type, i::SmartPointer<char> data) | 130 RemoteDebuggerEvent(int type, i::SmartArrayPointer<char> data) |
131 : type_(type), data_(data), next_(NULL) { | 131 : type_(type), data_(data), next_(NULL) { |
132 ASSERT(type == kMessage || type == kKeyboard || type == kDisconnect); | 132 ASSERT(type == kMessage || type == kKeyboard || type == kDisconnect); |
133 } | 133 } |
134 | 134 |
135 static const int kMessage = 1; | 135 static const int kMessage = 1; |
136 static const int kKeyboard = 2; | 136 static const int kKeyboard = 2; |
137 static const int kDisconnect = 3; | 137 static const int kDisconnect = 3; |
138 | 138 |
139 int type() { return type_; } | 139 int type() { return type_; } |
140 char* data() { return *data_; } | 140 char* data() { return *data_; } |
141 | 141 |
142 private: | 142 private: |
143 void set_next(RemoteDebuggerEvent* event) { next_ = event; } | 143 void set_next(RemoteDebuggerEvent* event) { next_ = event; } |
144 RemoteDebuggerEvent* next() { return next_; } | 144 RemoteDebuggerEvent* next() { return next_; } |
145 | 145 |
146 int type_; | 146 int type_; |
147 i::SmartPointer<char> data_; | 147 i::SmartArrayPointer<char> data_; |
148 RemoteDebuggerEvent* next_; | 148 RemoteDebuggerEvent* next_; |
149 | 149 |
150 friend class RemoteDebugger; | 150 friend class RemoteDebugger; |
151 }; | 151 }; |
152 | 152 |
153 | 153 |
154 } // namespace v8 | 154 } // namespace v8 |
155 | 155 |
156 | 156 |
157 #endif // V8_D8_DEBUG_H_ | 157 #endif // V8_D8_DEBUG_H_ |
OLD | NEW |