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 745 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
756 | 756 |
757 | 757 |
758 // LockingCommandMessageQueue is a thread-safe circular buffer of CommandMessage | 758 // LockingCommandMessageQueue is a thread-safe circular buffer of CommandMessage |
759 // messages. The message data is not managed by LockingCommandMessageQueue. | 759 // messages. The message data is not managed by LockingCommandMessageQueue. |
760 // Pointers to the data are passed in and out. Implemented by adding a | 760 // Pointers to the data are passed in and out. Implemented by adding a |
761 // Mutex to CommandMessageQueue. Includes logging of all puts and gets. | 761 // Mutex to CommandMessageQueue. Includes logging of all puts and gets. |
762 class LockingCommandMessageQueue BASE_EMBEDDED { | 762 class LockingCommandMessageQueue BASE_EMBEDDED { |
763 public: | 763 public: |
764 LockingCommandMessageQueue(Logger* logger, int size); | 764 LockingCommandMessageQueue(Logger* logger, int size); |
765 ~LockingCommandMessageQueue(); | 765 ~LockingCommandMessageQueue(); |
766 bool IsEmpty(); | 766 bool IsEmpty() const; |
767 CommandMessage Get(); | 767 CommandMessage Get(); |
768 void Put(const CommandMessage& message); | 768 void Put(const CommandMessage& message); |
769 void Clear(); | 769 void Clear(); |
770 | |
771 private: | 770 private: |
772 Logger* logger_; | 771 Logger* logger_; |
773 CommandMessageQueue queue_; | 772 CommandMessageQueue queue_; |
774 Mutex lock_; | 773 Mutex* lock_; |
775 DISALLOW_COPY_AND_ASSIGN(LockingCommandMessageQueue); | 774 DISALLOW_COPY_AND_ASSIGN(LockingCommandMessageQueue); |
776 }; | 775 }; |
777 | 776 |
778 | 777 |
779 class Debugger { | 778 class Debugger { |
780 public: | 779 public: |
781 ~Debugger(); | 780 ~Debugger(); |
782 | 781 |
783 void DebugRequest(const uint16_t* json_request, int length); | 782 void DebugRequest(const uint16_t* json_request, int length); |
784 | 783 |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
923 Handle<Object> event_listener_; // Global handle to listener. | 922 Handle<Object> event_listener_; // Global handle to listener. |
924 Handle<Object> event_listener_data_; | 923 Handle<Object> event_listener_data_; |
925 bool compiling_natives_; // Are we compiling natives? | 924 bool compiling_natives_; // Are we compiling natives? |
926 bool is_loading_debugger_; // Are we loading the debugger? | 925 bool is_loading_debugger_; // Are we loading the debugger? |
927 bool live_edit_enabled_; // Enable LiveEdit. | 926 bool live_edit_enabled_; // Enable LiveEdit. |
928 bool never_unload_debugger_; // Can we unload the debugger? | 927 bool never_unload_debugger_; // Can we unload the debugger? |
929 bool force_debugger_active_; // Activate debugger without event listeners. | 928 bool force_debugger_active_; // Activate debugger without event listeners. |
930 v8::Debug::MessageHandler2 message_handler_; | 929 v8::Debug::MessageHandler2 message_handler_; |
931 bool debugger_unload_pending_; // Was message handler cleared? | 930 bool debugger_unload_pending_; // Was message handler cleared? |
932 v8::Debug::HostDispatchHandler host_dispatch_handler_; | 931 v8::Debug::HostDispatchHandler host_dispatch_handler_; |
933 Mutex dispatch_handler_access_; // Mutex guarding dispatch handler. | 932 Mutex* dispatch_handler_access_; // Mutex guarding dispatch handler. |
934 v8::Debug::DebugMessageDispatchHandler debug_message_dispatch_handler_; | 933 v8::Debug::DebugMessageDispatchHandler debug_message_dispatch_handler_; |
935 MessageDispatchHelperThread* message_dispatch_helper_thread_; | 934 MessageDispatchHelperThread* message_dispatch_helper_thread_; |
936 int host_dispatch_micros_; | 935 int host_dispatch_micros_; |
937 | 936 |
938 DebuggerAgent* agent_; | 937 DebuggerAgent* agent_; |
939 | 938 |
940 static const int kQueueInitialSize = 4; | 939 static const int kQueueInitialSize = 4; |
941 LockingCommandMessageQueue command_queue_; | 940 LockingCommandMessageQueue command_queue_; |
942 Semaphore* command_received_; // Signaled for each command received. | 941 Semaphore* command_received_; // Signaled for each command received. |
943 LockingCommandMessageQueue event_command_queue_; | 942 LockingCommandMessageQueue event_command_queue_; |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1050 explicit MessageDispatchHelperThread(Isolate* isolate); | 1049 explicit MessageDispatchHelperThread(Isolate* isolate); |
1051 ~MessageDispatchHelperThread(); | 1050 ~MessageDispatchHelperThread(); |
1052 | 1051 |
1053 void Schedule(); | 1052 void Schedule(); |
1054 | 1053 |
1055 private: | 1054 private: |
1056 void Run(); | 1055 void Run(); |
1057 | 1056 |
1058 Isolate* isolate_; | 1057 Isolate* isolate_; |
1059 Semaphore* const sem_; | 1058 Semaphore* const sem_; |
1060 Mutex mutex_; | 1059 Mutex* const mutex_; |
1061 bool already_signalled_; | 1060 bool already_signalled_; |
1062 | 1061 |
1063 DISALLOW_COPY_AND_ASSIGN(MessageDispatchHelperThread); | 1062 DISALLOW_COPY_AND_ASSIGN(MessageDispatchHelperThread); |
1064 }; | 1063 }; |
1065 | 1064 |
1066 | 1065 |
1067 } } // namespace v8::internal | 1066 } } // namespace v8::internal |
1068 | 1067 |
1069 #endif // ENABLE_DEBUGGER_SUPPORT | 1068 #endif // ENABLE_DEBUGGER_SUPPORT |
1070 | 1069 |
1071 #endif // V8_DEBUG_H_ | 1070 #endif // V8_DEBUG_H_ |
OLD | NEW |