Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(149)

Side by Side Diff: src/debug.h

Issue 21087012: Simplify implementation of Mutex. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix unit test. Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/d8-debug.cc ('k') | src/debug.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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() const; 766 bool IsEmpty();
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
770 private: 771 private:
771 Logger* logger_; 772 Logger* logger_;
772 CommandMessageQueue queue_; 773 CommandMessageQueue queue_;
773 Mutex* lock_; 774 Mutex lock_;
774 DISALLOW_COPY_AND_ASSIGN(LockingCommandMessageQueue); 775 DISALLOW_COPY_AND_ASSIGN(LockingCommandMessageQueue);
775 }; 776 };
776 777
777 778
778 class Debugger { 779 class Debugger {
779 public: 780 public:
780 ~Debugger(); 781 ~Debugger();
781 782
782 void DebugRequest(const uint16_t* json_request, int length); 783 void DebugRequest(const uint16_t* json_request, int length);
783 784
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
922 Handle<Object> event_listener_; // Global handle to listener. 923 Handle<Object> event_listener_; // Global handle to listener.
923 Handle<Object> event_listener_data_; 924 Handle<Object> event_listener_data_;
924 bool compiling_natives_; // Are we compiling natives? 925 bool compiling_natives_; // Are we compiling natives?
925 bool is_loading_debugger_; // Are we loading the debugger? 926 bool is_loading_debugger_; // Are we loading the debugger?
926 bool live_edit_enabled_; // Enable LiveEdit. 927 bool live_edit_enabled_; // Enable LiveEdit.
927 bool never_unload_debugger_; // Can we unload the debugger? 928 bool never_unload_debugger_; // Can we unload the debugger?
928 bool force_debugger_active_; // Activate debugger without event listeners. 929 bool force_debugger_active_; // Activate debugger without event listeners.
929 v8::Debug::MessageHandler2 message_handler_; 930 v8::Debug::MessageHandler2 message_handler_;
930 bool debugger_unload_pending_; // Was message handler cleared? 931 bool debugger_unload_pending_; // Was message handler cleared?
931 v8::Debug::HostDispatchHandler host_dispatch_handler_; 932 v8::Debug::HostDispatchHandler host_dispatch_handler_;
932 Mutex* dispatch_handler_access_; // Mutex guarding dispatch handler. 933 Mutex dispatch_handler_access_; // Mutex guarding dispatch handler.
933 v8::Debug::DebugMessageDispatchHandler debug_message_dispatch_handler_; 934 v8::Debug::DebugMessageDispatchHandler debug_message_dispatch_handler_;
934 MessageDispatchHelperThread* message_dispatch_helper_thread_; 935 MessageDispatchHelperThread* message_dispatch_helper_thread_;
935 int host_dispatch_micros_; 936 int host_dispatch_micros_;
936 937
937 DebuggerAgent* agent_; 938 DebuggerAgent* agent_;
938 939
939 static const int kQueueInitialSize = 4; 940 static const int kQueueInitialSize = 4;
940 LockingCommandMessageQueue command_queue_; 941 LockingCommandMessageQueue command_queue_;
941 Semaphore* command_received_; // Signaled for each command received. 942 Semaphore* command_received_; // Signaled for each command received.
942 LockingCommandMessageQueue event_command_queue_; 943 LockingCommandMessageQueue event_command_queue_;
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
1049 explicit MessageDispatchHelperThread(Isolate* isolate); 1050 explicit MessageDispatchHelperThread(Isolate* isolate);
1050 ~MessageDispatchHelperThread(); 1051 ~MessageDispatchHelperThread();
1051 1052
1052 void Schedule(); 1053 void Schedule();
1053 1054
1054 private: 1055 private:
1055 void Run(); 1056 void Run();
1056 1057
1057 Isolate* isolate_; 1058 Isolate* isolate_;
1058 Semaphore* const sem_; 1059 Semaphore* const sem_;
1059 Mutex* const mutex_; 1060 Mutex mutex_;
1060 bool already_signalled_; 1061 bool already_signalled_;
1061 1062
1062 DISALLOW_COPY_AND_ASSIGN(MessageDispatchHelperThread); 1063 DISALLOW_COPY_AND_ASSIGN(MessageDispatchHelperThread);
1063 }; 1064 };
1064 1065
1065 1066
1066 } } // namespace v8::internal 1067 } } // namespace v8::internal
1067 1068
1068 #endif // ENABLE_DEBUGGER_SUPPORT 1069 #endif // ENABLE_DEBUGGER_SUPPORT
1069 1070
1070 #endif // V8_DEBUG_H_ 1071 #endif // V8_DEBUG_H_
OLDNEW
« no previous file with comments | « src/d8-debug.cc ('k') | src/debug.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698