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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/bindings/DebuggerWorkspaceBinding.js

Issue 2962063002: DevTools: eliminate {Default,Resource}ScriptMapping.addScript method (Closed)
Patch Set: remove code from breakpoint-manager.js Created 3 years, 5 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 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 /** 4 /**
5 * @unrestricted 5 * @unrestricted
6 * @implements {SDK.SDKModelObserver<!SDK.DebuggerModel>} 6 * @implements {SDK.SDKModelObserver<!SDK.DebuggerModel>}
7 */ 7 */
8 Bindings.DebuggerWorkspaceBinding = class { 8 Bindings.DebuggerWorkspaceBinding = class {
9 /** 9 /**
10 * @param {!SDK.TargetManager} targetManager 10 * @param {!SDK.TargetManager} targetManager
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 var workspace = debuggerWorkspaceBinding._workspace; 252 var workspace = debuggerWorkspaceBinding._workspace;
253 253
254 this._defaultMapping = new Bindings.DefaultScriptMapping(debuggerModel, work space, debuggerWorkspaceBinding); 254 this._defaultMapping = new Bindings.DefaultScriptMapping(debuggerModel, work space, debuggerWorkspaceBinding);
255 this._resourceMapping = new Bindings.ResourceScriptMapping(debuggerModel, wo rkspace, debuggerWorkspaceBinding); 255 this._resourceMapping = new Bindings.ResourceScriptMapping(debuggerModel, wo rkspace, debuggerWorkspaceBinding);
256 this._compilerMapping = new Bindings.CompilerScriptMapping(debuggerModel, wo rkspace, debuggerWorkspaceBinding); 256 this._compilerMapping = new Bindings.CompilerScriptMapping(debuggerModel, wo rkspace, debuggerWorkspaceBinding);
257 257
258 /** @type {!Multimap<!SDK.Script, !Bindings.DebuggerWorkspaceBinding.Locatio n>} */ 258 /** @type {!Multimap<!SDK.Script, !Bindings.DebuggerWorkspaceBinding.Locatio n>} */
259 this._locations = new Multimap(); 259 this._locations = new Multimap();
260 260
261 debuggerModel.setBeforePausedCallback(this._beforePaused.bind(this)); 261 debuggerModel.setBeforePausedCallback(this._beforePaused.bind(this));
262 this._eventListeners = [
263 debuggerModel.addEventListener(SDK.DebuggerModel.Events.ParsedScriptSource , this._parsedScriptSource, this),
264 debuggerModel.addEventListener(
265 SDK.DebuggerModel.Events.FailedToParseScriptSource, this._parsedScript Source, this),
266 debuggerModel.addEventListener(
267 SDK.DebuggerModel.Events.DiscardedAnonymousScriptSource, this._discard edScriptSource, this)
268 ];
269 } 262 }
270 263
271 /** 264 /**
272 * @param {!SDK.DebuggerModel.Location} rawLocation 265 * @param {!SDK.DebuggerModel.Location} rawLocation
273 * @param {function(!Bindings.LiveLocation)} updateDelegate 266 * @param {function(!Bindings.LiveLocation)} updateDelegate
274 * @param {!Bindings.LiveLocationPool} locationPool 267 * @param {!Bindings.LiveLocationPool} locationPool
275 * @return {!Bindings.DebuggerWorkspaceBinding.Location} 268 * @return {!Bindings.DebuggerWorkspaceBinding.Location}
276 */ 269 */
277 _createLiveLocation(rawLocation, updateDelegate, locationPool) { 270 _createLiveLocation(rawLocation, updateDelegate, locationPool) {
278 var script = /** @type {!SDK.Script} */ (rawLocation.script()); 271 var script = /** @type {!SDK.Script} */ (rawLocation.script());
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 } 322 }
330 323
331 /** 324 /**
332 * @param {!SDK.DebuggerPausedDetails} debuggerPausedDetails 325 * @param {!SDK.DebuggerPausedDetails} debuggerPausedDetails
333 * @return {boolean} 326 * @return {boolean}
334 */ 327 */
335 _beforePaused(debuggerPausedDetails) { 328 _beforePaused(debuggerPausedDetails) {
336 return !!this._compilerMapping.mapsToSourceCode(debuggerPausedDetails.callFr ames[0].location()); 329 return !!this._compilerMapping.mapsToSourceCode(debuggerPausedDetails.callFr ames[0].location());
337 } 330 }
338 331
339 /**
340 * @param {!Common.Event} event
341 */
342 _parsedScriptSource(event) {
343 var script = /** @type {!SDK.Script} */ (event.data);
344 this._defaultMapping.addScript(script);
345 this._resourceMapping.addScript(script);
346 }
347
348 /**
349 * @param {!Common.Event} event
350 */
351 _discardedScriptSource(event) {
352 var script = /** @type {!SDK.Script} */ (event.data);
353 this._defaultMapping.removeScript(script);
354 }
355
356 _dispose() { 332 _dispose() {
357 this._debuggerModel.setBeforePausedCallback(null); 333 this._debuggerModel.setBeforePausedCallback(null);
358 Common.EventTarget.removeEventListeners(this._eventListeners);
359 this._compilerMapping.dispose(); 334 this._compilerMapping.dispose();
360 this._resourceMapping.dispose(); 335 this._resourceMapping.dispose();
361 this._defaultMapping.dispose(); 336 this._defaultMapping.dispose();
362 } 337 }
363 }; 338 };
364 339
365 /** 340 /**
366 * @unrestricted 341 * @unrestricted
367 */ 342 */
368 Bindings.DebuggerWorkspaceBinding.Location = class extends Bindings.LiveLocation WithPool { 343 Bindings.DebuggerWorkspaceBinding.Location = class extends Bindings.LiveLocation WithPool {
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
490 * @param {number} columnNumber 465 * @param {number} columnNumber
491 * @return {?SDK.DebuggerModel.Location} 466 * @return {?SDK.DebuggerModel.Location}
492 */ 467 */
493 uiLocationToRawLocation(uiSourceCode, lineNumber, columnNumber) {}, 468 uiLocationToRawLocation(uiSourceCode, lineNumber, columnNumber) {},
494 }; 469 };
495 470
496 /** 471 /**
497 * @type {!Bindings.DebuggerWorkspaceBinding} 472 * @type {!Bindings.DebuggerWorkspaceBinding}
498 */ 473 */
499 Bindings.debuggerWorkspaceBinding; 474 Bindings.debuggerWorkspaceBinding;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698