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

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
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 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
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->merge(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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 StackTrace ScriptDebugServer::currentCallFramesInner(ScopeInfoDetails scopeDetai ls)
346 { 346 {
347 if (!m_isolate->InContext()) 347 if (!m_isolate->InContext())
348 return StackTrace(ScriptValue()); 348 return StackTrace();
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 StackTrace();
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 StackTrace(ScriptValue(scriptState, toV8(currentCallFrame.release(), scriptState->context()->Global(), m_isolate)), scriptState);
358 } 358 }
359 359
360
360 StackTrace ScriptDebugServer::currentCallFrames() 361 StackTrace ScriptDebugServer::currentCallFrames()
361 { 362 {
362 return currentCallFramesInner(AllScopes); 363 return currentCallFramesInner(AllScopes);
363 } 364 }
364 365
365 StackTrace ScriptDebugServer::currentCallFramesForAsyncStack() 366 StackTrace ScriptDebugServer::currentCallFramesForAsyncStack()
366 { 367 {
367 return currentCallFramesInner(FastAsyncScopes); 368 return currentCallFramesInner(FastAsyncScopes);
368 } 369 }
369 370
(...skipping 49 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

Powered by Google App Engine
This is Rietveld 408576698