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

Side by Side Diff: Source/bindings/v8/ScriptDebugServer.cpp

Issue 466243002: Support merged Dart-JS callstacks (Closed) Base URL: svn://svn.chromium.org/blink/branches/dart/dartium
Patch Set: Created 6 years, 3 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 | « Source/bindings/v8/ScriptDebugServer.h ('k') | Source/core/inspector/AsyncCallStackTracker.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2010-2011 Google Inc. All rights reserved. 2 * Copyright (c) 2010-2011 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 void ScriptDebugServer::stepOutOfFunction() 234 void ScriptDebugServer::stepOutOfFunction()
235 { 235 {
236 ASSERT(isPaused()); 236 ASSERT(isPaused());
237 ASSERT(!m_executionState.IsEmpty()); 237 ASSERT(!m_executionState.IsEmpty());
238 v8::HandleScope handleScope(m_isolate); 238 v8::HandleScope handleScope(m_isolate);
239 v8::Handle<v8::Value> argv[] = { m_executionState }; 239 v8::Handle<v8::Value> argv[] = { m_executionState };
240 callDebuggerMethod(stepOutV8MethodName, 1, argv); 240 callDebuggerMethod(stepOutV8MethodName, 1, argv);
241 continueProgram(); 241 continueProgram();
242 } 242 }
243 243
244 bool ScriptDebugServer::setScriptSource(const String& sourceID, const String& ne wContent, bool preview, String* error, RefPtr<TypeBuilder::Debugger::SetScriptSo urceError>& errorData, StackTrace* newCallFrames, RefPtr<JSONObject>* result) 244 bool ScriptDebugServer::setScriptSource(const String& sourceID, const String& ne wContent, bool preview, String* error, RefPtr<TypeBuilder::Debugger::SetScriptSo urceError>& errorData, StackTraces* newCallFrames, RefPtr<JSONObject>* result)
245 { 245 {
246 class EnableLiveEditScope { 246 class EnableLiveEditScope {
247 public: 247 public:
248 explicit EnableLiveEditScope(v8::Isolate* isolate) : m_isolate(isolate) { v8::Debug::SetLiveEditEnabled(m_isolate, true); } 248 explicit EnableLiveEditScope(v8::Isolate* isolate) : m_isolate(isolate) { v8::Debug::SetLiveEditEnabled(m_isolate, true); }
249 ~EnableLiveEditScope() { v8::Debug::SetLiveEditEnabled(m_isolate, false) ; } 249 ~EnableLiveEditScope() { v8::Debug::SetLiveEditEnabled(m_isolate, false) ; }
250 private: 250 private:
251 v8::Isolate* m_isolate; 251 v8::Isolate* m_isolate;
252 }; 252 };
253 253
254 ensureDebuggerScriptCompiled(); 254 ensureDebuggerScriptCompiled();
(...skipping 25 matching lines...) Expand all
280 v8::Local<v8::Object> resultTuple = v8result->ToObject(); 280 v8::Local<v8::Object> resultTuple = v8result->ToObject();
281 int code = static_cast<int>(resultTuple->Get(0)->ToInteger()->Value()); 281 int code = static_cast<int>(resultTuple->Get(0)->ToInteger()->Value());
282 switch (code) { 282 switch (code) {
283 case 0: 283 case 0:
284 { 284 {
285 v8::Local<v8::Value> normalResult = resultTuple->Get(1); 285 v8::Local<v8::Value> normalResult = resultTuple->Get(1);
286 RefPtr<JSONValue> jsonResult = v8ToJSONValue(m_isolate, normalResult , JSONValue::maxDepth); 286 RefPtr<JSONValue> jsonResult = v8ToJSONValue(m_isolate, normalResult , JSONValue::maxDepth);
287 if (jsonResult) 287 if (jsonResult)
288 *result = jsonResult->asObject(); 288 *result = jsonResult->asObject();
289 // Call stack may have changed after if the edited function was on t he stack. 289 // Call stack may have changed after if the edited function was on t he stack.
290 if (!preview && isPaused()) 290 if (!preview && isAnyScriptPaused())
291 *newCallFrames = currentCallFrames(); 291 newCallFrames->add(currentCallFrames());
292 return true; 292 return true;
293 } 293 }
294 // Compile error. 294 // Compile error.
295 case 1: 295 case 1:
296 { 296 {
297 RefPtr<TypeBuilder::Debugger::SetScriptSourceError::CompileError> co mpileError = 297 RefPtr<TypeBuilder::Debugger::SetScriptSourceError::CompileError> co mpileError =
298 TypeBuilder::Debugger::SetScriptSourceError::CompileError::creat e() 298 TypeBuilder::Debugger::SetScriptSourceError::CompileError::creat e()
299 .setMessage(toCoreStringWithUndefinedOrNullCheck(resultTuple ->Get(2))) 299 .setMessage(toCoreStringWithUndefinedOrNullCheck(resultTuple ->Get(2)))
300 .setLineNumber(resultTuple->Get(3)->ToInteger()->Value()) 300 .setLineNumber(resultTuple->Get(3)->ToInteger()->Value())
301 .setColumnNumber(resultTuple->Get(4)->ToInteger()->Value()); 301 .setColumnNumber(resultTuple->Get(4)->ToInteger()->Value());
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 } else { 335 } else {
336 v8::Handle<v8::Value> argv[] = { m_executionState, v8::Integer::New(m_is olate, data) }; 336 v8::Handle<v8::Value> argv[] = { m_executionState, v8::Integer::New(m_is olate, data) };
337 currentCallFrameV8 = callDebuggerMethod("currentCallFrame", WTF_ARRAY_LE NGTH(argv), argv); 337 currentCallFrameV8 = callDebuggerMethod("currentCallFrame", WTF_ARRAY_LE NGTH(argv), argv);
338 } 338 }
339 ASSERT(!currentCallFrameV8.IsEmpty()); 339 ASSERT(!currentCallFrameV8.IsEmpty());
340 if (!currentCallFrameV8->IsObject()) 340 if (!currentCallFrameV8->IsObject())
341 return nullptr; 341 return nullptr;
342 return JavaScriptCallFrame::create(v8::Debug::GetDebugContext(), v8::Handle< v8::Object>::Cast(currentCallFrameV8)); 342 return JavaScriptCallFrame::create(v8::Debug::GetDebugContext(), v8::Handle< v8::Object>::Cast(currentCallFrameV8));
343 } 343 }
344 344
345 StackTrace ScriptDebugServer::currentCallFramesInner(ScopeInfoDetails scopeDetai ls) 345 StackTraces ScriptDebugServer::currentCallFramesInner(ScopeInfoDetails scopeDeta ils)
346 { 346 {
347 if (!m_isolate->InContext()) 347 if (!m_isolate->InContext())
348 return StackTrace(ScriptValue()); 348 return StackTraces();
349 v8::HandleScope handleScope(m_isolate); 349 v8::HandleScope handleScope(m_isolate);
350 350
351 RefPtrWillBeRawPtr<JavaScriptCallFrame> currentCallFrame = wrapCallFrames(0, scopeDetails); 351 RefPtrWillBeRawPtr<JavaScriptCallFrame> currentCallFrame = wrapCallFrames(0, scopeDetails);
352 if (!currentCallFrame) 352 if (!currentCallFrame)
353 return StackTrace(ScriptValue()); 353 return StackTraces();
354 354
355 V8ScriptState* scriptState = m_pausedScriptState ? m_pausedScriptState->v8Sc riptState() : V8ScriptState::current(m_isolate); 355 V8ScriptState* scriptState = m_pausedScriptState ? m_pausedScriptState->v8Sc riptState() : V8ScriptState::current(m_isolate);
356 V8ScriptState::Scope scope(scriptState); 356 V8ScriptState::Scope scope(scriptState);
357 return StackTrace(ScriptValue(scriptState, toV8(currentCallFrame.release(), scriptState->context()->Global(), m_isolate))); 357 return StackTraces(StackTrace(ScriptValue(scriptState, toV8(currentCallFrame .release(), scriptState->context()->Global(), m_isolate))), scriptState);
358 } 358 }
359 359
360 StackTrace ScriptDebugServer::currentCallFrames() 360
361 StackTraces ScriptDebugServer::currentCallFrames()
361 { 362 {
362 return currentCallFramesInner(AllScopes); 363 return currentCallFramesInner(AllScopes);
363 } 364 }
364 365
365 StackTrace ScriptDebugServer::currentCallFramesForAsyncStack() 366 StackTraces ScriptDebugServer::currentCallFramesForAsyncStack()
366 { 367 {
367 return currentCallFramesInner(FastAsyncScopes); 368 return currentCallFramesInner(FastAsyncScopes);
368 } 369 }
369 370
370 ScriptCallFrame ScriptDebugServer::topCallFrameNoScopes() 371 ScriptCallFrame ScriptDebugServer::topCallFrameNoScopes()
371 { 372 {
372 RefPtrWillBeRawPtr<JavaScriptCallFrame> jsCallFrame = wrapCallFrames(1, NoSc opes); 373 RefPtrWillBeRawPtr<JavaScriptCallFrame> jsCallFrame = wrapCallFrames(1, NoSc opes);
373 if (!jsCallFrame) 374 if (!jsCallFrame)
374 return ScriptCallFrame(); 375 return ScriptCallFrame();
375 return ScriptCallFrame(jsCallFrame->functionName(), 376 return ScriptCallFrame(jsCallFrame->functionName(),
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
419 breakpointIds.resize(hitBreakpointNumbers->Length()); 420 breakpointIds.resize(hitBreakpointNumbers->Length());
420 for (size_t i = 0; i < hitBreakpointNumbers->Length(); i++) { 421 for (size_t i = 0; i < hitBreakpointNumbers->Length(); i++) {
421 v8::Handle<v8::Value> hitBreakpointNumber = hitBreakpointNumbers->Ge t(i); 422 v8::Handle<v8::Value> hitBreakpointNumber = hitBreakpointNumbers->Ge t(i);
422 ASSERT(!hitBreakpointNumber.IsEmpty() && hitBreakpointNumber->IsInt3 2()); 423 ASSERT(!hitBreakpointNumber.IsEmpty() && hitBreakpointNumber->IsInt3 2());
423 breakpointIds[i] = String::number(hitBreakpointNumber->Int32Value()) ; 424 breakpointIds[i] = String::number(hitBreakpointNumber->Int32Value()) ;
424 } 425 }
425 } 426 }
426 427
427 m_pausedScriptState = pausedScriptState; 428 m_pausedScriptState = pausedScriptState;
428 m_executionState = executionState; 429 m_executionState = executionState;
429 ScriptDebugListener::SkipPauseRequest result = listener->didPause(pausedScri ptState, currentCallFrames(), ScriptValue(pausedScriptState->v8ScriptState(), ex ception), breakpointIds); 430
431 ScriptDebugListener::SkipPauseRequest result = listener->didPause(pausedScri ptState, ScriptValue(pausedScriptState->v8ScriptState(), exception), breakpointI ds);
430 if (result == ScriptDebugListener::NoSkip) { 432 if (result == ScriptDebugListener::NoSkip) {
431 m_runningNestedMessageLoop = true; 433 m_runningNestedMessageLoop = true;
432 runMessageLoopOnPause(pausedScriptState->v8ScriptState()->context()); 434 runMessageLoopOnPause(pausedScriptState->v8ScriptState()->context());
433 m_runningNestedMessageLoop = false; 435 m_runningNestedMessageLoop = false;
434 } 436 }
435 m_pausedScriptState.clear(); 437 m_pausedScriptState.clear();
436 m_executionState.Clear(); 438 m_executionState.Clear();
437 439
438 if (result == ScriptDebugListener::StepInto) { 440 if (result == ScriptDebugListener::StepInto) {
439 v8::Handle<v8::Value> argv[] = { executionState }; 441 v8::Handle<v8::Value> argv[] = { executionState };
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
644 { 646 {
645 return PassOwnPtr<ScriptSourceCode>(); 647 return PassOwnPtr<ScriptSourceCode>();
646 } 648 }
647 649
648 String ScriptDebugServer::preprocessEventListener(LocalFrame*, const String& sou rce, const String& url, const String& functionName) 650 String ScriptDebugServer::preprocessEventListener(LocalFrame*, const String& sou rce, const String& url, const String& functionName)
649 { 651 {
650 return source; 652 return source;
651 } 653 }
652 654
653 } // namespace WebCore 655 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/bindings/v8/ScriptDebugServer.h ('k') | Source/core/inspector/AsyncCallStackTracker.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698