OLD | NEW |
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 1741 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1752 | 1752 |
1753 Mutex* Debugger::debugger_access_ = OS::CreateMutex(); | 1753 Mutex* Debugger::debugger_access_ = OS::CreateMutex(); |
1754 Handle<Object> Debugger::event_listener_ = Handle<Object>(); | 1754 Handle<Object> Debugger::event_listener_ = Handle<Object>(); |
1755 Handle<Object> Debugger::event_listener_data_ = Handle<Object>(); | 1755 Handle<Object> Debugger::event_listener_data_ = Handle<Object>(); |
1756 bool Debugger::compiling_natives_ = false; | 1756 bool Debugger::compiling_natives_ = false; |
1757 bool Debugger::is_loading_debugger_ = false; | 1757 bool Debugger::is_loading_debugger_ = false; |
1758 bool Debugger::never_unload_debugger_ = false; | 1758 bool Debugger::never_unload_debugger_ = false; |
1759 v8::Debug::MessageHandler2 Debugger::message_handler_ = NULL; | 1759 v8::Debug::MessageHandler2 Debugger::message_handler_ = NULL; |
1760 bool Debugger::debugger_unload_pending_ = false; | 1760 bool Debugger::debugger_unload_pending_ = false; |
1761 v8::Debug::HostDispatchHandler Debugger::host_dispatch_handler_ = NULL; | 1761 v8::Debug::HostDispatchHandler Debugger::host_dispatch_handler_ = NULL; |
| 1762 v8::Debug::DebugMessageDispatchHandler |
| 1763 Debugger::debug_message_dispatch_handler_ = NULL; |
1762 int Debugger::host_dispatch_micros_ = 100 * 1000; | 1764 int Debugger::host_dispatch_micros_ = 100 * 1000; |
1763 DebuggerAgent* Debugger::agent_ = NULL; | 1765 DebuggerAgent* Debugger::agent_ = NULL; |
1764 LockingCommandMessageQueue Debugger::command_queue_(kQueueInitialSize); | 1766 LockingCommandMessageQueue Debugger::command_queue_(kQueueInitialSize); |
1765 Semaphore* Debugger::command_received_ = OS::CreateSemaphore(0); | 1767 Semaphore* Debugger::command_received_ = OS::CreateSemaphore(0); |
1766 | 1768 |
1767 | 1769 |
1768 Handle<Object> Debugger::MakeJSObject(Vector<const char> constructor_name, | 1770 Handle<Object> Debugger::MakeJSObject(Vector<const char> constructor_name, |
1769 int argc, Object*** argv, | 1771 int argc, Object*** argv, |
1770 bool* caught_exception) { | 1772 bool* caught_exception) { |
1771 ASSERT(Top::context() == *Debug::debug_context()); | 1773 ASSERT(Top::context() == *Debug::debug_context()); |
(...skipping 620 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2392 } | 2394 } |
2393 | 2395 |
2394 | 2396 |
2395 void Debugger::SetHostDispatchHandler(v8::Debug::HostDispatchHandler handler, | 2397 void Debugger::SetHostDispatchHandler(v8::Debug::HostDispatchHandler handler, |
2396 int period) { | 2398 int period) { |
2397 host_dispatch_handler_ = handler; | 2399 host_dispatch_handler_ = handler; |
2398 host_dispatch_micros_ = period * 1000; | 2400 host_dispatch_micros_ = period * 1000; |
2399 } | 2401 } |
2400 | 2402 |
2401 | 2403 |
| 2404 void Debugger::SetDebugMessageDispatchHandler( |
| 2405 v8::Debug::DebugMessageDispatchHandler handler) { |
| 2406 debug_message_dispatch_handler_ = handler; |
| 2407 } |
| 2408 |
| 2409 |
2402 // Calls the registered debug message handler. This callback is part of the | 2410 // Calls the registered debug message handler. This callback is part of the |
2403 // public API. | 2411 // public API. |
2404 void Debugger::InvokeMessageHandler(MessageImpl message) { | 2412 void Debugger::InvokeMessageHandler(MessageImpl message) { |
2405 ScopedLock with(debugger_access_); | 2413 ScopedLock with(debugger_access_); |
2406 | 2414 |
2407 if (message_handler_ != NULL) { | 2415 if (message_handler_ != NULL) { |
2408 message_handler_(message); | 2416 message_handler_(message); |
2409 } | 2417 } |
2410 } | 2418 } |
2411 | 2419 |
(...skipping 10 matching lines...) Expand all Loading... |
2422 command.length()), | 2430 command.length()), |
2423 client_data); | 2431 client_data); |
2424 Logger::DebugTag("Put command on command_queue."); | 2432 Logger::DebugTag("Put command on command_queue."); |
2425 command_queue_.Put(message); | 2433 command_queue_.Put(message); |
2426 command_received_->Signal(); | 2434 command_received_->Signal(); |
2427 | 2435 |
2428 // Set the debug command break flag to have the command processed. | 2436 // Set the debug command break flag to have the command processed. |
2429 if (!Debug::InDebugger()) { | 2437 if (!Debug::InDebugger()) { |
2430 StackGuard::DebugCommand(); | 2438 StackGuard::DebugCommand(); |
2431 } | 2439 } |
| 2440 |
| 2441 if (Debugger::debug_message_dispatch_handler_ != NULL) { |
| 2442 Debugger::debug_message_dispatch_handler_(); |
| 2443 } |
2432 } | 2444 } |
2433 | 2445 |
2434 | 2446 |
2435 bool Debugger::HasCommands() { | 2447 bool Debugger::HasCommands() { |
2436 return !command_queue_.IsEmpty(); | 2448 return !command_queue_.IsEmpty(); |
2437 } | 2449 } |
2438 | 2450 |
2439 | 2451 |
2440 bool Debugger::IsDebuggerActive() { | 2452 bool Debugger::IsDebuggerActive() { |
2441 ScopedLock with(debugger_access_); | 2453 ScopedLock with(debugger_access_); |
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2713 | 2725 |
2714 | 2726 |
2715 void LockingCommandMessageQueue::Clear() { | 2727 void LockingCommandMessageQueue::Clear() { |
2716 ScopedLock sl(lock_); | 2728 ScopedLock sl(lock_); |
2717 queue_.Clear(); | 2729 queue_.Clear(); |
2718 } | 2730 } |
2719 | 2731 |
2720 #endif // ENABLE_DEBUGGER_SUPPORT | 2732 #endif // ENABLE_DEBUGGER_SUPPORT |
2721 | 2733 |
2722 } } // namespace v8::internal | 2734 } } // namespace v8::internal |
OLD | NEW |