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

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

Issue 2928833002: [CacheStorage] [DevTools] Added "Time Received" column to cache storage data grid (Closed)
Patch Set: Removed Time.h changes Created 3 years, 6 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 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 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 * @param {number} pageSize 216 * @param {number} pageSize
217 * @param {function(!Array<!SDK.ServiceWorkerCacheModel.Entry>, boolean)} call back 217 * @param {function(!Array<!SDK.ServiceWorkerCacheModel.Entry>, boolean)} call back
218 */ 218 */
219 async _requestEntries(cache, skipCount, pageSize, callback) { 219 async _requestEntries(cache, skipCount, pageSize, callback) {
220 var response = await this._agent.invoke_requestEntries({cacheId: cache.cache Id, skipCount, pageSize}); 220 var response = await this._agent.invoke_requestEntries({cacheId: cache.cache Id, skipCount, pageSize});
221 if (response[Protocol.Error]) { 221 if (response[Protocol.Error]) {
222 console.error('ServiceWorkerCacheAgent error while requesting entries: ', response[Protocol.Error]); 222 console.error('ServiceWorkerCacheAgent error while requesting entries: ', response[Protocol.Error]);
223 return; 223 return;
224 } 224 }
225 var entries = response.cacheDataEntries.map( 225 var entries = response.cacheDataEntries.map(
226 dataEntry => new SDK.ServiceWorkerCacheModel.Entry(dataEntry.request, da taEntry.response)); 226 dataEntry => new SDK.ServiceWorkerCacheModel.Entry(
227 dataEntry.request, dataEntry.response, new Date(dataEntry.responseTi me * 1000).toLocaleString()));
227 callback(entries, response.hasMore); 228 callback(entries, response.hasMore);
228 } 229 }
229 }; 230 };
230 231
231 SDK.SDKModel.register(SDK.ServiceWorkerCacheModel, SDK.Target.Capability.Browser , false); 232 SDK.SDKModel.register(SDK.ServiceWorkerCacheModel, SDK.Target.Capability.Browser , false);
232 233
233 /** @enum {symbol} */ 234 /** @enum {symbol} */
234 SDK.ServiceWorkerCacheModel.Events = { 235 SDK.ServiceWorkerCacheModel.Events = {
235 CacheAdded: Symbol('CacheAdded'), 236 CacheAdded: Symbol('CacheAdded'),
236 CacheRemoved: Symbol('CacheRemoved') 237 CacheRemoved: Symbol('CacheRemoved')
237 }; 238 };
238 239
239 /** 240 /**
240 * @unrestricted 241 * @unrestricted
241 */ 242 */
242 SDK.ServiceWorkerCacheModel.Entry = class { 243 SDK.ServiceWorkerCacheModel.Entry = class {
243 /** 244 /**
244 * @param {string} request 245 * @param {string} request
245 * @param {string} response 246 * @param {string} response
247 * @param {string} responseTime
246 */ 248 */
247 constructor(request, response) { 249 constructor(request, response, responseTime) {
248 this.request = request; 250 this.request = request;
249 this.response = response; 251 this.response = response;
252 this.responseTime = responseTime;
250 } 253 }
251 }; 254 };
252 255
253 /** 256 /**
254 * @unrestricted 257 * @unrestricted
255 */ 258 */
256 SDK.ServiceWorkerCacheModel.Cache = class { 259 SDK.ServiceWorkerCacheModel.Cache = class {
257 /** 260 /**
258 * @param {string} securityOrigin 261 * @param {string} securityOrigin
259 * @param {string} cacheName 262 * @param {string} cacheName
(...skipping 14 matching lines...) Expand all
274 } 277 }
275 278
276 /** 279 /**
277 * @override 280 * @override
278 * @return {string} 281 * @return {string}
279 */ 282 */
280 toString() { 283 toString() {
281 return this.securityOrigin + this.cacheName; 284 return this.securityOrigin + this.cacheName;
282 } 285 }
283 }; 286 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698