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

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

Issue 2543633009: [Devtools] Template fromTarget() function calls to model (Closed)
Patch Set: fix Created 4 years 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 * @unrestricted 5 * @unrestricted
6 */ 6 */
7 SDK.ServiceWorkerCacheModel = class extends SDK.SDKModel { 7 SDK.ServiceWorkerCacheModel = class extends SDK.SDKModel {
8 /** 8 /**
9 * Invariant: This model can only be constructed on a ServiceWorker target. 9 * Invariant: This model can only be constructed on a ServiceWorker target.
10 * @param {!SDK.Target} target 10 * @param {!SDK.Target} target
(...skipping 13 matching lines...) Expand all
24 this._enabled = false; 24 this._enabled = false;
25 } 25 }
26 26
27 /** 27 /**
28 * @param {!SDK.Target} target 28 * @param {!SDK.Target} target
29 * @return {?SDK.ServiceWorkerCacheModel} 29 * @return {?SDK.ServiceWorkerCacheModel}
30 */ 30 */
31 static fromTarget(target) { 31 static fromTarget(target) {
32 if (!target.hasBrowserCapability()) 32 if (!target.hasBrowserCapability())
33 return null; 33 return null;
34 var instance = 34 var instance = target.model(SDK.ServiceWorkerCacheModel);
35 /** @type {?SDK.ServiceWorkerCacheModel} */ (target.model(SDK.ServiceWor kerCacheModel));
36 if (!instance) 35 if (!instance)
37 instance = new SDK.ServiceWorkerCacheModel(target, SDK.SecurityOriginManag er.fromTarget(target)); 36 instance = new SDK.ServiceWorkerCacheModel(target, SDK.SecurityOriginManag er.fromTarget(target));
38 return instance; 37 return instance;
39 } 38 }
40 39
41 enable() { 40 enable() {
42 if (this._enabled) 41 if (this._enabled)
43 return; 42 return;
44 43
45 this._securityOriginManager.addEventListener( 44 this._securityOriginManager.addEventListener(
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 } 315 }
317 316
318 /** 317 /**
319 * @override 318 * @override
320 * @return {string} 319 * @return {string}
321 */ 320 */
322 toString() { 321 toString() {
323 return this.securityOrigin + this.cacheName; 322 return this.securityOrigin + this.cacheName;
324 } 323 }
325 }; 324 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698