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

Side by Side Diff: src/debug.h

Issue 115709: Unload debugger when message handler is cleared (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years, 7 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 | « no previous file | 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 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-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 611 matching lines...) Expand 10 before | Expand all | Expand 10 after
622 static void StopAgent(); 622 static void StopAgent();
623 623
624 // Unload the debugger if possible. Only called when no debugger is currently 624 // Unload the debugger if possible. Only called when no debugger is currently
625 // active. 625 // active.
626 static void UnloadDebugger(); 626 static void UnloadDebugger();
627 627
628 inline static bool EventActive(v8::DebugEvent event) { 628 inline static bool EventActive(v8::DebugEvent event) {
629 ScopedLock with(debugger_access_); 629 ScopedLock with(debugger_access_);
630 630
631 // Check whether the message handler was been cleared. 631 // Check whether the message handler was been cleared.
632 if (message_handler_cleared_) { 632 if (debugger_unload_pending_) {
633 UnloadDebugger(); 633 UnloadDebugger();
634 } 634 }
635 635
636 // Currently argument event is not used. 636 // Currently argument event is not used.
637 return !compiling_natives_ && Debugger::IsDebuggerActive(); 637 return !compiling_natives_ && Debugger::IsDebuggerActive();
638 } 638 }
639 639
640 static void set_compiling_natives(bool compiling_natives) { 640 static void set_compiling_natives(bool compiling_natives) {
641 Debugger::compiling_natives_ = compiling_natives; 641 Debugger::compiling_natives_ = compiling_natives;
642 } 642 }
643 static bool compiling_natives() { return Debugger::compiling_natives_; } 643 static bool compiling_natives() { return Debugger::compiling_natives_; }
644 static void set_loading_debugger(bool v) { is_loading_debugger_ = v; } 644 static void set_loading_debugger(bool v) { is_loading_debugger_ = v; }
645 static bool is_loading_debugger() { return Debugger::is_loading_debugger_; } 645 static bool is_loading_debugger() { return Debugger::is_loading_debugger_; }
646 646
647 private: 647 private:
648 static bool IsDebuggerActive(); 648 static bool IsDebuggerActive();
649 static void ListenersChanged();
649 650
650 static Mutex* debugger_access_; // Mutex guarding debugger variables. 651 static Mutex* debugger_access_; // Mutex guarding debugger variables.
651 static Handle<Object> event_listener_; // Global handle to listener. 652 static Handle<Object> event_listener_; // Global handle to listener.
652 static Handle<Object> event_listener_data_; 653 static Handle<Object> event_listener_data_;
653 static bool compiling_natives_; // Are we compiling natives? 654 static bool compiling_natives_; // Are we compiling natives?
654 static bool is_loading_debugger_; // Are we loading the debugger? 655 static bool is_loading_debugger_; // Are we loading the debugger?
655 static bool never_unload_debugger_; // Can we unload the debugger? 656 static bool never_unload_debugger_; // Can we unload the debugger?
656 static v8::Debug::MessageHandler2 message_handler_; 657 static v8::Debug::MessageHandler2 message_handler_;
657 static bool message_handler_cleared_; // Was message handler cleared? 658 static bool debugger_unload_pending_; // Was message handler cleared?
658 static v8::Debug::HostDispatchHandler host_dispatch_handler_; 659 static v8::Debug::HostDispatchHandler host_dispatch_handler_;
659 static int host_dispatch_micros_; 660 static int host_dispatch_micros_;
660 661
661 static DebuggerAgent* agent_; 662 static DebuggerAgent* agent_;
662 663
663 static const int kQueueInitialSize = 4; 664 static const int kQueueInitialSize = 4;
664 static LockingCommandMessageQueue command_queue_; 665 static LockingCommandMessageQueue command_queue_;
665 static Semaphore* command_received_; // Signaled for each command received. 666 static Semaphore* command_received_; // Signaled for each command received.
666 667
667 friend class EnterDebugger; 668 friend class EnterDebugger;
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
817 Debug::AddressId id_; 818 Debug::AddressId id_;
818 int reg_; 819 int reg_;
819 }; 820 };
820 821
821 822
822 } } // namespace v8::internal 823 } } // namespace v8::internal
823 824
824 #endif // ENABLE_DEBUGGER_SUPPORT 825 #endif // ENABLE_DEBUGGER_SUPPORT
825 826
826 #endif // V8_DEBUG_H_ 827 #endif // V8_DEBUG_H_
OLDNEW
« no previous file with comments | « no previous file | src/debug.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698