| 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 /** | 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 */ | 9 */ |
| 10 WebInspector.ServiceWorkerCacheModel = function(target) | 10 WebInspector.ServiceWorkerCacheModel = function(target) |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 | 33 |
| 34 this.target().resourceTreeModel.addEventListener(WebInspector.ResourceTr
eeModel.EventTypes.SecurityOriginAdded, this._securityOriginAdded, this); | 34 this.target().resourceTreeModel.addEventListener(WebInspector.ResourceTr
eeModel.EventTypes.SecurityOriginAdded, this._securityOriginAdded, this); |
| 35 this.target().resourceTreeModel.addEventListener(WebInspector.ResourceTr
eeModel.EventTypes.SecurityOriginRemoved, this._securityOriginRemoved, this); | 35 this.target().resourceTreeModel.addEventListener(WebInspector.ResourceTr
eeModel.EventTypes.SecurityOriginRemoved, this._securityOriginRemoved, this); |
| 36 | 36 |
| 37 var securityOrigins = this.target().resourceTreeModel.securityOrigins(); | 37 var securityOrigins = this.target().resourceTreeModel.securityOrigins(); |
| 38 for (var i = 0; i < securityOrigins.length; ++i) | 38 for (var i = 0; i < securityOrigins.length; ++i) |
| 39 this._addOrigin(securityOrigins[i]); | 39 this._addOrigin(securityOrigins[i]); |
| 40 this._enabled = true; | 40 this._enabled = true; |
| 41 }, | 41 }, |
| 42 | 42 |
| 43 /** |
| 44 * @param {string} origin |
| 45 */ |
| 46 clearForOrigin: function(origin) |
| 47 { |
| 48 this._removeOrigin(origin); |
| 49 this._addOrigin(origin); |
| 50 }, |
| 51 |
| 43 refreshCacheNames: function() | 52 refreshCacheNames: function() |
| 44 { | 53 { |
| 54 for (var cache of this._caches.values()) |
| 55 this._cacheRemoved(cache); |
| 56 this._caches.clear(); |
| 45 var securityOrigins = this.target().resourceTreeModel.securityOrigins(); | 57 var securityOrigins = this.target().resourceTreeModel.securityOrigins(); |
| 46 for (var securityOrigin of securityOrigins) | 58 for (var securityOrigin of securityOrigins) |
| 47 this._loadCacheNames(securityOrigin); | 59 this._loadCacheNames(securityOrigin); |
| 48 }, | 60 }, |
| 49 | 61 |
| 50 /** | 62 /** |
| 51 * @param {!WebInspector.ServiceWorkerCacheModel.Cache} cache | 63 * @param {!WebInspector.ServiceWorkerCacheModel.Cache} cache |
| 52 */ | 64 */ |
| 53 deleteCache: function(cache) | 65 deleteCache: function(cache) |
| 54 { | 66 { |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 315 * @param {!WebInspector.Target} target | 327 * @param {!WebInspector.Target} target |
| 316 * @return {!WebInspector.ServiceWorkerCacheModel} | 328 * @return {!WebInspector.ServiceWorkerCacheModel} |
| 317 */ | 329 */ |
| 318 WebInspector.ServiceWorkerCacheModel.fromTarget = function(target) | 330 WebInspector.ServiceWorkerCacheModel.fromTarget = function(target) |
| 319 { | 331 { |
| 320 if (!target[WebInspector.ServiceWorkerCacheModel._symbol]) | 332 if (!target[WebInspector.ServiceWorkerCacheModel._symbol]) |
| 321 target[WebInspector.ServiceWorkerCacheModel._symbol] = new WebInspector.
ServiceWorkerCacheModel(target); | 333 target[WebInspector.ServiceWorkerCacheModel._symbol] = new WebInspector.
ServiceWorkerCacheModel(target); |
| 322 | 334 |
| 323 return target[WebInspector.ServiceWorkerCacheModel._symbol]; | 335 return target[WebInspector.ServiceWorkerCacheModel._symbol]; |
| 324 } | 336 } |
| OLD | NEW |