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

Side by Side Diff: third_party/WebKit/Source/platform/v8_inspector/DebuggerScript.js

Issue 1838683002: [DevTools] Debugger::currentCallFrames returns array instead linked list (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@wrap-with-corrrect-injected-script
Patch Set: Created 4 years, 9 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 /* 1 /*
2 * Copyright (C) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 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 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 Debug.clearBreakOnException(); 267 Debug.clearBreakOnException();
268 268
269 if (DebuggerScript.PauseOnExceptionsState.PauseOnUncaughtExceptions === newS tate) 269 if (DebuggerScript.PauseOnExceptionsState.PauseOnUncaughtExceptions === newS tate)
270 Debug.setBreakOnUncaughtException(); 270 Debug.setBreakOnUncaughtException();
271 else 271 else
272 Debug.clearBreakOnUncaughtException(); 272 Debug.clearBreakOnUncaughtException();
273 } 273 }
274 274
275 /** 275 /**
276 * @param {!ExecutionState} execState 276 * @param {!ExecutionState} execState
277 * @return {number} 277 * @param {number} limit
278 * @return {!Array<!JavaScriptCallFrame>}
278 */ 279 */
279 DebuggerScript.frameCount = function(execState) 280 DebuggerScript.currentCallFrames = function(execState, limit)
280 { 281 {
281 return execState.frameCount(); 282 var frames = [];
283 for (var i = 0; i < execState.frameCount() && (!limit || i < limit); ++i)
284 frames.push(DebuggerScript._frameMirrorToJSCallFrame(execState.frame(i)) );
285 return frames;
282 } 286 }
283 287
284 /** 288 /**
285 * @param {!ExecutionState} execState
286 * @return {!JavaScriptCallFrame|undefined}
287 */
288 DebuggerScript.currentCallFrame = function(execState)
289 {
290 var frameCount = execState.frameCount();
291 var topFrame = undefined;
292 for (var i = frameCount - 1; i >= 0; i--) {
293 var frameMirror = execState.frame(i);
294 topFrame = DebuggerScript._frameMirrorToJSCallFrame(frameMirror, topFram e);
295 }
296 return topFrame;
297 }
298
299 /**
300 * @param {!ExecutionState} execState
301 * @param {number} index
302 * @return {!JavaScriptCallFrame|undefined}
303 */
304 DebuggerScript.currentCallFrameByIndex = function(execState, index)
305 {
306 if (index < 0)
307 return undefined;
308 var frameCount = execState.frameCount();
309 if (index >= frameCount)
310 return undefined;
311 return DebuggerScript._frameMirrorToJSCallFrame(execState.frame(index), unde fined);
312 }
313
314 /**
315 * @param {!ExecutionState} execState 289 * @param {!ExecutionState} execState
316 */ 290 */
317 DebuggerScript.stepIntoStatement = function(execState) 291 DebuggerScript.stepIntoStatement = function(execState)
318 { 292 {
319 execState.prepareStep(Debug.StepAction.StepIn); 293 execState.prepareStep(Debug.StepAction.StepIn);
320 } 294 }
321 295
322 /** 296 /**
323 * @param {!ExecutionState} execState 297 * @param {!ExecutionState} execState
324 */ 298 */
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
420 numbers.push(scriptBreakPoint ? scriptBreakPoint.number() : breakpoint.n umber()); 394 numbers.push(scriptBreakPoint ? scriptBreakPoint.number() : breakpoint.n umber());
421 } 395 }
422 return numbers; 396 return numbers;
423 } 397 }
424 398
425 // NOTE: This function is performance critical, as it can be run on every 399 // NOTE: This function is performance critical, as it can be run on every
426 // statement that generates an async event (like addEventListener) to support 400 // statement that generates an async event (like addEventListener) to support
427 // asynchronous call stacks. Thus, when possible, initialize the data lazily. 401 // asynchronous call stacks. Thus, when possible, initialize the data lazily.
428 /** 402 /**
429 * @param {!FrameMirror} frameMirror 403 * @param {!FrameMirror} frameMirror
430 * @param {!JavaScriptCallFrame|undefined} callerFrame
431 * @return {!JavaScriptCallFrame} 404 * @return {!JavaScriptCallFrame}
432 */ 405 */
433 DebuggerScript._frameMirrorToJSCallFrame = function(frameMirror, callerFrame) 406 DebuggerScript._frameMirrorToJSCallFrame = function(frameMirror)
434 { 407 {
435 // Stuff that can not be initialized lazily (i.e. valid while paused with a valid break_id). 408 // Stuff that can not be initialized lazily (i.e. valid while paused with a valid break_id).
436 // The frameMirror and scopeMirror can be accessed only while paused on the debugger. 409 // The frameMirror and scopeMirror can be accessed only while paused on the debugger.
437 var frameDetails = frameMirror.details(); 410 var frameDetails = frameMirror.details();
438 411
439 var funcObject = frameDetails.func(); 412 var funcObject = frameDetails.func();
440 var sourcePosition = frameDetails.sourcePosition(); 413 var sourcePosition = frameDetails.sourcePosition();
441 var thisObject = frameDetails.receiver(); 414 var thisObject = frameDetails.receiver();
442 415
443 var isAtReturn = !!frameDetails.isAtReturn(); 416 var isAtReturn = !!frameDetails.isAtReturn();
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
667 scopeMirror.setVariableValue(variableName, newValue); 640 scopeMirror.setVariableValue(variableName, newValue);
668 } 641 }
669 642
670 return { 643 return {
671 "sourceID": sourceID, 644 "sourceID": sourceID,
672 "line": line, 645 "line": line,
673 "column": column, 646 "column": column,
674 "contextId": contextId, 647 "contextId": contextId,
675 "thisObject": thisObject, 648 "thisObject": thisObject,
676 "evaluate": evaluate, 649 "evaluate": evaluate,
677 "caller": callerFrame,
678 "restart": restart, 650 "restart": restart,
679 "setVariableValue": setVariableValue, 651 "setVariableValue": setVariableValue,
680 "isAtReturn": isAtReturn, 652 "isAtReturn": isAtReturn,
681 "details": lazyDetails 653 "details": lazyDetails
682 }; 654 };
683 } 655 }
684 656
685 /** 657 /**
686 * @param {number} scopeType 658 * @param {number} scopeType
687 * @param {!Object} scopeObject 659 * @param {!Object} scopeObject
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
719 break; 691 break;
720 } 692 }
721 return result; 693 return result;
722 } 694 }
723 695
724 // We never resolve Mirror by its handle so to avoid memory leaks caused by Mirr ors in the cache we disable it. 696 // We never resolve Mirror by its handle so to avoid memory leaks caused by Mirr ors in the cache we disable it.
725 ToggleMirrorCache(false); 697 ToggleMirrorCache(false);
726 698
727 return DebuggerScript; 699 return DebuggerScript;
728 })(); 700 })();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698