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

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

Issue 2440953003: DevTools: use semicolons after each statement. (Closed)
Patch Set: rebaseline Created 4 years, 1 month 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 * Invariant: This model can only be constructed on a ServiceWorker target. 6 * Invariant: This model can only be constructed on a ServiceWorker target.
7 * @constructor 7 * @constructor
8 * @extends {WebInspector.SDKModel} 8 * @extends {WebInspector.SDKModel}
9 * @param {!WebInspector.Target} target 9 * @param {!WebInspector.Target} target
10 * @param {!WebInspector.SecurityOriginManager} securityOriginManager 10 * @param {!WebInspector.SecurityOriginManager} securityOriginManager
11 */ 11 */
12 WebInspector.ServiceWorkerCacheModel = function(target, securityOriginManager) 12 WebInspector.ServiceWorkerCacheModel = function(target, securityOriginManager)
13 { 13 {
14 WebInspector.SDKModel.call(this, WebInspector.ServiceWorkerCacheModel, targe t); 14 WebInspector.SDKModel.call(this, WebInspector.ServiceWorkerCacheModel, targe t);
15 15
16 /** @type {!Map<string, !WebInspector.ServiceWorkerCacheModel.Cache>} */ 16 /** @type {!Map<string, !WebInspector.ServiceWorkerCacheModel.Cache>} */
17 this._caches = new Map(); 17 this._caches = new Map();
18 18
19 this._agent = target.cacheStorageAgent(); 19 this._agent = target.cacheStorageAgent();
20 20
21 this._securityOriginManager = securityOriginManager; 21 this._securityOriginManager = securityOriginManager;
22 22
23 /** @type {boolean} */ 23 /** @type {boolean} */
24 this._enabled = false; 24 this._enabled = false;
25 } 25 };
26 26
27 /** @enum {symbol} */ 27 /** @enum {symbol} */
28 WebInspector.ServiceWorkerCacheModel.Events = { 28 WebInspector.ServiceWorkerCacheModel.Events = {
29 CacheAdded: Symbol("CacheAdded"), 29 CacheAdded: Symbol("CacheAdded"),
30 CacheRemoved: Symbol("CacheRemoved") 30 CacheRemoved: Symbol("CacheRemoved")
31 } 31 };
32 32
33 WebInspector.ServiceWorkerCacheModel.prototype = { 33 WebInspector.ServiceWorkerCacheModel.prototype = {
34 enable: function() 34 enable: function()
35 { 35 {
36 if (this._enabled) 36 if (this._enabled)
37 return; 37 return;
38 38
39 this._securityOriginManager.addEventListener(WebInspector.SecurityOrigin Manager.Events.SecurityOriginAdded, this._securityOriginAdded, this); 39 this._securityOriginManager.addEventListener(WebInspector.SecurityOrigin Manager.Events.SecurityOriginAdded, this._securityOriginAdded, this);
40 this._securityOriginManager.addEventListener(WebInspector.SecurityOrigin Manager.Events.SecurityOriginRemoved, this._securityOriginRemoved, this); 40 this._securityOriginManager.addEventListener(WebInspector.SecurityOrigin Manager.Events.SecurityOriginRemoved, this._securityOriginRemoved, this);
41 41
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 var entries = []; 272 var entries = [];
273 for (var i = 0; i < dataEntries.length; ++i) { 273 for (var i = 0; i < dataEntries.length; ++i) {
274 entries.push(new WebInspector.ServiceWorkerCacheModel.Entry(data Entries[i].request, dataEntries[i].response)); 274 entries.push(new WebInspector.ServiceWorkerCacheModel.Entry(data Entries[i].request, dataEntries[i].response));
275 } 275 }
276 callback(entries, hasMore); 276 callback(entries, hasMore);
277 } 277 }
278 this._agent.requestEntries(cache.cacheId, skipCount, pageSize, innerCall back); 278 this._agent.requestEntries(cache.cacheId, skipCount, pageSize, innerCall back);
279 }, 279 },
280 280
281 __proto__: WebInspector.SDKModel.prototype 281 __proto__: WebInspector.SDKModel.prototype
282 } 282 };
283 283
284 /** 284 /**
285 * @constructor 285 * @constructor
286 * @param {string} request 286 * @param {string} request
287 * @param {string} response 287 * @param {string} response
288 */ 288 */
289 WebInspector.ServiceWorkerCacheModel.Entry = function(request, response) 289 WebInspector.ServiceWorkerCacheModel.Entry = function(request, response)
290 { 290 {
291 this.request = request; 291 this.request = request;
292 this.response = response; 292 this.response = response;
293 } 293 };
294 294
295 /** 295 /**
296 * @constructor 296 * @constructor
297 * @param {string} securityOrigin 297 * @param {string} securityOrigin
298 * @param {string} cacheName 298 * @param {string} cacheName
299 * @param {string} cacheId 299 * @param {string} cacheId
300 */ 300 */
301 WebInspector.ServiceWorkerCacheModel.Cache = function(securityOrigin, cacheName, cacheId) 301 WebInspector.ServiceWorkerCacheModel.Cache = function(securityOrigin, cacheName, cacheId)
302 { 302 {
303 this.securityOrigin = securityOrigin; 303 this.securityOrigin = securityOrigin;
304 this.cacheName = cacheName; 304 this.cacheName = cacheName;
305 this.cacheId = cacheId; 305 this.cacheId = cacheId;
306 } 306 };
307 307
308 WebInspector.ServiceWorkerCacheModel.Cache.prototype = { 308 WebInspector.ServiceWorkerCacheModel.Cache.prototype = {
309 /** 309 /**
310 * @param {!WebInspector.ServiceWorkerCacheModel.Cache} cache 310 * @param {!WebInspector.ServiceWorkerCacheModel.Cache} cache
311 * @return {boolean} 311 * @return {boolean}
312 */ 312 */
313 equals: function(cache) 313 equals: function(cache)
314 { 314 {
315 return this.cacheId === cache.cacheId; 315 return this.cacheId === cache.cacheId;
316 }, 316 },
317 317
318 /** 318 /**
319 * @override 319 * @override
320 * @return {string} 320 * @return {string}
321 */ 321 */
322 toString: function() 322 toString: function()
323 { 323 {
324 return this.securityOrigin + this.cacheName; 324 return this.securityOrigin + this.cacheName;
325 } 325 }
326 } 326 };
327 327
328 /** 328 /**
329 * @param {!WebInspector.Target} target 329 * @param {!WebInspector.Target} target
330 * @return {?WebInspector.ServiceWorkerCacheModel} 330 * @return {?WebInspector.ServiceWorkerCacheModel}
331 */ 331 */
332 WebInspector.ServiceWorkerCacheModel.fromTarget = function(target) 332 WebInspector.ServiceWorkerCacheModel.fromTarget = function(target)
333 { 333 {
334 if (!target.hasBrowserCapability()) 334 if (!target.hasBrowserCapability())
335 return null; 335 return null;
336 var instance = /** @type {?WebInspector.ServiceWorkerCacheModel} */ (target. model(WebInspector.ServiceWorkerCacheModel)); 336 var instance = /** @type {?WebInspector.ServiceWorkerCacheModel} */ (target. model(WebInspector.ServiceWorkerCacheModel));
337 if (!instance) 337 if (!instance)
338 instance = new WebInspector.ServiceWorkerCacheModel(target, WebInspector .SecurityOriginManager.fromTarget(target)); 338 instance = new WebInspector.ServiceWorkerCacheModel(target, WebInspector .SecurityOriginManager.fromTarget(target));
339 return instance; 339 return instance;
340 } 340 };
341 341
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698