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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/bindings/CompilerScriptMapping.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
« no previous file with comments | « no previous file | third_party/WebKit/Source/devtools/front_end/bindings/DebuggerWorkspaceBinding.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 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 23 matching lines...) Expand all
34 * @param {!WebInspector.DebuggerModel} debuggerModel 34 * @param {!WebInspector.DebuggerModel} debuggerModel
35 * @param {!WebInspector.Workspace} workspace 35 * @param {!WebInspector.Workspace} workspace
36 * @param {!WebInspector.NetworkMapping} networkMapping 36 * @param {!WebInspector.NetworkMapping} networkMapping
37 * @param {!WebInspector.NetworkProject} networkProject 37 * @param {!WebInspector.NetworkProject} networkProject
38 * @param {!WebInspector.DebuggerWorkspaceBinding} debuggerWorkspaceBinding 38 * @param {!WebInspector.DebuggerWorkspaceBinding} debuggerWorkspaceBinding
39 */ 39 */
40 WebInspector.CompilerScriptMapping = function(debuggerModel, workspace, networkM apping, networkProject, debuggerWorkspaceBinding) 40 WebInspector.CompilerScriptMapping = function(debuggerModel, workspace, networkM apping, networkProject, debuggerWorkspaceBinding)
41 { 41 {
42 this._target = debuggerModel.target(); 42 this._target = debuggerModel.target();
43 this._debuggerModel = debuggerModel; 43 this._debuggerModel = debuggerModel;
44 this._workspace = workspace;
45 this._workspace.addEventListener(WebInspector.Workspace.Events.UISourceCodeA dded, this._uiSourceCodeAddedToWorkspace, this);
46 this._networkMapping = networkMapping; 44 this._networkMapping = networkMapping;
47 this._networkProject = networkProject; 45 this._networkProject = networkProject;
48 this._debuggerWorkspaceBinding = debuggerWorkspaceBinding; 46 this._debuggerWorkspaceBinding = debuggerWorkspaceBinding;
49 47
50 /** @type {!Map<string, !Promise<?WebInspector.TextSourceMap>>} */ 48 /** @type {!Map<string, !Promise<?WebInspector.TextSourceMap>>} */
51 this._sourceMapLoadingPromises = new Map(); 49 this._sourceMapLoadingPromises = new Map();
52 /** @type {!Map<string, !WebInspector.TextSourceMap>} */ 50 /** @type {!Map<string, !WebInspector.TextSourceMap>} */
53 this._sourceMapForScriptId = new Map(); 51 this._sourceMapForScriptId = new Map();
54 /** @type {!Map.<!WebInspector.TextSourceMap, !WebInspector.Script>} */ 52 /** @type {!Map.<!WebInspector.TextSourceMap, !WebInspector.Script>} */
55 this._scriptForSourceMap = new Map(); 53 this._scriptForSourceMap = new Map();
56 /** @type {!Map.<string, !WebInspector.TextSourceMap>} */ 54 /** @type {!Map.<string, !WebInspector.TextSourceMap>} */
57 this._sourceMapForURL = new Map(); 55 this._sourceMapForURL = new Map();
58 /** @type {!Map.<string, !WebInspector.UISourceCode>} */ 56 /** @type {!Map.<string, !WebInspector.UISourceCode>} */
59 this._stubUISourceCodes = new Map(); 57 this._stubUISourceCodes = new Map();
60 58
61 this._stubProjectID = "compiler-script-project"; 59 var projectId = WebInspector.CompilerScriptMapping.projectIdForTarget(this._ target);
dgozman 2016/09/02 21:05:10 Let's have a test for sourcemaps in multiple targe
lushnikov 2016/09/08 01:32:04 Sourcemaps actually work; the stubproject works to
62 this._stubProject = new WebInspector.ContentProviderBasedProject(this._works pace, this._stubProjectID, WebInspector.projectTypes.Service, ""); 60 this._stubProject = new WebInspector.ContentProviderBasedProject(workspace, projectId, WebInspector.projectTypes.Service, "");
63 debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.GlobalObjec tCleared, this._debuggerReset, this); 61 this._eventListeners = [
62 workspace.addEventListener(WebInspector.Workspace.Events.UISourceCodeAdd ed, this._uiSourceCodeAddedToWorkspace, this),
63 debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.GlobalO bjectCleared, this._debuggerReset, this)
64 ];
64 } 65 }
65 66
66 WebInspector.CompilerScriptMapping.StubProjectID = "compiler-script-project";
67
68 WebInspector.CompilerScriptMapping._originSymbol = Symbol("origin"); 67 WebInspector.CompilerScriptMapping._originSymbol = Symbol("origin");
69 68
70 /** 69 /**
71 * @param {!WebInspector.UISourceCode} uiSourceCode 70 * @param {!WebInspector.UISourceCode} uiSourceCode
72 * @return {?string} 71 * @return {?string}
73 */ 72 */
74 WebInspector.CompilerScriptMapping.uiSourceCodeOrigin = function(uiSourceCode) 73 WebInspector.CompilerScriptMapping.uiSourceCodeOrigin = function(uiSourceCode)
75 { 74 {
76 return uiSourceCode[WebInspector.CompilerScriptMapping._originSymbol] || nul l; 75 return uiSourceCode[WebInspector.CompilerScriptMapping._originSymbol] || nul l;
77 } 76 }
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
382 this._sourceMapForURL.valuesArray().forEach(unbindSourceMapSources.bind( this)); 381 this._sourceMapForURL.valuesArray().forEach(unbindSourceMapSources.bind( this));
383 382
384 this._sourceMapLoadingPromises.clear(); 383 this._sourceMapLoadingPromises.clear();
385 this._sourceMapForScriptId.clear() 384 this._sourceMapForScriptId.clear()
386 this._scriptForSourceMap.clear(); 385 this._scriptForSourceMap.clear();
387 this._sourceMapForURL.clear(); 386 this._sourceMapForURL.clear();
388 }, 387 },
389 388
390 dispose: function() 389 dispose: function()
391 { 390 {
392 this._workspace.removeEventListener(WebInspector.Workspace.Events.UISour ceCodeAdded, this._uiSourceCodeAddedToWorkspace, this); 391 WebInspector.EventTarget.removeEventListeners(this._eventListeners);
392 this._debuggerReset();
393 this._stubProject.dispose();
393 } 394 }
394 } 395 }
396
397 /**
398 * @param {!WebInspector.Target} target
399 * @return {string}
400 */
401 WebInspector.CompilerScriptMapping.projectIdForTarget = function(target)
402 {
403 return "compiler-script-project:" + target.id();
404 }
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/devtools/front_end/bindings/DebuggerWorkspaceBinding.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698