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

Side by Side Diff: Source/devtools/front_end/sdk/DebuggerModel.js

Issue 299443016: DevTools: Decouple debugger model from UI entities (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Merge DebuggerScriptMapping into DebuggerWorkspaceBinding Created 6 years, 4 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 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 418 matching lines...) Expand 10 before | Expand all | Expand 10 after
429 { 429 {
430 return this._debuggerPausedDetails; 430 return this._debuggerPausedDetails;
431 }, 431 },
432 432
433 /** 433 /**
434 * @param {?WebInspector.DebuggerPausedDetails} debuggerPausedDetails 434 * @param {?WebInspector.DebuggerPausedDetails} debuggerPausedDetails
435 */ 435 */
436 _setDebuggerPausedDetails: function(debuggerPausedDetails) 436 _setDebuggerPausedDetails: function(debuggerPausedDetails)
437 { 437 {
438 this._isPausing = false; 438 this._isPausing = false;
439 if (this._debuggerPausedDetails)
440 this._debuggerPausedDetails.dispose();
441 this._debuggerPausedDetails = debuggerPausedDetails; 439 this._debuggerPausedDetails = debuggerPausedDetails;
442 if (this._debuggerPausedDetails) 440 if (this._debuggerPausedDetails)
443 this.dispatchEventToListeners(WebInspector.DebuggerModel.Events.Debu ggerPaused, this._debuggerPausedDetails); 441 this.dispatchEventToListeners(WebInspector.DebuggerModel.Events.Debu ggerPaused, this._debuggerPausedDetails);
444 if (debuggerPausedDetails) { 442 if (debuggerPausedDetails) {
445 this.setSelectedCallFrame(debuggerPausedDetails.callFrames[0]); 443 this.setSelectedCallFrame(debuggerPausedDetails.callFrames[0]);
446 this._agent.setOverlayMessage(WebInspector.UIString("Paused in debug ger")); 444 this._agent.setOverlayMessage(WebInspector.UIString("Paused in debug ger"));
447 } else { 445 } else {
448 this.setSelectedCallFrame(null); 446 this.setSelectedCallFrame(null);
449 this._agent.setOverlayMessage(); 447 this._agent.setOverlayMessage();
450 } 448 }
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
654 652
655 for (var i = 0; i < selectedCallFrame.scopeChain.length; ++i) { 653 for (var i = 0; i < selectedCallFrame.scopeChain.length; ++i) {
656 var scope = selectedCallFrame.scopeChain[i]; 654 var scope = selectedCallFrame.scopeChain[i];
657 var object = this.target().runtimeModel.createRemoteObject(scope.obj ect); 655 var object = this.target().runtimeModel.createRemoteObject(scope.obj ect);
658 pendingRequests++; 656 pendingRequests++;
659 object.getAllProperties(false, propertiesCollected); 657 object.getAllProperties(false, propertiesCollected);
660 } 658 }
661 }, 659 },
662 660
663 /** 661 /**
664 * @param {!WebInspector.DebuggerModel.Location} rawLocation
665 * @param {function(!WebInspector.UILocation):(boolean|undefined)} updateDel egate
666 * @return {!WebInspector.Script.Location}
667 */
668 createLiveLocation: function(rawLocation, updateDelegate)
669 {
670 var script = this._scripts[rawLocation.scriptId];
671 return script.createLiveLocation(rawLocation, updateDelegate);
672 },
673
674 /**
675 * @param {!WebInspector.DebuggerModel.Location} rawLocation
676 * @return {?WebInspector.UILocation}
677 */
678 rawLocationToUILocation: function(rawLocation)
679 {
680 var script = this._scripts[rawLocation.scriptId];
681 if (!script)
682 return null;
683 return script.rawLocationToUILocation(rawLocation.lineNumber, rawLocatio n.columnNumber);
684 },
685
686 /**
687 * Handles notification from JavaScript VM about updated stack (liveedit or frame restart action). 662 * Handles notification from JavaScript VM about updated stack (liveedit or frame restart action).
688 * @param {!Array.<!DebuggerAgent.CallFrame>=} newCallFrames 663 * @param {!Array.<!DebuggerAgent.CallFrame>=} newCallFrames
689 * @param {!Object=} details 664 * @param {!Object=} details
690 * @param {!DebuggerAgent.StackTrace=} asyncStackTrace 665 * @param {!DebuggerAgent.StackTrace=} asyncStackTrace
691 */ 666 */
692 callStackModified: function(newCallFrames, details, asyncStackTrace) 667 callStackModified: function(newCallFrames, details, asyncStackTrace)
693 { 668 {
694 // FIXME: declare this property in protocol and in JavaScript. 669 // FIXME: declare this property in protocol and in JavaScript.
695 if (details && details["stack_update_needs_step_in"]) 670 if (details && details["stack_update_needs_step_in"])
696 this.stepInto(); 671 this.stepInto();
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
889 }, 864 },
890 865
891 /** 866 /**
892 * @return {!WebInspector.Script} 867 * @return {!WebInspector.Script}
893 */ 868 */
894 script: function() 869 script: function()
895 { 870 {
896 return this._debuggerModel.scriptForId(this.scriptId); 871 return this._debuggerModel.scriptForId(this.scriptId);
897 }, 872 },
898 873
899 /**
900 * @param {function(!WebInspector.UILocation):(boolean|undefined)} updateDel egate
901 * @return {!WebInspector.Script.Location}
902 */
903 createLiveLocation: function(updateDelegate)
904 {
905 return this._debuggerModel.createLiveLocation(this, updateDelegate);
906 },
907
908 continueToLocation: function() 874 continueToLocation: function()
909 { 875 {
910 this._debuggerModel._agent.continueToLocation(this.payload()); 876 this._debuggerModel._agent.continueToLocation(this.payload());
911 }, 877 },
912 878
913 /** 879 /**
914 * @return {string} 880 * @return {string}
915 */ 881 */
916 id: function() 882 id: function()
917 { 883 {
(...skipping 10 matching lines...) Expand all
928 * @param {!WebInspector.Script} script 894 * @param {!WebInspector.Script} script
929 * @param {!DebuggerAgent.CallFrame} payload 895 * @param {!DebuggerAgent.CallFrame} payload
930 * @param {boolean=} isAsync 896 * @param {boolean=} isAsync
931 */ 897 */
932 WebInspector.DebuggerModel.CallFrame = function(target, script, payload, isAsync ) 898 WebInspector.DebuggerModel.CallFrame = function(target, script, payload, isAsync )
933 { 899 {
934 WebInspector.SDKObject.call(this, target); 900 WebInspector.SDKObject.call(this, target);
935 this._debuggerAgent = target.debuggerModel._agent; 901 this._debuggerAgent = target.debuggerModel._agent;
936 this._script = script; 902 this._script = script;
937 this._payload = payload; 903 this._payload = payload;
938 /** @type {!Array.<!WebInspector.Script.Location>} */
939 this._liveLocations = [];
940 this._isAsync = isAsync; 904 this._isAsync = isAsync;
941 this._location = WebInspector.DebuggerModel.Location.fromPayload(target, pay load.location); 905 this._location = WebInspector.DebuggerModel.Location.fromPayload(target, pay load.location);
942 } 906 }
943 907
944 /** 908 /**
945 * @param {!WebInspector.Target} target 909 * @param {!WebInspector.Target} target
946 * @param {!Array.<!DebuggerAgent.CallFrame>} callFrames 910 * @param {!Array.<!DebuggerAgent.CallFrame>} callFrames
947 * @param {boolean=} isAsync 911 * @param {boolean=} isAsync
948 * @return {!Array.<!WebInspector.DebuggerModel.CallFrame>} 912 * @return {!Array.<!WebInspector.DebuggerModel.CallFrame>}
949 */ 913 */
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
1077 function protocolCallback(error, callFrames, details, asyncStackTrace) 1041 function protocolCallback(error, callFrames, details, asyncStackTrace)
1078 { 1042 {
1079 if (!error) 1043 if (!error)
1080 this.target().debuggerModel.callStackModified(callFrames, detail s, asyncStackTrace); 1044 this.target().debuggerModel.callStackModified(callFrames, detail s, asyncStackTrace);
1081 if (callback) 1045 if (callback)
1082 callback(error); 1046 callback(error);
1083 } 1047 }
1084 this._debuggerAgent.restartFrame(this._payload.callFrameId, protocolCall back.bind(this)); 1048 this._debuggerAgent.restartFrame(this._payload.callFrameId, protocolCall back.bind(this));
1085 }, 1049 },
1086 1050
1087 /**
1088 * @param {function(!WebInspector.UILocation):(boolean|undefined)} updateDel egate
1089 * @return {!WebInspector.Script.Location}
1090 */
1091 createLiveLocation: function(updateDelegate)
1092 {
1093 var liveLocation = this._location.createLiveLocation(updateDelegate);
1094 this._liveLocations.push(liveLocation);
1095 return liveLocation;
1096 },
1097
1098 dispose: function()
1099 {
1100 for (var i = 0; i < this._liveLocations.length; ++i)
1101 this._liveLocations[i].dispose();
1102 this._liveLocations = [];
1103 },
1104
1105 __proto__: WebInspector.SDKObject.prototype 1051 __proto__: WebInspector.SDKObject.prototype
1106 } 1052 }
1107 1053
1108 /** 1054 /**
1109 * @constructor 1055 * @constructor
1110 * @param {!Array.<!WebInspector.DebuggerModel.CallFrame>} callFrames 1056 * @param {!Array.<!WebInspector.DebuggerModel.CallFrame>} callFrames
1111 * @param {?WebInspector.DebuggerModel.StackTrace} asyncStackTrace 1057 * @param {?WebInspector.DebuggerModel.StackTrace} asyncStackTrace
1112 * @param {string=} description 1058 * @param {string=} description
1113 */ 1059 */
1114 WebInspector.DebuggerModel.StackTrace = function(callFrames, asyncStackTrace, de scription) 1060 WebInspector.DebuggerModel.StackTrace = function(callFrames, asyncStackTrace, de scription)
(...skipping 13 matching lines...) Expand all
1128 { 1074 {
1129 if (!payload) 1075 if (!payload)
1130 return null; 1076 return null;
1131 var callFrames = WebInspector.DebuggerModel.CallFrame.fromPayloadArray(targe t, payload.callFrames, isAsync); 1077 var callFrames = WebInspector.DebuggerModel.CallFrame.fromPayloadArray(targe t, payload.callFrames, isAsync);
1132 if (!callFrames.length) 1078 if (!callFrames.length)
1133 return null; 1079 return null;
1134 var asyncStackTrace = WebInspector.DebuggerModel.StackTrace.fromPayload(targ et, payload.asyncStackTrace, true); 1080 var asyncStackTrace = WebInspector.DebuggerModel.StackTrace.fromPayload(targ et, payload.asyncStackTrace, true);
1135 return new WebInspector.DebuggerModel.StackTrace(callFrames, asyncStackTrace , payload.description); 1081 return new WebInspector.DebuggerModel.StackTrace(callFrames, asyncStackTrace , payload.description);
1136 } 1082 }
1137 1083
1138 WebInspector.DebuggerModel.StackTrace.prototype = {
1139 dispose: function()
1140 {
1141 for (var i = 0; i < this.callFrames.length; ++i)
1142 this.callFrames[i].dispose();
1143 if (this.asyncStackTrace)
1144 this.asyncStackTrace.dispose();
1145 }
1146 }
1147
1148 /** 1084 /**
1149 * @constructor 1085 * @constructor
1150 * @extends {WebInspector.SDKObject} 1086 * @extends {WebInspector.SDKObject}
1151 * @param {!WebInspector.Target} target 1087 * @param {!WebInspector.Target} target
1152 * @param {!Array.<!DebuggerAgent.CallFrame>} callFrames 1088 * @param {!Array.<!DebuggerAgent.CallFrame>} callFrames
1153 * @param {string} reason 1089 * @param {string} reason
1154 * @param {!Object|undefined} auxData 1090 * @param {!Object|undefined} auxData
1155 * @param {!Array.<string>} breakpointIds 1091 * @param {!Array.<string>} breakpointIds
1156 * @param {!DebuggerAgent.StackTrace=} asyncStackTrace 1092 * @param {!DebuggerAgent.StackTrace=} asyncStackTrace
1157 */ 1093 */
(...skipping 11 matching lines...) Expand all
1169 /** 1105 /**
1170 * @return {?WebInspector.RemoteObject} 1106 * @return {?WebInspector.RemoteObject}
1171 */ 1107 */
1172 exception: function() 1108 exception: function()
1173 { 1109 {
1174 if (this.reason !== WebInspector.DebuggerModel.BreakReason.Exception) 1110 if (this.reason !== WebInspector.DebuggerModel.BreakReason.Exception)
1175 return null; 1111 return null;
1176 return this.target().runtimeModel.createRemoteObject(/** @type {!Runtime Agent.RemoteObject} */(this.auxData)); 1112 return this.target().runtimeModel.createRemoteObject(/** @type {!Runtime Agent.RemoteObject} */(this.auxData));
1177 }, 1113 },
1178 1114
1179 dispose: function()
1180 {
1181 for (var i = 0; i < this.callFrames.length; ++i)
1182 this.callFrames[i].dispose();
1183 if (this.asyncStackTrace)
1184 this.asyncStackTrace.dispose();
1185 },
1186
1187 __proto__: WebInspector.SDKObject.prototype 1115 __proto__: WebInspector.SDKObject.prototype
1188 } 1116 }
1189 1117
1190 /** 1118 /**
1191 * @type {!WebInspector.DebuggerModel} 1119 * @type {!WebInspector.DebuggerModel}
1192 */ 1120 */
1193 WebInspector.debuggerModel; 1121 WebInspector.debuggerModel;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698