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

Side by Side Diff: src/inspector/v8-debugger.cc

Issue 2396193002: [inspector] move changeBreakpointState from debugger-script to native (Closed)
Patch Set: Created 4 years, 2 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
OLDNEW
1 // Copyright 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 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/inspector/v8-debugger.h" 5 #include "src/inspector/v8-debugger.h"
6 6
7 #include "src/inspector/debugger-script.h" 7 #include "src/inspector/debugger-script.h"
8 #include "src/inspector/protocol/Protocol.h" 8 #include "src/inspector/protocol/Protocol.h"
9 #include "src/inspector/script-breakpoint.h" 9 #include "src/inspector/script-breakpoint.h"
10 #include "src/inspector/string-util.h" 10 #include "src/inspector/string-util.h"
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 } 48 }
49 49
50 V8Debugger::V8Debugger(v8::Isolate* isolate, V8InspectorImpl* inspector) 50 V8Debugger::V8Debugger(v8::Isolate* isolate, V8InspectorImpl* inspector)
51 : m_isolate(isolate), 51 : m_isolate(isolate),
52 m_inspector(inspector), 52 m_inspector(inspector),
53 m_lastContextId(0), 53 m_lastContextId(0),
54 m_enableCount(0), 54 m_enableCount(0),
55 m_breakpointsActivated(true), 55 m_breakpointsActivated(true),
56 m_runningNestedMessageLoop(false), 56 m_runningNestedMessageLoop(false),
57 m_ignoreScriptParsedEventsCounter(0), 57 m_ignoreScriptParsedEventsCounter(0),
58 m_maxAsyncCallStackDepth(0) {} 58 m_maxAsyncCallStackDepth(0),
59 m_pauseOnExceptionsState(DontPauseOnExceptions) {}
59 60
60 V8Debugger::~V8Debugger() {} 61 V8Debugger::~V8Debugger() {}
61 62
62 void V8Debugger::enable() { 63 void V8Debugger::enable() {
63 if (m_enableCount++) return; 64 if (m_enableCount++) return;
64 DCHECK(!enabled()); 65 DCHECK(!enabled());
65 v8::HandleScope scope(m_isolate); 66 v8::HandleScope scope(m_isolate);
66 v8::Debug::SetDebugEventListener(m_isolate, &V8Debugger::v8DebugEventCallback, 67 v8::Debug::SetDebugEventListener(m_isolate, &V8Debugger::v8DebugEventCallback,
67 v8::External::New(m_isolate, this)); 68 v8::External::New(m_isolate, this));
68 m_debuggerContext.Reset(m_isolate, v8::Debug::GetDebugContext(m_isolate)); 69 m_debuggerContext.Reset(m_isolate, v8::Debug::GetDebugContext(m_isolate));
70 v8::Debug::ChangeBreakOnException(m_isolate, v8::NoBreakOnException);
71 m_pauseOnExceptionsState = DontPauseOnExceptions;
69 compileDebuggerScript(); 72 compileDebuggerScript();
70 } 73 }
71 74
72 void V8Debugger::disable() { 75 void V8Debugger::disable() {
73 if (--m_enableCount) return; 76 if (--m_enableCount) return;
74 DCHECK(enabled()); 77 DCHECK(enabled());
75 clearBreakpoints(); 78 clearBreakpoints();
76 m_debuggerScript.Reset(); 79 m_debuggerScript.Reset();
77 m_debuggerContext.Reset(); 80 m_debuggerContext.Reset();
78 allAsyncTasksCanceled(); 81 allAsyncTasksCanceled();
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 "setBreakpointsActivated")) 247 "setBreakpointsActivated"))
245 .ToLocalChecked()); 248 .ToLocalChecked());
246 v8::Debug::Call(debuggerContext(), setBreakpointsActivated, info) 249 v8::Debug::Call(debuggerContext(), setBreakpointsActivated, info)
247 .ToLocalChecked(); 250 .ToLocalChecked();
248 251
249 m_breakpointsActivated = activated; 252 m_breakpointsActivated = activated;
250 } 253 }
251 254
252 V8Debugger::PauseOnExceptionsState V8Debugger::getPauseOnExceptionsState() { 255 V8Debugger::PauseOnExceptionsState V8Debugger::getPauseOnExceptionsState() {
253 DCHECK(enabled()); 256 DCHECK(enabled());
254 v8::HandleScope scope(m_isolate); 257 return m_pauseOnExceptionsState;
255 v8::Local<v8::Context> context = debuggerContext();
256 v8::Context::Scope contextScope(context);
257
258 v8::Local<v8::Value> argv[] = {v8::Undefined(m_isolate)};
259 v8::Local<v8::Value> result =
260 callDebuggerMethod("pauseOnExceptionsState", 0, argv).ToLocalChecked();
261 return static_cast<V8Debugger::PauseOnExceptionsState>(
262 result->Int32Value(context).FromJust());
263 } 258 }
264 259
265 void V8Debugger::setPauseOnExceptionsState( 260 void V8Debugger::setPauseOnExceptionsState(
266 PauseOnExceptionsState pauseOnExceptionsState) { 261 PauseOnExceptionsState pauseOnExceptionsState) {
267 DCHECK(enabled()); 262 DCHECK(enabled());
268 v8::HandleScope scope(m_isolate); 263 if (m_pauseOnExceptionsState == pauseOnExceptionsState) return;
269 v8::Context::Scope contextScope(debuggerContext()); 264 if (pauseOnExceptionsState == DontPauseOnExceptions)
270 265 v8::Debug::ChangeBreakOnException(m_isolate, v8::NoBreakOnException);
271 v8::Local<v8::Value> argv[] = { 266 else if (pauseOnExceptionsState == PauseOnUncaughtExceptions)
272 v8::Int32::New(m_isolate, pauseOnExceptionsState)}; 267 v8::Debug::ChangeBreakOnException(m_isolate, v8::BreakOnUncaughtException);
273 callDebuggerMethod("setPauseOnExceptionsState", 1, argv); 268 else
269 v8::Debug::ChangeBreakOnException(m_isolate, v8::BreakOnAnyException);
270 m_pauseOnExceptionsState = pauseOnExceptionsState;
274 } 271 }
275 272
276 void V8Debugger::setPauseOnNextStatement(bool pause) { 273 void V8Debugger::setPauseOnNextStatement(bool pause) {
277 if (m_runningNestedMessageLoop) return; 274 if (m_runningNestedMessageLoop) return;
278 if (pause) 275 if (pause)
279 v8::Debug::DebugBreak(m_isolate); 276 v8::Debug::DebugBreak(m_isolate);
280 else 277 else
281 v8::Debug::CancelDebugBreak(m_isolate); 278 v8::Debug::CancelDebugBreak(m_isolate);
282 } 279 }
283 280
(...skipping 709 matching lines...) Expand 10 before | Expand all | Expand 10 after
993 990
994 size_t stackSize = 991 size_t stackSize =
995 fullStack ? V8StackTraceImpl::maxCallStackSizeToCapture : 1; 992 fullStack ? V8StackTraceImpl::maxCallStackSizeToCapture : 1;
996 if (m_inspector->enabledRuntimeAgentForGroup(contextGroupId)) 993 if (m_inspector->enabledRuntimeAgentForGroup(contextGroupId))
997 stackSize = V8StackTraceImpl::maxCallStackSizeToCapture; 994 stackSize = V8StackTraceImpl::maxCallStackSizeToCapture;
998 995
999 return V8StackTraceImpl::capture(this, contextGroupId, stackSize); 996 return V8StackTraceImpl::capture(this, contextGroupId, stackSize);
1000 } 997 }
1001 998
1002 } // namespace v8_inspector 999 } // namespace v8_inspector
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698