Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2008 the V8 project authors. All rights reserved. | 1 // Copyright 2008 the V8 project authors. All rights reserved. |
|
Jakob Kummerow
2012/01/19 16:23:13
nit: 2012
| |
| 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 |
| 11 // with the distribution. | 11 // with the distribution. |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 36 namespace v8 { | 36 namespace v8 { |
| 37 | 37 |
| 38 | 38 |
| 39 void HandleDebugEvent(DebugEvent event, | 39 void HandleDebugEvent(DebugEvent event, |
| 40 Handle<Object> exec_state, | 40 Handle<Object> exec_state, |
| 41 Handle<Object> event_data, | 41 Handle<Object> event_data, |
| 42 Handle<Value> data); | 42 Handle<Value> data); |
| 43 | 43 |
| 44 // Start the remove debugger connecting to a V8 debugger agent on the specified | 44 // Start the remove debugger connecting to a V8 debugger agent on the specified |
| 45 // port. | 45 // port. |
| 46 void RunRemoteDebugger(int port); | 46 void RunRemoteDebugger(int port, Handle<Context> context); |
| 47 | 47 |
| 48 // Forward declerations. | 48 // Forward declerations. |
| 49 class RemoteDebuggerEvent; | 49 class RemoteDebuggerEvent; |
| 50 class ReceiverThread; | 50 class ReceiverThread; |
| 51 | 51 |
| 52 | 52 |
| 53 // Remote debugging class. | 53 // Remote debugging class. |
| 54 class RemoteDebugger { | 54 class RemoteDebugger { |
| 55 public: | 55 public: |
| 56 explicit RemoteDebugger(int port) | 56 explicit RemoteDebugger(int port, Handle<Context> context) |
|
Jakob Kummerow
2012/01/19 16:23:13
nit: "explicit" is no longer necessary.
| |
| 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), |
| 61 tail_(NULL), | |
| 62 context_(context) {} | |
| 61 void Run(); | 63 void Run(); |
| 62 | 64 |
| 63 // Handle events from the subordinate threads. | 65 // Handle events from the subordinate threads. |
| 64 void MessageReceived(i::SmartArrayPointer<char> message); | 66 void MessageReceived(i::SmartArrayPointer<char> message); |
| 65 void KeyboardCommand(i::SmartArrayPointer<char> command); | 67 void KeyboardCommand(i::SmartArrayPointer<char> command); |
| 66 void ConnectionClosed(); | 68 void ConnectionClosed(); |
| 67 | 69 |
| 68 private: | 70 private: |
| 69 // Add new debugger event to the list. | 71 // Add new debugger event to the list. |
| 70 void AddEvent(RemoteDebuggerEvent* event); | 72 void AddEvent(RemoteDebuggerEvent* event); |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 82 int port_; // Port used to connect to debugger V8. | 84 int port_; // Port used to connect to debugger V8. |
| 83 i::Socket* conn_; // Connection to debugger agent in debugged V8. | 85 i::Socket* conn_; // Connection to debugger agent in debugged V8. |
| 84 | 86 |
| 85 // Linked list of events from debugged V8 and from keyboard input. Access to | 87 // Linked list of events from debugged V8 and from keyboard input. Access to |
| 86 // the list is guarded by a mutex and a semaphore signals new items in the | 88 // the list is guarded by a mutex and a semaphore signals new items in the |
| 87 // list. | 89 // list. |
| 88 i::Mutex* event_access_; | 90 i::Mutex* event_access_; |
| 89 i::Semaphore* event_available_; | 91 i::Semaphore* event_available_; |
| 90 RemoteDebuggerEvent* head_; | 92 RemoteDebuggerEvent* head_; |
| 91 RemoteDebuggerEvent* tail_; | 93 RemoteDebuggerEvent* tail_; |
| 94 Handle<Context> context_; | |
| 92 | 95 |
| 93 friend class ReceiverThread; | 96 friend class ReceiverThread; |
| 94 }; | 97 }; |
| 95 | 98 |
| 96 | 99 |
| 97 // Thread reading from debugged V8 instance. | 100 // Thread reading from debugged V8 instance. |
| 98 class ReceiverThread: public i::Thread { | 101 class ReceiverThread: public i::Thread { |
| 99 public: | 102 public: |
| 100 explicit ReceiverThread(RemoteDebugger* remote_debugger) | 103 explicit ReceiverThread(RemoteDebugger* remote_debugger) |
| 101 : Thread("d8:ReceiverThrd"), | 104 : Thread("d8:ReceiverThrd"), |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 148 RemoteDebuggerEvent* next_; | 151 RemoteDebuggerEvent* next_; |
| 149 | 152 |
| 150 friend class RemoteDebugger; | 153 friend class RemoteDebugger; |
| 151 }; | 154 }; |
| 152 | 155 |
| 153 | 156 |
| 154 } // namespace v8 | 157 } // namespace v8 |
| 155 | 158 |
| 156 | 159 |
| 157 #endif // V8_D8_DEBUG_H_ | 160 #endif // V8_D8_DEBUG_H_ |
| OLD | NEW |