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

Side by Side Diff: Source/devtools/front_end/Script.js

Issue 220903002: DevTools: wrap DebuggerAgent.Location with DebuggerModel.Location. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: All tests!!! Created 6 years, 8 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) 2008 Apple Inc. All Rights Reserved. 2 * Copyright (C) 2008 Apple 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution. 11 * documentation and/or other materials provided with the distribution.
12 * 12 *
13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY 13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */ 24 */
25 25
26 /** 26 /**
27 * @constructor 27 * @constructor
28 * @extends {WebInspector.Object} 28 * @extends {WebInspector.TargetAwareObject}
29 * @implements {WebInspector.ContentProvider} 29 * @implements {WebInspector.ContentProvider}
30 * @param {!WebInspector.Target} target
30 * @param {string} scriptId 31 * @param {string} scriptId
31 * @param {string} sourceURL 32 * @param {string} sourceURL
32 * @param {number} startLine 33 * @param {number} startLine
33 * @param {number} startColumn 34 * @param {number} startColumn
34 * @param {number} endLine 35 * @param {number} endLine
35 * @param {number} endColumn 36 * @param {number} endColumn
36 * @param {boolean} isContentScript 37 * @param {boolean} isContentScript
37 * @param {string=} sourceMapURL 38 * @param {string=} sourceMapURL
38 * @param {boolean=} hasSourceURL 39 * @param {boolean=} hasSourceURL
39 */ 40 */
40 WebInspector.Script = function(scriptId, sourceURL, startLine, startColumn, endL ine, endColumn, isContentScript, sourceMapURL, hasSourceURL) 41 WebInspector.Script = function(target, scriptId, sourceURL, startLine, startColu mn, endLine, endColumn, isContentScript, sourceMapURL, hasSourceURL)
41 { 42 {
43 WebInspector.TargetAwareObject.call(this, target);
42 this.scriptId = scriptId; 44 this.scriptId = scriptId;
43 this.sourceURL = sourceURL; 45 this.sourceURL = sourceURL;
44 this.lineOffset = startLine; 46 this.lineOffset = startLine;
45 this.columnOffset = startColumn; 47 this.columnOffset = startColumn;
46 this.endLine = endLine; 48 this.endLine = endLine;
47 this.endColumn = endColumn; 49 this.endColumn = endColumn;
48 this.isContentScript = isContentScript; 50 this.isContentScript = isContentScript;
49 this.sourceMapURL = sourceMapURL; 51 this.sourceMapURL = sourceMapURL;
50 this.hasSourceURL = hasSourceURL; 52 this.hasSourceURL = hasSourceURL;
51 /** @type {!Set.<!WebInspector.Script.Location>} */ 53 /** @type {!Set.<!WebInspector.Script.Location>} */
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 }, 220 },
219 221
220 /** 222 /**
221 * @param {number} lineNumber 223 * @param {number} lineNumber
222 * @param {number=} columnNumber 224 * @param {number=} columnNumber
223 * @return {!WebInspector.UILocation} 225 * @return {!WebInspector.UILocation}
224 */ 226 */
225 rawLocationToUILocation: function(lineNumber, columnNumber) 227 rawLocationToUILocation: function(lineNumber, columnNumber)
226 { 228 {
227 var uiLocation; 229 var uiLocation;
228 var rawLocation = new WebInspector.DebuggerModel.Location(this.scriptId, lineNumber, columnNumber || 0); 230 var rawLocation = new WebInspector.DebuggerModel.Location(this.target(), this.scriptId, lineNumber, columnNumber || 0);
229 for (var i = this._sourceMappings.length - 1; !uiLocation && i >= 0; --i ) 231 for (var i = this._sourceMappings.length - 1; !uiLocation && i >= 0; --i )
230 uiLocation = this._sourceMappings[i].rawLocationToUILocation(rawLoca tion); 232 uiLocation = this._sourceMappings[i].rawLocationToUILocation(rawLoca tion);
231 console.assert(uiLocation, "Script raw location can not be mapped to any ui location."); 233 console.assert(uiLocation, "Script raw location can not be mapped to any ui location.");
232 return /** @type {!WebInspector.UILocation} */ (uiLocation); 234 return /** @type {!WebInspector.UILocation} */ (uiLocation);
233 }, 235 },
234 236
235 /** 237 /**
236 * @param {!WebInspector.SourceMapping} sourceMapping 238 * @param {!WebInspector.SourceMapping} sourceMapping
237 */ 239 */
238 pushSourceMapping: function(sourceMapping) 240 pushSourceMapping: function(sourceMapping)
(...skipping 26 matching lines...) Expand all
265 */ 267 */
266 createLiveLocation: function(rawLocation, updateDelegate) 268 createLiveLocation: function(rawLocation, updateDelegate)
267 { 269 {
268 console.assert(rawLocation.scriptId === this.scriptId); 270 console.assert(rawLocation.scriptId === this.scriptId);
269 var location = new WebInspector.Script.Location(this, rawLocation, updat eDelegate); 271 var location = new WebInspector.Script.Location(this, rawLocation, updat eDelegate);
270 this._locations.add(location); 272 this._locations.add(location);
271 location.update(); 273 location.update();
272 return location; 274 return location;
273 }, 275 },
274 276
275 __proto__: WebInspector.Object.prototype 277 __proto__: WebInspector.TargetAwareObject.prototype
276 } 278 }
277 279
278 /** 280 /**
279 * @constructor 281 * @constructor
280 * @extends {WebInspector.LiveLocation} 282 * @extends {WebInspector.LiveLocation}
281 * @param {!WebInspector.Script} script 283 * @param {!WebInspector.Script} script
282 * @param {!WebInspector.DebuggerModel.Location} rawLocation 284 * @param {!WebInspector.DebuggerModel.Location} rawLocation
283 * @param {function(!WebInspector.UILocation):(boolean|undefined)} updateDelegat e 285 * @param {function(!WebInspector.UILocation):(boolean|undefined)} updateDelegat e
284 */ 286 */
285 WebInspector.Script.Location = function(script, rawLocation, updateDelegate) 287 WebInspector.Script.Location = function(script, rawLocation, updateDelegate)
(...skipping 13 matching lines...) Expand all
299 }, 301 },
300 302
301 dispose: function() 303 dispose: function()
302 { 304 {
303 WebInspector.LiveLocation.prototype.dispose.call(this); 305 WebInspector.LiveLocation.prototype.dispose.call(this);
304 this._script._locations.remove(this); 306 this._script._locations.remove(this);
305 }, 307 },
306 308
307 __proto__: WebInspector.LiveLocation.prototype 309 __proto__: WebInspector.LiveLocation.prototype
308 } 310 }
OLDNEW
« no previous file with comments | « Source/devtools/front_end/SASSSourceMapping.js ('k') | Source/devtools/front_end/ScriptFormatterEditorAction.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698