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

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

Issue 2931773002: DevTools: kill DebuggerWorkspaceBinding.{push,pop,set}SourceMapping (Closed)
Patch Set: address comments Created 3 years, 6 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 /* 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 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 return this._debuggerModel.createRawLocation(script, entry.lineNumber, entry .columnNumber); 174 return this._debuggerModel.createRawLocation(script, entry.lineNumber, entry .columnNumber);
175 } 175 }
176 176
177 /** 177 /**
178 * @param {!Common.Event} event 178 * @param {!Common.Event} event
179 */ 179 */
180 _sourceMapWillAttach(event) { 180 _sourceMapWillAttach(event) {
181 var script = /** @type {!SDK.Script} */ (event.data); 181 var script = /** @type {!SDK.Script} */ (event.data);
182 // Create stub UISourceCode for the time source mapping is being loaded. 182 // Create stub UISourceCode for the time source mapping is being loaded.
183 this._addStubUISourceCode(script); 183 this._addStubUISourceCode(script);
184 this._debuggerWorkspaceBinding.pushSourceMapping(script, this); 184 this._debuggerWorkspaceBinding.updateLocations(script);
185 } 185 }
186 186
187 /** 187 /**
188 * @param {!Common.Event} event 188 * @param {!Common.Event} event
189 */ 189 */
190 _sourceMapFailedToAttach(event) { 190 _sourceMapFailedToAttach(event) {
191 var script = /** @type {!SDK.Script} */ (event.data); 191 var script = /** @type {!SDK.Script} */ (event.data);
192 this._removeStubUISourceCode(script); 192 this._removeStubUISourceCode(script);
193 } 193 }
194 194
(...skipping 18 matching lines...) Expand all
213 */ 213 */
214 _sourceMapDetached(event) { 214 _sourceMapDetached(event) {
215 var script = /** @type {!SDK.Script} */ (event.data.client); 215 var script = /** @type {!SDK.Script} */ (event.data.client);
216 var frameId = script[Bindings.CompilerScriptMapping._frameIdSymbol]; 216 var frameId = script[Bindings.CompilerScriptMapping._frameIdSymbol];
217 var sourceMap = /** @type {!SDK.SourceMap} */ (event.data.sourceMap); 217 var sourceMap = /** @type {!SDK.SourceMap} */ (event.data.sourceMap);
218 var scripts = this._sourceMapManager.clientsForSourceMap(sourceMap); 218 var scripts = this._sourceMapManager.clientsForSourceMap(sourceMap);
219 var hasOtherScripts = scripts.some(someScript => someScript.isContentScript( ) === script.isContentScript()); 219 var hasOtherScripts = scripts.some(someScript => someScript.isContentScript( ) === script.isContentScript());
220 var project = script.isContentScript() ? this._contentScriptsProject : this. _regularProject; 220 var project = script.isContentScript() ? this._contentScriptsProject : this. _regularProject;
221 for (var sourceURL of sourceMap.sourceURLs()) { 221 for (var sourceURL of sourceMap.sourceURLs()) {
222 var uiSourceCode = /** @type {!Workspace.UISourceCode} */ (project.uiSourc eCodeForURL(sourceURL)); 222 var uiSourceCode = /** @type {!Workspace.UISourceCode} */ (project.uiSourc eCodeForURL(sourceURL));
223 if (hasOtherScripts) { 223 if (hasOtherScripts)
224 Bindings.NetworkProject.removeFrameAttribution(uiSourceCode, frameId); 224 Bindings.NetworkProject.removeFrameAttribution(uiSourceCode, frameId);
225 } else { 225 else
226 this._debuggerWorkspaceBinding.setSourceMapping(this._debuggerModel, uiS ourceCode, null);
227 project.removeFile(sourceURL); 226 project.removeFile(sourceURL);
228 }
229 } 227 }
230 this._debuggerWorkspaceBinding.updateLocations(script); 228 this._debuggerWorkspaceBinding.updateLocations(script);
231 } 229 }
232 230
233 /** 231 /**
234 * @param {!SDK.Script} script 232 * @param {!SDK.Script} script
235 * @return {?SDK.SourceMap} 233 * @return {?SDK.SourceMap}
236 */ 234 */
237 sourceMapForScript(script) { 235 sourceMapForScript(script) {
238 return this._sourceMapManager.sourceMapForClient(script); 236 return this._sourceMapManager.sourceMapForClient(script);
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 269
272 var contentProvider = sourceMap.sourceContentProvider(sourceURL, Common.re sourceTypes.SourceMapScript); 270 var contentProvider = sourceMap.sourceContentProvider(sourceURL, Common.re sourceTypes.SourceMapScript);
273 var mimeType = Common.ResourceType.mimeFromURL(sourceURL) || contentProvid er.contentType().canonicalMimeType(); 271 var mimeType = Common.ResourceType.mimeFromURL(sourceURL) || contentProvid er.contentType().canonicalMimeType();
274 var embeddedContent = sourceMap.embeddedContentByURL(sourceURL); 272 var embeddedContent = sourceMap.embeddedContentByURL(sourceURL);
275 var metadata = 273 var metadata =
276 typeof embeddedContent === 'string' ? new Workspace.UISourceCodeMetada ta(null, embeddedContent.length) : null; 274 typeof embeddedContent === 'string' ? new Workspace.UISourceCodeMetada ta(null, embeddedContent.length) : null;
277 uiSourceCode = project.createUISourceCode(sourceURL, contentProvider.conte ntType()); 275 uiSourceCode = project.createUISourceCode(sourceURL, contentProvider.conte ntType());
278 uiSourceCode[Bindings.CompilerScriptMapping._sourceMapSymbol] = sourceMap; 276 uiSourceCode[Bindings.CompilerScriptMapping._sourceMapSymbol] = sourceMap;
279 Bindings.NetworkProject.setInitialFrameAttribution(uiSourceCode, frameId); 277 Bindings.NetworkProject.setInitialFrameAttribution(uiSourceCode, frameId);
280 project.addUISourceCodeWithProvider(uiSourceCode, contentProvider, metadat a, mimeType); 278 project.addUISourceCodeWithProvider(uiSourceCode, contentProvider, metadat a, mimeType);
281 this._debuggerWorkspaceBinding.setSourceMapping(this._debuggerModel, uiSou rceCode, this);
282 } 279 }
283 this._debuggerWorkspaceBinding.updateLocations(script); 280 this._debuggerWorkspaceBinding.updateLocations(script);
284 } 281 }
285 282
286 /** 283 /**
287 * @override 284 * @override
288 * @return {boolean}
289 */
290 isIdentity() {
291 return false;
292 }
293
294 /**
295 * @override
296 * @param {!Workspace.UISourceCode} uiSourceCode 285 * @param {!Workspace.UISourceCode} uiSourceCode
297 * @param {number} lineNumber 286 * @param {number} lineNumber
298 * @return {boolean} 287 * @return {boolean}
299 */ 288 */
300 uiLineHasMapping(uiSourceCode, lineNumber) { 289 static uiLineHasMapping(uiSourceCode, lineNumber) {
301 var sourceMap = uiSourceCode[Bindings.CompilerScriptMapping._sourceMapSymbol ]; 290 var sourceMap = uiSourceCode[Bindings.CompilerScriptMapping._sourceMapSymbol ];
302 if (!sourceMap) 291 if (!sourceMap)
303 return true; 292 return true;
304 return !!sourceMap.firstSourceLineMapping(uiSourceCode.url(), lineNumber); 293 return !!sourceMap.firstSourceLineMapping(uiSourceCode.url(), lineNumber);
305 } 294 }
306 295
307 dispose() { 296 dispose() {
308 Common.EventTarget.removeEventListeners(this._eventListeners); 297 Common.EventTarget.removeEventListeners(this._eventListeners);
309 this._regularProject.dispose(); 298 this._regularProject.dispose();
310 this._contentScriptsProject.dispose(); 299 this._contentScriptsProject.dispose();
311 this._stubProject.dispose(); 300 this._stubProject.dispose();
312 } 301 }
313 }; 302 };
314 303
315 Bindings.CompilerScriptMapping._frameIdSymbol = Symbol('Bindings.CompilerScriptM apping._frameIdSymbol'); 304 Bindings.CompilerScriptMapping._frameIdSymbol = Symbol('Bindings.CompilerScriptM apping._frameIdSymbol');
316 Bindings.CompilerScriptMapping._sourceMapSymbol = Symbol('Bindings.CompilerScrip tMapping._sourceMapSymbol'); 305 Bindings.CompilerScriptMapping._sourceMapSymbol = Symbol('Bindings.CompilerScrip tMapping._sourceMapSymbol');
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698