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