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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/sdk/SourceMapManager.js

Issue 2779703004: DevTools: carefully cleanup CSS sourcemaps (Closed)
Patch Set: Created 3 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
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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 * @template T 6 * @template T
7 */ 7 */
8 SDK.SourceMapManager = class extends SDK.SDKObject { 8 SDK.SourceMapManager = class extends SDK.SDKObject {
9 /** 9 /**
10 * @param {!SDK.Target} target 10 * @param {!SDK.Target} target
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 attach.call(this, sourceMapURL, client); 177 attach.call(this, sourceMapURL, client);
178 } 178 }
179 179
180 /** 180 /**
181 * @param {string} sourceMapURL 181 * @param {string} sourceMapURL
182 * @param {!T} client 182 * @param {!T} client
183 * @this {SDK.SourceMapManager} 183 * @this {SDK.SourceMapManager}
184 */ 184 */
185 function attach(sourceMapURL, client) { 185 function attach(sourceMapURL, client) {
186 this._sourceMapURLToClients.set(sourceMapURL, client); 186 this._sourceMapURLToClients.set(sourceMapURL, client);
187 this.dispatchEventToListeners(SDK.SourceMapManager.Events.SourceMapAttache d, client); 187 this.dispatchEventToListeners(SDK.SourceMapManager.Events.SourceMapAttache d, client);
dgozman 2017/03/28 23:37:37 Let's pass sourceMap here as well for uniformity.
lushnikov 2017/03/29 01:27:24 Done.
188 } 188 }
189 } 189 }
190 190
191 /** 191 /**
192 * @param {!SDK.SourceMap} sourceMap 192 * @param {!SDK.SourceMap} sourceMap
193 * @return {?Runtime.Extension} 193 * @return {?Runtime.Extension}
194 */ 194 */
195 _factoryForSourceMap(sourceMap) { 195 _factoryForSourceMap(sourceMap) {
196 var sourceExtensions = new Set(); 196 var sourceExtensions = new Set();
197 for (var url of sourceMap.sourceURLs()) 197 for (var url of sourceMap.sourceURLs())
(...skipping 15 matching lines...) Expand all
213 this._relativeSourceMapURL.delete(client); 213 this._relativeSourceMapURL.delete(client);
214 this._resolvedSourceMapURL.delete(client); 214 this._resolvedSourceMapURL.delete(client);
215 215
216 if (!sourceMapURL) 216 if (!sourceMapURL)
217 return; 217 return;
218 if (!this._sourceMapURLToClients.hasValue(sourceMapURL, client)) { 218 if (!this._sourceMapURLToClients.hasValue(sourceMapURL, client)) {
219 this._sourceMapURLToLoadingClients.remove(sourceMapURL, client); 219 this._sourceMapURLToLoadingClients.remove(sourceMapURL, client);
220 return; 220 return;
221 } 221 }
222 this._sourceMapURLToClients.remove(sourceMapURL, client); 222 this._sourceMapURLToClients.remove(sourceMapURL, client);
223 var sourceMap = this._sourceMapByURL.get(sourceMapURL);
223 if (!this._sourceMapURLToClients.has(sourceMapURL)) 224 if (!this._sourceMapURLToClients.has(sourceMapURL))
224 this._sourceMapByURL.delete(sourceMapURL); 225 this._sourceMapByURL.delete(sourceMapURL);
225 this.dispatchEventToListeners(SDK.SourceMapManager.Events.SourceMapDetached, client); 226 this.dispatchEventToListeners(SDK.SourceMapManager.Events.SourceMapDetached, {client, sourceMap});
lushnikov 2017/03/28 01:39:32 used "shorthand property names" here :)
dgozman 2017/03/28 23:37:37 Scary! Maybe trial this feature in tests first?
lushnikov 2017/03/29 01:27:24 Done.
226 } 227 }
227 228
228 _sourceMapLoadedForTest() { 229 _sourceMapLoadedForTest() {
229 } 230 }
230 231
231 dispose() { 232 dispose() {
232 SDK.targetManager.removeEventListener( 233 SDK.targetManager.removeEventListener(
233 SDK.TargetManager.Events.InspectedURLChanged, this._inspectedURLChanged, this); 234 SDK.TargetManager.Events.InspectedURLChanged, this._inspectedURLChanged, this);
234 } 235 }
235 }; 236 };
236 237
237 SDK.SourceMapManager.Events = { 238 SDK.SourceMapManager.Events = {
238 SourceMapAttached: Symbol('SourceMapAttached'), 239 SourceMapAttached: Symbol('SourceMapAttached'),
239 SourceMapDetached: Symbol('SourceMapDetached'), 240 SourceMapDetached: Symbol('SourceMapDetached'),
240 SourceMapChanged: Symbol('SourceMapChanged') 241 SourceMapChanged: Symbol('SourceMapChanged')
241 }; 242 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698