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

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

Issue 310463003: DevTools: introduce TargetBreakpoints as a presentation of breakpoint and its state within target (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix quadratic complexity Created 6 years, 6 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 30 matching lines...) Expand all
41 this._agent = target.debuggerAgent(); 41 this._agent = target.debuggerAgent();
42 42
43 /** @type {?WebInspector.DebuggerPausedDetails} */ 43 /** @type {?WebInspector.DebuggerPausedDetails} */
44 this._debuggerPausedDetails = null; 44 this._debuggerPausedDetails = null;
45 /** @type {!Object.<string, !WebInspector.Script>} */ 45 /** @type {!Object.<string, !WebInspector.Script>} */
46 this._scripts = {}; 46 this._scripts = {};
47 /** @type {!StringMap.<!Array.<!WebInspector.Script>>} */ 47 /** @type {!StringMap.<!Array.<!WebInspector.Script>>} */
48 this._scriptsBySourceURL = new StringMap(); 48 this._scriptsBySourceURL = new StringMap();
49 49
50 this._breakpointsActive = true; 50 this._breakpointsActive = true;
51 /** @type {!StringMap.<!WebInspector.DebuggerModel.BreakpointListener>} */
52 this._breakpointListenerById = new StringMap();
vsevik 2014/06/05 15:48:29 Let's have this._breakpointResolvedEventTarget = n
sergeyv 2014/06/06 11:44:53 Done.
51 53
52 WebInspector.settings.pauseOnExceptionEnabled.addChangeListener(this._pauseO nExceptionStateChanged, this); 54 WebInspector.settings.pauseOnExceptionEnabled.addChangeListener(this._pauseO nExceptionStateChanged, this);
53 WebInspector.settings.pauseOnCaughtException.addChangeListener(this._pauseOn ExceptionStateChanged, this); 55 WebInspector.settings.pauseOnCaughtException.addChangeListener(this._pauseOn ExceptionStateChanged, this);
54 56
55 WebInspector.settings.enableAsyncStackTraces.addChangeListener(this._asyncSt ackTracesStateChanged, this); 57 WebInspector.settings.enableAsyncStackTraces.addChangeListener(this._asyncSt ackTracesStateChanged, this);
56 target.profilingLock.addEventListener(WebInspector.Lock.Events.StateChanged, this._asyncStackTracesStateChanged, this); 58 target.profilingLock.addEventListener(WebInspector.Lock.Events.StateChanged, this._asyncStackTracesStateChanged, this);
57 59
58 this.enableDebugger(); 60 this.enableDebugger();
59 61
60 WebInspector.settings.skipStackFramesSwitch.addChangeListener(this._applySki pStackFrameSettings, this); 62 WebInspector.settings.skipStackFramesSwitch.addChangeListener(this._applySki pStackFrameSettings, this);
(...skipping 12 matching lines...) Expand all
73 PauseOnUncaughtExceptions: "uncaught" 75 PauseOnUncaughtExceptions: "uncaught"
74 }; 76 };
75 77
76 WebInspector.DebuggerModel.Events = { 78 WebInspector.DebuggerModel.Events = {
77 DebuggerWasEnabled: "DebuggerWasEnabled", 79 DebuggerWasEnabled: "DebuggerWasEnabled",
78 DebuggerWasDisabled: "DebuggerWasDisabled", 80 DebuggerWasDisabled: "DebuggerWasDisabled",
79 DebuggerPaused: "DebuggerPaused", 81 DebuggerPaused: "DebuggerPaused",
80 DebuggerResumed: "DebuggerResumed", 82 DebuggerResumed: "DebuggerResumed",
81 ParsedScriptSource: "ParsedScriptSource", 83 ParsedScriptSource: "ParsedScriptSource",
82 FailedToParseScriptSource: "FailedToParseScriptSource", 84 FailedToParseScriptSource: "FailedToParseScriptSource",
83 BreakpointResolved: "BreakpointResolved",
84 GlobalObjectCleared: "GlobalObjectCleared", 85 GlobalObjectCleared: "GlobalObjectCleared",
85 CallFrameSelected: "CallFrameSelected", 86 CallFrameSelected: "CallFrameSelected",
86 ConsoleCommandEvaluatedInSelectedCallFrame: "ConsoleCommandEvaluatedInSelect edCallFrame", 87 ConsoleCommandEvaluatedInSelectedCallFrame: "ConsoleCommandEvaluatedInSelect edCallFrame",
87 BreakpointsActiveStateChanged: "BreakpointsActiveStateChanged" 88 BreakpointsActiveStateChanged: "BreakpointsActiveStateChanged"
88 } 89 }
89 90
90 WebInspector.DebuggerModel.BreakReason = { 91 WebInspector.DebuggerModel.BreakReason = {
91 DOM: "DOM", 92 DOM: "DOM",
92 EventListener: "EventListener", 93 EventListener: "EventListener",
93 XHR: "XHR", 94 XHR: "XHR",
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 callback(); 324 callback();
324 } 325 }
325 }, 326 },
326 327
327 /** 328 /**
328 * @param {!DebuggerAgent.BreakpointId} breakpointId 329 * @param {!DebuggerAgent.BreakpointId} breakpointId
329 * @param {!DebuggerAgent.Location} location 330 * @param {!DebuggerAgent.Location} location
330 */ 331 */
331 _breakpointResolved: function(breakpointId, location) 332 _breakpointResolved: function(breakpointId, location)
332 { 333 {
333 this.dispatchEventToListeners(WebInspector.DebuggerModel.Events.Breakpoi ntResolved, {breakpointId: breakpointId, location: WebInspector.DebuggerModel.Lo cation.fromPayload(this.target(), location)}); 334 var breakpointListener = this._breakpointListenerById.get(breakpointId);
335 if (breakpointListener) {
336 var debuggerLocation = WebInspector.DebuggerModel.Location.fromPaylo ad(this.target(), location);
337 breakpointListener.breakpointResolved(debuggerLocation)
338 }
334 }, 339 },
335 340
336 _globalObjectCleared: function() 341 _globalObjectCleared: function()
337 { 342 {
338 this._setDebuggerPausedDetails(null); 343 this._setDebuggerPausedDetails(null);
339 this._reset(); 344 this._reset();
340 this.dispatchEventToListeners(WebInspector.DebuggerModel.Events.GlobalOb jectCleared); 345 this.dispatchEventToListeners(WebInspector.DebuggerModel.Events.GlobalOb jectCleared);
341 }, 346 },
342 347
343 _reset: function() 348 _reset: function()
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after
699 { 704 {
700 if (error) { 705 if (error) {
701 console.error(error); 706 console.error(error);
702 callback(null); 707 callback(null);
703 return; 708 return;
704 } 709 }
705 callback(response); 710 callback(response);
706 } 711 }
707 }, 712 },
708 713
714 /**
715 * @param {!DebuggerAgent.BreakpointId} breakpointId
716 * @param {!WebInspector.DebuggerModel.BreakpointListener} listener
717 */
718 registerBreakpointListenerForId: function(breakpointId, listener)
719 {
720 this._breakpointListenerById.put(breakpointId, listener);
721 },
722
723 /**
724 * @param {!DebuggerAgent.BreakpointId} breakpointId
725 */
726 unregisterBreakpointListenerForId: function(breakpointId)
727 {
728 this._breakpointListenerById.remove(breakpointId);
729 },
730
709 __proto__: WebInspector.TargetAwareObject.prototype 731 __proto__: WebInspector.TargetAwareObject.prototype
710 } 732 }
711 733
712 WebInspector.DebuggerEventTypes = { 734 WebInspector.DebuggerEventTypes = {
713 JavaScriptPause: 0, 735 JavaScriptPause: 0,
714 JavaScriptBreakpoint: 1, 736 JavaScriptBreakpoint: 1,
715 NativeBreakpoint: 2 737 NativeBreakpoint: 2
716 }; 738 };
717 739
718 /** 740 /**
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
785 * @param {!DebuggerAgent.BreakpointId} breakpointId 807 * @param {!DebuggerAgent.BreakpointId} breakpointId
786 * @param {!DebuggerAgent.Location} location 808 * @param {!DebuggerAgent.Location} location
787 */ 809 */
788 breakpointResolved: function(breakpointId, location) 810 breakpointResolved: function(breakpointId, location)
789 { 811 {
790 this._debuggerModel._breakpointResolved(breakpointId, location); 812 this._debuggerModel._breakpointResolved(breakpointId, location);
791 } 813 }
792 } 814 }
793 815
794 /** 816 /**
817 * @interface
818 */
819 WebInspector.DebuggerModel.BreakpointListener = function() {
820 }
821
822 WebInspector.DebuggerModel.BreakpointListener.prototype = {
823
824 /**
825 * @param {!WebInspector.DebuggerModel.Location} location
826 */
827 breakpointResolved: function(location) { }
828
829 }
830
831 /**
795 * @constructor 832 * @constructor
796 * @implements {WebInspector.RawLocation} 833 * @implements {WebInspector.RawLocation}
797 * @extends {WebInspector.TargetAware} 834 * @extends {WebInspector.TargetAware}
798 * @param {!WebInspector.Target} target 835 * @param {!WebInspector.Target} target
799 * @param {string} scriptId 836 * @param {string} scriptId
800 * @param {number} lineNumber 837 * @param {number} lineNumber
801 * @param {number=} columnNumber 838 * @param {number=} columnNumber
802 */ 839 */
803 WebInspector.DebuggerModel.Location = function(target, scriptId, lineNumber, col umnNumber) 840 WebInspector.DebuggerModel.Location = function(target, scriptId, lineNumber, col umnNumber)
804 { 841 {
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
1130 this.asyncStackTrace.dispose(); 1167 this.asyncStackTrace.dispose();
1131 }, 1168 },
1132 1169
1133 __proto__: WebInspector.TargetAware.prototype 1170 __proto__: WebInspector.TargetAware.prototype
1134 } 1171 }
1135 1172
1136 /** 1173 /**
1137 * @type {!WebInspector.DebuggerModel} 1174 * @type {!WebInspector.DebuggerModel}
1138 */ 1175 */
1139 WebInspector.debuggerModel; 1176 WebInspector.debuggerModel;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698