OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 * @return {?WebInspector.BreakpointManager.Breakpoint} | 126 * @return {?WebInspector.BreakpointManager.Breakpoint} |
127 */ | 127 */ |
128 findBreakpoint: function(uiSourceCode, lineNumber) | 128 findBreakpoint: function(uiSourceCode, lineNumber) |
129 { | 129 { |
130 var breakpoints = this._breakpointsForUISourceCode.get(uiSourceCode); | 130 var breakpoints = this._breakpointsForUISourceCode.get(uiSourceCode); |
131 var lineBreakpoints = breakpoints ? breakpoints[lineNumber] : null; | 131 var lineBreakpoints = breakpoints ? breakpoints[lineNumber] : null; |
132 return lineBreakpoints ? lineBreakpoints[0] : null; | 132 return lineBreakpoints ? lineBreakpoints[0] : null; |
133 }, | 133 }, |
134 | 134 |
135 /** | 135 /** |
136 * @param {WebInspector.UISourceCode} uiSourceCode | 136 * @param {function(WebInspector.BreakpointManager.Breakpoint, WebInspector.
UILocation)} filter |
137 * @return {Array.<Object>} | 137 * @return {Array.<{breakpoint: WebInspector.BreakpointManager.Breakpoint, u
iLocation: WebInspector.UILocation}>} |
138 */ | 138 */ |
139 breakpointLocationsForUISourceCode: function(uiSourceCode) | 139 _filteredBreakpointLocations: function(filter) |
140 { | 140 { |
141 var result = []; | 141 var result = []; |
142 for (var i = 0; i < this._breakpoints.length; ++i) { | 142 for (var i = 0; i < this._breakpoints.length; ++i) { |
143 var breakpoint = this._breakpoints[i]; | 143 var breakpoint = this._breakpoints[i]; |
144 for (var stringifiedLocation in breakpoint._uiLocations) { | 144 for (var stringifiedLocation in breakpoint._uiLocations) { |
145 var uiLocation = breakpoint._uiLocations[stringifiedLocation]; | 145 var uiLocation = breakpoint._uiLocations[stringifiedLocation]; |
146 if (uiLocation.uiSourceCode === uiSourceCode) | 146 if (filter(breakpoint, uiLocation)) |
147 result.push({breakpoint: breakpoint, uiLocation: uiLocation}
); | 147 result.push({breakpoint: breakpoint, uiLocation: uiLocation}
); |
148 } | 148 } |
149 } | 149 } |
150 return result; | 150 return result; |
151 }, | 151 }, |
152 | 152 |
153 /** | 153 /** |
| 154 * @param {WebInspector.UISourceCode} uiSourceCode |
| 155 * @return {Array.<{breakpoint: WebInspector.BreakpointManager.Breakpoint, u
iLocation: WebInspector.UILocation}>} |
| 156 */ |
| 157 breakpointLocationsForUISourceCode: function(uiSourceCode) |
| 158 { |
| 159 function filter(breakpoint, uiLocation) |
| 160 { |
| 161 return uiLocation.uiSourceCode === uiSourceCode; |
| 162 } |
| 163 |
| 164 return this._filteredBreakpointLocations(filter); |
| 165 }, |
| 166 |
| 167 /** |
| 168 * @return {Array.<{breakpoint: WebInspector.BreakpointManager.Breakpoint, u
iLocation: WebInspector.UILocation}>} |
| 169 */ |
| 170 allBreakpointLocations: function() |
| 171 { |
| 172 return this._filteredBreakpointLocations(function(breakpoint, uiLocation
) { return true; }); |
| 173 }, |
| 174 |
| 175 /** |
154 * @param {boolean} toggleState | 176 * @param {boolean} toggleState |
155 */ | 177 */ |
156 toggleAllBreakpoints: function(toggleState) | 178 toggleAllBreakpoints: function(toggleState) |
157 { | 179 { |
158 for (var i = 0; i < this._breakpoints.length; ++i) { | 180 for (var i = 0; i < this._breakpoints.length; ++i) { |
159 var breakpoint = this._breakpoints[i]; | 181 var breakpoint = this._breakpoints[i]; |
160 if (breakpoint.enabled() != toggleState) | 182 if (breakpoint.enabled() != toggleState) |
161 breakpoint.setEnabled(toggleState); | 183 breakpoint.setEnabled(toggleState); |
162 } | 184 } |
163 }, | 185 }, |
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
540 { | 562 { |
541 var primaryUILocation = breakpoint.primaryUILocation(); | 563 var primaryUILocation = breakpoint.primaryUILocation(); |
542 this.sourceFileId = primaryUILocation.uiSourceCode.breakpointStorageId(); | 564 this.sourceFileId = primaryUILocation.uiSourceCode.breakpointStorageId(); |
543 this.lineNumber = primaryUILocation.lineNumber; | 565 this.lineNumber = primaryUILocation.lineNumber; |
544 this.condition = breakpoint.condition(); | 566 this.condition = breakpoint.condition(); |
545 this.enabled = breakpoint.enabled(); | 567 this.enabled = breakpoint.enabled(); |
546 } | 568 } |
547 | 569 |
548 /** @type {WebInspector.BreakpointManager} */ | 570 /** @type {WebInspector.BreakpointManager} */ |
549 WebInspector.breakpointManager = null; | 571 WebInspector.breakpointManager = null; |
OLD | NEW |