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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 class RemoteDebuggerEvent; | 46 class RemoteDebuggerEvent; |
47 class ReceiverThread; | 47 class ReceiverThread; |
48 | 48 |
49 | 49 |
50 // Remote debugging class. | 50 // Remote debugging class. |
51 class RemoteDebugger { | 51 class RemoteDebugger { |
52 public: | 52 public: |
53 explicit RemoteDebugger(Isolate* isolate, int port) | 53 explicit RemoteDebugger(Isolate* isolate, int port) |
54 : isolate_(isolate), | 54 : isolate_(isolate), |
55 port_(port), | 55 port_(port), |
56 event_access_(i::OS::CreateMutex()), | |
57 event_available_(i::OS::CreateSemaphore(0)), | 56 event_available_(i::OS::CreateSemaphore(0)), |
58 head_(NULL), tail_(NULL) {} | 57 head_(NULL), tail_(NULL) {} |
59 void Run(); | 58 void Run(); |
60 | 59 |
61 // Handle events from the subordinate threads. | 60 // Handle events from the subordinate threads. |
62 void MessageReceived(i::SmartArrayPointer<char> message); | 61 void MessageReceived(i::SmartArrayPointer<char> message); |
63 void KeyboardCommand(i::SmartArrayPointer<char> command); | 62 void KeyboardCommand(i::SmartArrayPointer<char> command); |
64 void ConnectionClosed(); | 63 void ConnectionClosed(); |
65 | 64 |
66 private: | 65 private: |
(...skipping 10 matching lines...) Expand all Loading... |
77 // Get connection to agent in debugged V8. | 76 // Get connection to agent in debugged V8. |
78 i::Socket* conn() { return conn_; } | 77 i::Socket* conn() { return conn_; } |
79 | 78 |
80 Isolate* isolate_; | 79 Isolate* isolate_; |
81 int port_; // Port used to connect to debugger V8. | 80 int port_; // Port used to connect to debugger V8. |
82 i::Socket* conn_; // Connection to debugger agent in debugged V8. | 81 i::Socket* conn_; // Connection to debugger agent in debugged V8. |
83 | 82 |
84 // Linked list of events from debugged V8 and from keyboard input. Access to | 83 // Linked list of events from debugged V8 and from keyboard input. Access to |
85 // the list is guarded by a mutex and a semaphore signals new items in the | 84 // the list is guarded by a mutex and a semaphore signals new items in the |
86 // list. | 85 // list. |
87 i::Mutex* event_access_; | 86 i::Mutex event_access_; |
88 i::Semaphore* event_available_; | 87 i::Semaphore* event_available_; |
89 RemoteDebuggerEvent* head_; | 88 RemoteDebuggerEvent* head_; |
90 RemoteDebuggerEvent* tail_; | 89 RemoteDebuggerEvent* tail_; |
91 | 90 |
92 friend class ReceiverThread; | 91 friend class ReceiverThread; |
93 }; | 92 }; |
94 | 93 |
95 | 94 |
96 // Thread reading from debugged V8 instance. | 95 // Thread reading from debugged V8 instance. |
97 class ReceiverThread: public i::Thread { | 96 class ReceiverThread: public i::Thread { |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 RemoteDebuggerEvent* next_; | 146 RemoteDebuggerEvent* next_; |
148 | 147 |
149 friend class RemoteDebugger; | 148 friend class RemoteDebugger; |
150 }; | 149 }; |
151 | 150 |
152 | 151 |
153 } // namespace v8 | 152 } // namespace v8 |
154 | 153 |
155 | 154 |
156 #endif // V8_D8_DEBUG_H_ | 155 #endif // V8_D8_DEBUG_H_ |
OLD | NEW |