OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "v8.h" | 5 #include "v8.h" |
6 | 6 |
7 #include "api.h" | 7 #include "api.h" |
8 #include "arguments.h" | 8 #include "arguments.h" |
9 #include "bootstrapper.h" | 9 #include "bootstrapper.h" |
10 #include "code-stubs.h" | 10 #include "code-stubs.h" |
(...skipping 2959 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2970 if (handler == NULL && is_entered()) { | 2970 if (handler == NULL && is_entered()) { |
2971 // Send an empty command to the debugger if in a break to make JavaScript | 2971 // Send an empty command to the debugger if in a break to make JavaScript |
2972 // run again if the debugger is closed. | 2972 // run again if the debugger is closed. |
2973 EnqueueCommandMessage(Vector<const uint16_t>::empty()); | 2973 EnqueueCommandMessage(Vector<const uint16_t>::empty()); |
2974 } | 2974 } |
2975 } | 2975 } |
2976 | 2976 |
2977 | 2977 |
2978 | 2978 |
2979 void Debug::UpdateState() { | 2979 void Debug::UpdateState() { |
2980 bool activate = message_handler_ != NULL || | 2980 is_active_ = message_handler_ != NULL || !event_listener_.is_null(); |
2981 !event_listener_.is_null() || | 2981 if (is_active_ || is_entered()) { |
2982 is_entered(); | |
2983 if (!is_active_ && activate) { | |
2984 // Note that the debug context could have already been loaded to | 2982 // Note that the debug context could have already been loaded to |
2985 // bootstrap test cases. | 2983 // bootstrap test cases. |
2986 isolate_->compilation_cache()->Disable(); | 2984 isolate_->compilation_cache()->Disable(); |
2987 activate = Load(); | 2985 is_active_ = Load(); |
2988 } else if (is_loaded() && !activate) { | 2986 } else if (is_loaded() && !is_active_) { |
2989 isolate_->compilation_cache()->Enable(); | 2987 isolate_->compilation_cache()->Enable(); |
2990 Unload(); | 2988 Unload(); |
2991 } | 2989 } |
2992 is_active_ = activate; | |
2993 // At this point the debug context is loaded iff the debugger is active. | |
2994 ASSERT(is_loaded() == is_active()); | |
2995 } | 2990 } |
2996 | 2991 |
2997 | 2992 |
2998 // Calls the registered debug message handler. This callback is part of the | 2993 // Calls the registered debug message handler. This callback is part of the |
2999 // public API. | 2994 // public API. |
3000 void Debug::InvokeMessageHandler(MessageImpl message) { | 2995 void Debug::InvokeMessageHandler(MessageImpl message) { |
3001 if (message_handler_ != NULL) message_handler_(message); | 2996 if (message_handler_ != NULL) message_handler_(message); |
3002 } | 2997 } |
3003 | 2998 |
3004 | 2999 |
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3406 logger_->DebugEvent("Put", message.text()); | 3401 logger_->DebugEvent("Put", message.text()); |
3407 } | 3402 } |
3408 | 3403 |
3409 | 3404 |
3410 void LockingCommandMessageQueue::Clear() { | 3405 void LockingCommandMessageQueue::Clear() { |
3411 LockGuard<Mutex> lock_guard(&mutex_); | 3406 LockGuard<Mutex> lock_guard(&mutex_); |
3412 queue_.Clear(); | 3407 queue_.Clear(); |
3413 } | 3408 } |
3414 | 3409 |
3415 } } // namespace v8::internal | 3410 } } // namespace v8::internal |
OLD | NEW |