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

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

Issue 2301023003: DevTools: fix disposing of main debugger script mappings (Closed)
Patch Set: main debugger mappings do not leak memory Created 4 years, 3 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 /** 5 /**
6 * @constructor 6 * @constructor
7 * @implements {WebInspector.TargetManager.Observer} 7 * @implements {WebInspector.TargetManager.Observer}
8 * @param {!WebInspector.TargetManager} targetManager 8 * @param {!WebInspector.TargetManager} targetManager
9 * @param {!WebInspector.Workspace} workspace 9 * @param {!WebInspector.Workspace} workspace
10 * @param {!WebInspector.NetworkMapping} networkMapping 10 * @param {!WebInspector.NetworkMapping} networkMapping
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 var workspace = debuggerWorkspaceBinding._workspace; 378 var workspace = debuggerWorkspaceBinding._workspace;
379 var networkMapping = debuggerWorkspaceBinding._networkMapping; 379 var networkMapping = debuggerWorkspaceBinding._networkMapping;
380 380
381 this._defaultMapping = new WebInspector.DefaultScriptMapping(debuggerModel, workspace, debuggerWorkspaceBinding); 381 this._defaultMapping = new WebInspector.DefaultScriptMapping(debuggerModel, workspace, debuggerWorkspaceBinding);
382 this._resourceMapping = new WebInspector.ResourceScriptMapping(debuggerModel , workspace, networkMapping, debuggerWorkspaceBinding); 382 this._resourceMapping = new WebInspector.ResourceScriptMapping(debuggerModel , workspace, networkMapping, debuggerWorkspaceBinding);
383 this._compilerMapping = new WebInspector.CompilerScriptMapping(debuggerModel , workspace, networkMapping, WebInspector.NetworkProject.forTarget(this._target) , debuggerWorkspaceBinding); 383 this._compilerMapping = new WebInspector.CompilerScriptMapping(debuggerModel , workspace, networkMapping, WebInspector.NetworkProject.forTarget(this._target) , debuggerWorkspaceBinding);
384 384
385 /** @type {!Map.<!WebInspector.UISourceCode, !WebInspector.DebuggerSourceMap ping>} */ 385 /** @type {!Map.<!WebInspector.UISourceCode, !WebInspector.DebuggerSourceMap ping>} */
386 this._uiSourceCodeToSourceMapping = new Map(); 386 this._uiSourceCodeToSourceMapping = new Map();
387 387
388 debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.ParsedScrip tSource, this._parsedScriptSource, this); 388 this._eventListeners = [
389 debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.FailedToPar seScriptSource, this._parsedScriptSource, this); 389 debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.ParsedS criptSource, this._parsedScriptSource, this),
390 debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.FailedT oParseScriptSource, this._parsedScriptSource, this)
391 ];
390 } 392 }
391 393
392 WebInspector.DebuggerWorkspaceBinding.TargetData.prototype = { 394 WebInspector.DebuggerWorkspaceBinding.TargetData.prototype = {
393 /** 395 /**
394 * @param {!WebInspector.Event} event 396 * @param {!WebInspector.Event} event
395 */ 397 */
396 _parsedScriptSource: function(event) 398 _parsedScriptSource: function(event)
397 { 399 {
398 var script = /** @type {!WebInspector.Script} */ (event.data); 400 var script = /** @type {!WebInspector.Script} */ (event.data);
399 this._defaultMapping.addScript(script); 401 this._defaultMapping.addScript(script);
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
446 /** 448 /**
447 * @param {!WebInspector.UISourceCode} uiSourceCode 449 * @param {!WebInspector.UISourceCode} uiSourceCode
448 */ 450 */
449 _uiSourceCodeRemoved: function(uiSourceCode) 451 _uiSourceCodeRemoved: function(uiSourceCode)
450 { 452 {
451 this._uiSourceCodeToSourceMapping.remove(uiSourceCode); 453 this._uiSourceCodeToSourceMapping.remove(uiSourceCode);
452 }, 454 },
453 455
454 _dispose: function() 456 _dispose: function()
455 { 457 {
458 WebInspector.EventTarget.removeEventListeners(this._eventListeners);
456 this._compilerMapping.dispose(); 459 this._compilerMapping.dispose();
457 this._resourceMapping.dispose(); 460 this._resourceMapping.dispose();
458 this._defaultMapping.dispose(); 461 this._defaultMapping.dispose();
459 this._uiSourceCodeToSourceMapping.clear(); 462 this._uiSourceCodeToSourceMapping.clear();
460 } 463 }
461 } 464 }
462 465
463 /** 466 /**
464 * @constructor 467 * @constructor
465 * @param {!WebInspector.Script} script 468 * @param {!WebInspector.Script} script
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
687 * @param {number} lineNumber 690 * @param {number} lineNumber
688 * @return {boolean} 691 * @return {boolean}
689 */ 692 */
690 uiLineHasMapping: function(uiSourceCode, lineNumber) { } 693 uiLineHasMapping: function(uiSourceCode, lineNumber) { }
691 } 694 }
692 695
693 /** 696 /**
694 * @type {!WebInspector.DebuggerWorkspaceBinding} 697 * @type {!WebInspector.DebuggerWorkspaceBinding}
695 */ 698 */
696 WebInspector.debuggerWorkspaceBinding; 699 WebInspector.debuggerWorkspaceBinding;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698