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