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

Side by Side Diff: src/debug.cc

Issue 1036863002: Debugger: remove debug command API. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fix test Created 5 years, 8 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
« no previous file with comments | « src/debug.h ('k') | test/cctest/test-api.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 // 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 "src/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/api.h" 7 #include "src/api.h"
8 #include "src/arguments.h" 8 #include "src/arguments.h"
9 #include "src/bootstrapper.h" 9 #include "src/bootstrapper.h"
10 #include "src/code-stubs.h" 10 #include "src/code-stubs.h"
(...skipping 16 matching lines...) Expand all
27 namespace v8 { 27 namespace v8 {
28 namespace internal { 28 namespace internal {
29 29
30 Debug::Debug(Isolate* isolate) 30 Debug::Debug(Isolate* isolate)
31 : debug_context_(Handle<Context>()), 31 : debug_context_(Handle<Context>()),
32 event_listener_(Handle<Object>()), 32 event_listener_(Handle<Object>()),
33 event_listener_data_(Handle<Object>()), 33 event_listener_data_(Handle<Object>()),
34 message_handler_(NULL), 34 message_handler_(NULL),
35 command_received_(0), 35 command_received_(0),
36 command_queue_(isolate->logger(), kQueueInitialSize), 36 command_queue_(isolate->logger(), kQueueInitialSize),
37 event_command_queue_(isolate->logger(), kQueueInitialSize),
38 is_active_(false), 37 is_active_(false),
39 is_suppressed_(false), 38 is_suppressed_(false),
40 live_edit_enabled_(true), // TODO(yangguo): set to false by default. 39 live_edit_enabled_(true), // TODO(yangguo): set to false by default.
41 has_break_points_(false), 40 has_break_points_(false),
42 break_disabled_(false), 41 break_disabled_(false),
43 in_debug_event_listener_(false), 42 in_debug_event_listener_(false),
44 break_on_exception_(false), 43 break_on_exception_(false),
45 break_on_uncaught_exception_(false), 44 break_on_uncaught_exception_(false),
46 script_cache_(NULL), 45 script_cache_(NULL),
47 debug_info_list_(NULL), 46 debug_info_list_(NULL),
(...skipping 2691 matching lines...) Expand 10 before | Expand all | Expand 10 after
2739 Handle<JSObject>::cast(exec_state), 2738 Handle<JSObject>::cast(exec_state),
2740 event_data, 2739 event_data,
2741 auto_continue); 2740 auto_continue);
2742 } 2741 }
2743 // Notify registered debug event listener. This can be either a C or 2742 // Notify registered debug event listener. This can be either a C or
2744 // a JavaScript function. Don't call event listener for v8::Break 2743 // a JavaScript function. Don't call event listener for v8::Break
2745 // here, if it's only a debug command -- they will be processed later. 2744 // here, if it's only a debug command -- they will be processed later.
2746 if ((event != v8::Break || !auto_continue) && !event_listener_.is_null()) { 2745 if ((event != v8::Break || !auto_continue) && !event_listener_.is_null()) {
2747 CallEventCallback(event, exec_state, event_data, NULL); 2746 CallEventCallback(event, exec_state, event_data, NULL);
2748 } 2747 }
2749 // Process pending debug commands.
2750 if (event == v8::Break) {
2751 while (!event_command_queue_.IsEmpty()) {
2752 CommandMessage command = event_command_queue_.Get();
2753 if (!event_listener_.is_null()) {
2754 CallEventCallback(v8::BreakForCommand,
2755 exec_state,
2756 event_data,
2757 command.client_data());
2758 }
2759 command.Dispose();
2760 }
2761 }
2762 } 2748 }
2763 2749
2764 2750
2765 void Debug::CallEventCallback(v8::DebugEvent event, 2751 void Debug::CallEventCallback(v8::DebugEvent event,
2766 Handle<Object> exec_state, 2752 Handle<Object> exec_state,
2767 Handle<Object> event_data, 2753 Handle<Object> event_data,
2768 v8::Debug::ClientData* client_data) { 2754 v8::Debug::ClientData* client_data) {
2769 bool previous = in_debug_event_listener_; 2755 bool previous = in_debug_event_listener_;
2770 in_debug_event_listener_ = true; 2756 in_debug_event_listener_ = true;
2771 if (event_listener_->IsForeign()) { 2757 if (event_listener_->IsForeign()) {
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
3026 client_data); 3012 client_data);
3027 isolate_->logger()->DebugTag("Put command on command_queue."); 3013 isolate_->logger()->DebugTag("Put command on command_queue.");
3028 command_queue_.Put(message); 3014 command_queue_.Put(message);
3029 command_received_.Signal(); 3015 command_received_.Signal();
3030 3016
3031 // Set the debug command break flag to have the command processed. 3017 // Set the debug command break flag to have the command processed.
3032 if (!in_debug_scope()) isolate_->stack_guard()->RequestDebugCommand(); 3018 if (!in_debug_scope()) isolate_->stack_guard()->RequestDebugCommand();
3033 } 3019 }
3034 3020
3035 3021
3036 void Debug::EnqueueDebugCommand(v8::Debug::ClientData* client_data) {
3037 CommandMessage message = CommandMessage::New(Vector<uint16_t>(), client_data);
3038 event_command_queue_.Put(message);
3039
3040 // Set the debug command break flag to have the command processed.
3041 if (!in_debug_scope()) isolate_->stack_guard()->RequestDebugCommand();
3042 }
3043
3044
3045 MaybeHandle<Object> Debug::Call(Handle<JSFunction> fun, Handle<Object> data) { 3022 MaybeHandle<Object> Debug::Call(Handle<JSFunction> fun, Handle<Object> data) {
3046 DebugScope debug_scope(this); 3023 DebugScope debug_scope(this);
3047 if (debug_scope.failed()) return isolate_->factory()->undefined_value(); 3024 if (debug_scope.failed()) return isolate_->factory()->undefined_value();
3048 3025
3049 // Create the execution state. 3026 // Create the execution state.
3050 Handle<Object> exec_state; 3027 Handle<Object> exec_state;
3051 if (!MakeExecutionState().ToHandle(&exec_state)) { 3028 if (!MakeExecutionState().ToHandle(&exec_state)) {
3052 return isolate_->factory()->undefined_value(); 3029 return isolate_->factory()->undefined_value();
3053 } 3030 }
3054 3031
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after
3424 logger_->DebugEvent("Put", message.text()); 3401 logger_->DebugEvent("Put", message.text());
3425 } 3402 }
3426 3403
3427 3404
3428 void LockingCommandMessageQueue::Clear() { 3405 void LockingCommandMessageQueue::Clear() {
3429 base::LockGuard<base::Mutex> lock_guard(&mutex_); 3406 base::LockGuard<base::Mutex> lock_guard(&mutex_);
3430 queue_.Clear(); 3407 queue_.Clear();
3431 } 3408 }
3432 3409
3433 } } // namespace v8::internal 3410 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/debug.h ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698