| OLD | NEW |
| 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 |
| 11 * @param {!Protocol.Dispatcher} dispatcher |
| 11 */ | 12 */ |
| 12 constructor(target) { | 13 constructor(target, dispatcher) { |
| 13 super(target); | 14 super(target, dispatcher); |
| 14 | 15 |
| 15 /** @type {!Map<string, !SDK.ServiceWorkerCacheModel.Cache>} */ | 16 /** @type {!Map<string, !SDK.ServiceWorkerCacheModel.Cache>} */ |
| 16 this._caches = new Map(); | 17 this._caches = new Map(); |
| 17 | 18 |
| 18 this._agent = target.cacheStorageAgent(); | 19 this._agent = dispatcher.cacheStorageAgent(); |
| 19 | 20 |
| 20 this._securityOriginManager = target.model(SDK.SecurityOriginManager); | 21 this._securityOriginManager = target.model(SDK.SecurityOriginManager); |
| 21 | 22 |
| 22 /** @type {boolean} */ | 23 /** @type {boolean} */ |
| 23 this._enabled = false; | 24 this._enabled = false; |
| 24 } | 25 } |
| 25 | 26 |
| 26 enable() { | 27 enable() { |
| 27 if (this._enabled) | 28 if (this._enabled) |
| 28 return; | 29 return; |
| (...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 303 } | 304 } |
| 304 | 305 |
| 305 /** | 306 /** |
| 306 * @override | 307 * @override |
| 307 * @return {string} | 308 * @return {string} |
| 308 */ | 309 */ |
| 309 toString() { | 310 toString() { |
| 310 return this.securityOrigin + this.cacheName; | 311 return this.securityOrigin + this.cacheName; |
| 311 } | 312 } |
| 312 }; | 313 }; |
| OLD | NEW |