OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 802 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
813 void ProcessDebugEvent(v8::DebugEvent event, | 813 void ProcessDebugEvent(v8::DebugEvent event, |
814 Handle<JSObject> event_data, | 814 Handle<JSObject> event_data, |
815 bool auto_continue); | 815 bool auto_continue); |
816 void NotifyMessageHandler(v8::DebugEvent event, | 816 void NotifyMessageHandler(v8::DebugEvent event, |
817 Handle<JSObject> exec_state, | 817 Handle<JSObject> exec_state, |
818 Handle<JSObject> event_data, | 818 Handle<JSObject> event_data, |
819 bool auto_continue); | 819 bool auto_continue); |
820 void SetEventListener(Handle<Object> callback, Handle<Object> data); | 820 void SetEventListener(Handle<Object> callback, Handle<Object> data); |
821 void SetMessageHandler(v8::Debug::MessageHandler2 handler); | 821 void SetMessageHandler(v8::Debug::MessageHandler2 handler); |
822 void SetHostDispatchHandler(v8::Debug::HostDispatchHandler handler, | 822 void SetHostDispatchHandler(v8::Debug::HostDispatchHandler handler, |
823 int period); | 823 TimeDelta period); |
824 void SetDebugMessageDispatchHandler( | 824 void SetDebugMessageDispatchHandler( |
825 v8::Debug::DebugMessageDispatchHandler handler, | 825 v8::Debug::DebugMessageDispatchHandler handler, |
826 bool provide_locker); | 826 bool provide_locker); |
827 | 827 |
828 // Invoke the message handler function. | 828 // Invoke the message handler function. |
829 void InvokeMessageHandler(MessageImpl message); | 829 void InvokeMessageHandler(MessageImpl message); |
830 | 830 |
831 // Add a debugger command to the command queue. | 831 // Add a debugger command to the command queue. |
832 void ProcessCommand(Vector<const uint16_t> command, | 832 void ProcessCommand(Vector<const uint16_t> command, |
833 v8::Debug::ClientData* client_data = NULL); | 833 v8::Debug::ClientData* client_data = NULL); |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
924 bool is_loading_debugger_; // Are we loading the debugger? | 924 bool is_loading_debugger_; // Are we loading the debugger? |
925 bool live_edit_enabled_; // Enable LiveEdit. | 925 bool live_edit_enabled_; // Enable LiveEdit. |
926 bool never_unload_debugger_; // Can we unload the debugger? | 926 bool never_unload_debugger_; // Can we unload the debugger? |
927 bool force_debugger_active_; // Activate debugger without event listeners. | 927 bool force_debugger_active_; // Activate debugger without event listeners. |
928 v8::Debug::MessageHandler2 message_handler_; | 928 v8::Debug::MessageHandler2 message_handler_; |
929 bool debugger_unload_pending_; // Was message handler cleared? | 929 bool debugger_unload_pending_; // Was message handler cleared? |
930 v8::Debug::HostDispatchHandler host_dispatch_handler_; | 930 v8::Debug::HostDispatchHandler host_dispatch_handler_; |
931 Mutex dispatch_handler_access_; // Mutex guarding dispatch handler. | 931 Mutex dispatch_handler_access_; // Mutex guarding dispatch handler. |
932 v8::Debug::DebugMessageDispatchHandler debug_message_dispatch_handler_; | 932 v8::Debug::DebugMessageDispatchHandler debug_message_dispatch_handler_; |
933 MessageDispatchHelperThread* message_dispatch_helper_thread_; | 933 MessageDispatchHelperThread* message_dispatch_helper_thread_; |
934 int host_dispatch_micros_; | 934 TimeDelta host_dispatch_period_; |
935 | 935 |
936 DebuggerAgent* agent_; | 936 DebuggerAgent* agent_; |
937 | 937 |
938 static const int kQueueInitialSize = 4; | 938 static const int kQueueInitialSize = 4; |
939 LockingCommandMessageQueue command_queue_; | 939 LockingCommandMessageQueue command_queue_; |
940 Semaphore* command_received_; // Signaled for each command received. | 940 Semaphore command_received_; // Signaled for each command received. |
941 LockingCommandMessageQueue event_command_queue_; | 941 LockingCommandMessageQueue event_command_queue_; |
942 | 942 |
943 Isolate* isolate_; | 943 Isolate* isolate_; |
944 | 944 |
945 friend class EnterDebugger; | 945 friend class EnterDebugger; |
946 friend class Isolate; | 946 friend class Isolate; |
947 | 947 |
948 DISALLOW_COPY_AND_ASSIGN(Debugger); | 948 DISALLOW_COPY_AND_ASSIGN(Debugger); |
949 }; | 949 }; |
950 | 950 |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1039 Debug::AddressId id_; | 1039 Debug::AddressId id_; |
1040 }; | 1040 }; |
1041 | 1041 |
1042 // The optional thread that Debug Agent may use to temporary call V8 to process | 1042 // The optional thread that Debug Agent may use to temporary call V8 to process |
1043 // pending debug requests if debuggee is not running V8 at the moment. | 1043 // pending debug requests if debuggee is not running V8 at the moment. |
1044 // Techincally it does not call V8 itself, rather it asks embedding program | 1044 // Techincally it does not call V8 itself, rather it asks embedding program |
1045 // to do this via v8::Debug::HostDispatchHandler | 1045 // to do this via v8::Debug::HostDispatchHandler |
1046 class MessageDispatchHelperThread: public Thread { | 1046 class MessageDispatchHelperThread: public Thread { |
1047 public: | 1047 public: |
1048 explicit MessageDispatchHelperThread(Isolate* isolate); | 1048 explicit MessageDispatchHelperThread(Isolate* isolate); |
1049 ~MessageDispatchHelperThread(); | 1049 ~MessageDispatchHelperThread() {} |
1050 | 1050 |
1051 void Schedule(); | 1051 void Schedule(); |
1052 | 1052 |
1053 private: | 1053 private: |
1054 void Run(); | 1054 void Run(); |
1055 | 1055 |
1056 Isolate* isolate_; | 1056 Isolate* isolate_; |
1057 Semaphore* const sem_; | 1057 Semaphore sem_; |
1058 Mutex mutex_; | 1058 Mutex mutex_; |
1059 bool already_signalled_; | 1059 bool already_signalled_; |
1060 | 1060 |
1061 DISALLOW_COPY_AND_ASSIGN(MessageDispatchHelperThread); | 1061 DISALLOW_COPY_AND_ASSIGN(MessageDispatchHelperThread); |
1062 }; | 1062 }; |
1063 | 1063 |
1064 | 1064 |
1065 } } // namespace v8::internal | 1065 } } // namespace v8::internal |
1066 | 1066 |
1067 #endif // ENABLE_DEBUGGER_SUPPORT | 1067 #endif // ENABLE_DEBUGGER_SUPPORT |
1068 | 1068 |
1069 #endif // V8_DEBUG_H_ | 1069 #endif // V8_DEBUG_H_ |
OLD | NEW |