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

Side by Side Diff: third_party/WebKit/Source/modules/cachestorage/InspectorCacheStorageAgent.cpp

Issue 2468273002: [DevTools] migrate Database, IndexedDB and CacheStorage to new style (Closed)
Patch Set: addressed comments & rebased 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/modules/indexeddb/InspectorIndexedDBAgent.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "modules/cachestorage/InspectorCacheStorageAgent.h" 5 #include "modules/cachestorage/InspectorCacheStorageAgent.h"
6 6
7 #include "platform/heap/Handle.h" 7 #include "platform/heap/Handle.h"
8 #include "platform/weborigin/KURL.h" 8 #include "platform/weborigin/KURL.h"
9 #include "platform/weborigin/SecurityOrigin.h" 9 #include "platform/weborigin/SecurityOrigin.h"
10 #include "public/platform/Platform.h" 10 #include "public/platform/Platform.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 45
46 namespace { 46 namespace {
47 47
48 String buildCacheId(const String& securityOrigin, const String& cacheName) { 48 String buildCacheId(const String& securityOrigin, const String& cacheName) {
49 String id(securityOrigin); 49 String id(securityOrigin);
50 id.append('|'); 50 id.append('|');
51 id.append(cacheName); 51 id.append(cacheName);
52 return id; 52 return id;
53 } 53 }
54 54
55 bool parseCacheId(ErrorString* errorString, 55 Response parseCacheId(const String& id,
56 const String& id, 56 String* securityOrigin,
57 String* securityOrigin, 57 String* cacheName) {
58 String* cacheName) {
59 size_t pipe = id.find('|'); 58 size_t pipe = id.find('|');
60 if (pipe == WTF::kNotFound) { 59 if (pipe == WTF::kNotFound)
61 *errorString = "Invalid cache id."; 60 return Response::Error("Invalid cache id.");
62 return false;
63 }
64 *securityOrigin = id.substring(0, pipe); 61 *securityOrigin = id.substring(0, pipe);
65 *cacheName = id.substring(pipe + 1); 62 *cacheName = id.substring(pipe + 1);
66 return true; 63 return Response::OK();
67 } 64 }
68 65
69 std::unique_ptr<WebServiceWorkerCacheStorage> assertCacheStorage( 66 Response assertCacheStorage(
70 ErrorString* errorString, 67 const String& securityOrigin,
71 const String& securityOrigin) { 68 std::unique_ptr<WebServiceWorkerCacheStorage>& result) {
72 RefPtr<SecurityOrigin> secOrigin = 69 RefPtr<SecurityOrigin> secOrigin =
73 SecurityOrigin::createFromString(securityOrigin); 70 SecurityOrigin::createFromString(securityOrigin);
74 71
75 // Cache Storage API is restricted to trustworthy origins. 72 // Cache Storage API is restricted to trustworthy origins.
76 if (!secOrigin->isPotentiallyTrustworthy()) { 73 if (!secOrigin->isPotentiallyTrustworthy())
77 *errorString = secOrigin->isPotentiallyTrustworthyErrorMessage(); 74 return Response::Error(secOrigin->isPotentiallyTrustworthyErrorMessage());
78 return nullptr;
79 }
80 75
81 std::unique_ptr<WebServiceWorkerCacheStorage> cache = wrapUnique( 76 std::unique_ptr<WebServiceWorkerCacheStorage> cache = wrapUnique(
82 Platform::current()->cacheStorage(WebSecurityOrigin(secOrigin))); 77 Platform::current()->cacheStorage(WebSecurityOrigin(secOrigin)));
83 if (!cache) 78 if (!cache)
84 *errorString = "Could not find cache storage."; 79 return Response::Error("Could not find cache storage.");
85 return cache; 80 result = std::move(cache);
81 return Response::OK();
86 } 82 }
87 83
88 std::unique_ptr<WebServiceWorkerCacheStorage> assertCacheStorageAndNameForId( 84 Response assertCacheStorageAndNameForId(
89 ErrorString* errorString,
90 const String& cacheId, 85 const String& cacheId,
91 String* cacheName) { 86 String* cacheName,
87 std::unique_ptr<WebServiceWorkerCacheStorage>& result) {
92 String securityOrigin; 88 String securityOrigin;
93 if (!parseCacheId(errorString, cacheId, &securityOrigin, cacheName)) { 89 Response response = parseCacheId(cacheId, &securityOrigin, cacheName);
94 return nullptr; 90 if (!response.isSuccess())
95 } 91 return response;
96 return assertCacheStorage(errorString, securityOrigin); 92 return assertCacheStorage(securityOrigin, result);
97 } 93 }
98 94
99 CString serviceWorkerCacheErrorString(WebServiceWorkerCacheError error) { 95 CString serviceWorkerCacheErrorString(WebServiceWorkerCacheError error) {
100 switch (error) { 96 switch (error) {
101 case WebServiceWorkerCacheErrorNotImplemented: 97 case WebServiceWorkerCacheErrorNotImplemented:
102 return CString("not implemented."); 98 return CString("not implemented.");
103 break; 99 break;
104 case WebServiceWorkerCacheErrorNotFound: 100 case WebServiceWorkerCacheErrorNotFound:
105 return CString("not found."); 101 return CString("not found.");
106 break; 102 break;
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 .setSecurityOrigin(m_securityOrigin) 134 .setSecurityOrigin(m_securityOrigin)
139 .setCacheName(name) 135 .setCacheName(name)
140 .setCacheId(buildCacheId(m_securityOrigin, name)) 136 .setCacheId(buildCacheId(m_securityOrigin, name))
141 .build(); 137 .build();
142 array->addItem(std::move(entry)); 138 array->addItem(std::move(entry));
143 } 139 }
144 m_callback->sendSuccess(std::move(array)); 140 m_callback->sendSuccess(std::move(array));
145 } 141 }
146 142
147 void onError(WebServiceWorkerCacheError error) override { 143 void onError(WebServiceWorkerCacheError error) override {
148 m_callback->sendFailure( 144 m_callback->sendFailure(Response::Error(
149 String::format("Error requesting cache names: %s", 145 String::format("Error requesting cache names: %s",
150 serviceWorkerCacheErrorString(error).data())); 146 serviceWorkerCacheErrorString(error).data())));
151 } 147 }
152 148
153 private: 149 private:
154 String m_securityOrigin; 150 String m_securityOrigin;
155 std::unique_ptr<RequestCacheNamesCallback> m_callback; 151 std::unique_ptr<RequestCacheNamesCallback> m_callback;
156 }; 152 };
157 153
158 struct DataRequestParams { 154 struct DataRequestParams {
159 String cacheName; 155 String cacheName;
160 int skipCount; 156 int skipCount;
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 std::unique_ptr<DataEntry> entry = 205 std::unique_ptr<DataEntry> entry =
210 DataEntry::create() 206 DataEntry::create()
211 .setRequest(requestResponse.request) 207 .setRequest(requestResponse.request)
212 .setResponse(requestResponse.response) 208 .setResponse(requestResponse.response)
213 .build(); 209 .build();
214 array->addItem(std::move(entry)); 210 array->addItem(std::move(entry));
215 } 211 }
216 m_callback->sendSuccess(std::move(array), hasMore); 212 m_callback->sendSuccess(std::move(array), hasMore);
217 } 213 }
218 214
219 void sendFailure(const String& error) { m_callback->sendFailure(error); } 215 void sendFailure(const Response& error) { m_callback->sendFailure(error); }
220 216
221 private: 217 private:
222 DataRequestParams m_params; 218 DataRequestParams m_params;
223 int m_numResponsesLeft; 219 int m_numResponsesLeft;
224 Vector<RequestResponse> m_responses; 220 Vector<RequestResponse> m_responses;
225 std::unique_ptr<RequestEntriesCallback> m_callback; 221 std::unique_ptr<RequestEntriesCallback> m_callback;
226 }; 222 };
227 223
228 class GetCacheResponsesForRequestData 224 class GetCacheResponsesForRequestData
229 : public WebServiceWorkerCache::CacheMatchCallbacks { 225 : public WebServiceWorkerCache::CacheMatchCallbacks {
230 WTF_MAKE_NONCOPYABLE(GetCacheResponsesForRequestData); 226 WTF_MAKE_NONCOPYABLE(GetCacheResponsesForRequestData);
231 227
232 public: 228 public:
233 GetCacheResponsesForRequestData(const DataRequestParams& params, 229 GetCacheResponsesForRequestData(const DataRequestParams& params,
234 const WebServiceWorkerRequest& request, 230 const WebServiceWorkerRequest& request,
235 PassRefPtr<ResponsesAccumulator> accum) 231 PassRefPtr<ResponsesAccumulator> accum)
236 : m_params(params), m_request(request), m_accumulator(accum) {} 232 : m_params(params), m_request(request), m_accumulator(accum) {}
237 ~GetCacheResponsesForRequestData() override {} 233 ~GetCacheResponsesForRequestData() override {}
238 234
239 void onSuccess(const WebServiceWorkerResponse& response) override { 235 void onSuccess(const WebServiceWorkerResponse& response) override {
240 m_accumulator->addRequestResponsePair(m_request, response); 236 m_accumulator->addRequestResponsePair(m_request, response);
241 } 237 }
242 238
243 void onError(WebServiceWorkerCacheError error) override { 239 void onError(WebServiceWorkerCacheError error) override {
244 m_accumulator->sendFailure( 240 m_accumulator->sendFailure(Response::Error(
245 String::format("Error requesting responses for cache %s: %s", 241 String::format("Error requesting responses for cache %s: %s",
246 m_params.cacheName.utf8().data(), 242 m_params.cacheName.utf8().data(),
247 serviceWorkerCacheErrorString(error).data())); 243 serviceWorkerCacheErrorString(error).data())));
248 } 244 }
249 245
250 private: 246 private:
251 DataRequestParams m_params; 247 DataRequestParams m_params;
252 WebServiceWorkerRequest m_request; 248 WebServiceWorkerRequest m_request;
253 RefPtr<ResponsesAccumulator> m_accumulator; 249 RefPtr<ResponsesAccumulator> m_accumulator;
254 }; 250 };
255 251
256 class GetCacheKeysForRequestData 252 class GetCacheKeysForRequestData
257 : public WebServiceWorkerCache::CacheWithRequestsCallbacks { 253 : public WebServiceWorkerCache::CacheWithRequestsCallbacks {
(...skipping 22 matching lines...) Expand all
280 for (size_t i = 0; i < requests.size(); i++) { 276 for (size_t i = 0; i < requests.size(); i++) {
281 const auto& request = requests[i]; 277 const auto& request = requests[i];
282 auto* cacheRequest = 278 auto* cacheRequest =
283 new GetCacheResponsesForRequestData(m_params, request, accumulator); 279 new GetCacheResponsesForRequestData(m_params, request, accumulator);
284 m_cache->dispatchMatch(cacheRequest, request, 280 m_cache->dispatchMatch(cacheRequest, request,
285 WebServiceWorkerCache::QueryParams()); 281 WebServiceWorkerCache::QueryParams());
286 } 282 }
287 } 283 }
288 284
289 void onError(WebServiceWorkerCacheError error) override { 285 void onError(WebServiceWorkerCacheError error) override {
290 m_callback->sendFailure( 286 m_callback->sendFailure(Response::Error(
291 String::format("Error requesting requests for cache %s: %s", 287 String::format("Error requesting requests for cache %s: %s",
292 m_params.cacheName.utf8().data(), 288 m_params.cacheName.utf8().data(),
293 serviceWorkerCacheErrorString(error).data())); 289 serviceWorkerCacheErrorString(error).data())));
294 } 290 }
295 291
296 private: 292 private:
297 DataRequestParams m_params; 293 DataRequestParams m_params;
298 std::unique_ptr<WebServiceWorkerCache> m_cache; 294 std::unique_ptr<WebServiceWorkerCache> m_cache;
299 std::unique_ptr<RequestEntriesCallback> m_callback; 295 std::unique_ptr<RequestEntriesCallback> m_callback;
300 }; 296 };
301 297
302 class GetCacheForRequestData 298 class GetCacheForRequestData
303 : public WebServiceWorkerCacheStorage::CacheStorageWithCacheCallbacks { 299 : public WebServiceWorkerCacheStorage::CacheStorageWithCacheCallbacks {
304 WTF_MAKE_NONCOPYABLE(GetCacheForRequestData); 300 WTF_MAKE_NONCOPYABLE(GetCacheForRequestData);
305 301
306 public: 302 public:
307 GetCacheForRequestData(const DataRequestParams& params, 303 GetCacheForRequestData(const DataRequestParams& params,
308 std::unique_ptr<RequestEntriesCallback> callback) 304 std::unique_ptr<RequestEntriesCallback> callback)
309 : m_params(params), m_callback(std::move(callback)) {} 305 : m_params(params), m_callback(std::move(callback)) {}
310 ~GetCacheForRequestData() override {} 306 ~GetCacheForRequestData() override {}
311 307
312 void onSuccess(std::unique_ptr<WebServiceWorkerCache> cache) override { 308 void onSuccess(std::unique_ptr<WebServiceWorkerCache> cache) override {
313 auto* cacheRequest = new GetCacheKeysForRequestData( 309 auto* cacheRequest = new GetCacheKeysForRequestData(
314 m_params, wrapUnique(cache.release()), std::move(m_callback)); 310 m_params, wrapUnique(cache.release()), std::move(m_callback));
315 cacheRequest->cache()->dispatchKeys(cacheRequest, WebServiceWorkerRequest(), 311 cacheRequest->cache()->dispatchKeys(cacheRequest, WebServiceWorkerRequest(),
316 WebServiceWorkerCache::QueryParams()); 312 WebServiceWorkerCache::QueryParams());
317 } 313 }
318 314
319 void onError(WebServiceWorkerCacheError error) override { 315 void onError(WebServiceWorkerCacheError error) override {
320 m_callback->sendFailure(String::format( 316 m_callback->sendFailure(Response::Error(String::format(
321 "Error requesting cache %s: %s", m_params.cacheName.utf8().data(), 317 "Error requesting cache %s: %s", m_params.cacheName.utf8().data(),
322 serviceWorkerCacheErrorString(error).data())); 318 serviceWorkerCacheErrorString(error).data())));
323 } 319 }
324 320
325 private: 321 private:
326 DataRequestParams m_params; 322 DataRequestParams m_params;
327 std::unique_ptr<RequestEntriesCallback> m_callback; 323 std::unique_ptr<RequestEntriesCallback> m_callback;
328 }; 324 };
329 325
330 class DeleteCache : public WebServiceWorkerCacheStorage::CacheStorageCallbacks { 326 class DeleteCache : public WebServiceWorkerCacheStorage::CacheStorageCallbacks {
331 WTF_MAKE_NONCOPYABLE(DeleteCache); 327 WTF_MAKE_NONCOPYABLE(DeleteCache);
332 328
333 public: 329 public:
334 DeleteCache(std::unique_ptr<DeleteCacheCallback> callback) 330 DeleteCache(std::unique_ptr<DeleteCacheCallback> callback)
335 : m_callback(std::move(callback)) {} 331 : m_callback(std::move(callback)) {}
336 ~DeleteCache() override {} 332 ~DeleteCache() override {}
337 333
338 void onSuccess() override { m_callback->sendSuccess(); } 334 void onSuccess() override { m_callback->sendSuccess(); }
339 335
340 void onError(WebServiceWorkerCacheError error) override { 336 void onError(WebServiceWorkerCacheError error) override {
341 m_callback->sendFailure( 337 m_callback->sendFailure(Response::Error(
342 String::format("Error requesting cache names: %s", 338 String::format("Error requesting cache names: %s",
343 serviceWorkerCacheErrorString(error).data())); 339 serviceWorkerCacheErrorString(error).data())));
344 } 340 }
345 341
346 private: 342 private:
347 std::unique_ptr<DeleteCacheCallback> m_callback; 343 std::unique_ptr<DeleteCacheCallback> m_callback;
348 }; 344 };
349 345
350 class DeleteCacheEntry : public WebServiceWorkerCache::CacheBatchCallbacks { 346 class DeleteCacheEntry : public WebServiceWorkerCache::CacheBatchCallbacks {
351 WTF_MAKE_NONCOPYABLE(DeleteCacheEntry); 347 WTF_MAKE_NONCOPYABLE(DeleteCacheEntry);
352 348
353 public: 349 public:
354 DeleteCacheEntry(std::unique_ptr<DeleteEntryCallback> callback) 350 DeleteCacheEntry(std::unique_ptr<DeleteEntryCallback> callback)
355 : m_callback(std::move(callback)) {} 351 : m_callback(std::move(callback)) {}
356 ~DeleteCacheEntry() override {} 352 ~DeleteCacheEntry() override {}
357 353
358 void onSuccess() override { m_callback->sendSuccess(); } 354 void onSuccess() override { m_callback->sendSuccess(); }
359 355
360 void onError(WebServiceWorkerCacheError error) override { 356 void onError(WebServiceWorkerCacheError error) override {
361 m_callback->sendFailure( 357 m_callback->sendFailure(Response::Error(
362 String::format("Error requesting cache names: %s", 358 String::format("Error requesting cache names: %s",
363 serviceWorkerCacheErrorString(error).data())); 359 serviceWorkerCacheErrorString(error).data())));
364 } 360 }
365 361
366 private: 362 private:
367 std::unique_ptr<DeleteEntryCallback> m_callback; 363 std::unique_ptr<DeleteEntryCallback> m_callback;
368 }; 364 };
369 365
370 class GetCacheForDeleteEntry 366 class GetCacheForDeleteEntry
371 : public WebServiceWorkerCacheStorage::CacheStorageWithCacheCallbacks { 367 : public WebServiceWorkerCacheStorage::CacheStorageWithCacheCallbacks {
372 WTF_MAKE_NONCOPYABLE(GetCacheForDeleteEntry); 368 WTF_MAKE_NONCOPYABLE(GetCacheForDeleteEntry);
373 369
(...skipping 11 matching lines...) Expand all
385 BatchOperation deleteOperation; 381 BatchOperation deleteOperation;
386 deleteOperation.operationType = WebServiceWorkerCache::OperationTypeDelete; 382 deleteOperation.operationType = WebServiceWorkerCache::OperationTypeDelete;
387 deleteOperation.request.setURL(KURL(ParsedURLString, m_requestSpec)); 383 deleteOperation.request.setURL(KURL(ParsedURLString, m_requestSpec));
388 Vector<BatchOperation> operations; 384 Vector<BatchOperation> operations;
389 operations.append(deleteOperation); 385 operations.append(deleteOperation);
390 cache.release()->dispatchBatch(deleteRequest, 386 cache.release()->dispatchBatch(deleteRequest,
391 WebVector<BatchOperation>(operations)); 387 WebVector<BatchOperation>(operations));
392 } 388 }
393 389
394 void onError(WebServiceWorkerCacheError error) override { 390 void onError(WebServiceWorkerCacheError error) override {
395 m_callback->sendFailure(String::format( 391 m_callback->sendFailure(Response::Error(String::format(
396 "Error requesting cache %s: %s", m_cacheName.utf8().data(), 392 "Error requesting cache %s: %s", m_cacheName.utf8().data(),
397 serviceWorkerCacheErrorString(error).data())); 393 serviceWorkerCacheErrorString(error).data())));
398 } 394 }
399 395
400 private: 396 private:
401 String m_requestSpec; 397 String m_requestSpec;
402 String m_cacheName; 398 String m_cacheName;
403 std::unique_ptr<DeleteEntryCallback> m_callback; 399 std::unique_ptr<DeleteEntryCallback> m_callback;
404 }; 400 };
405 401
406 } // namespace 402 } // namespace
407 403
(...skipping 12 matching lines...) Expand all
420 SecurityOrigin::createFromString(securityOrigin); 416 SecurityOrigin::createFromString(securityOrigin);
421 417
422 // Cache Storage API is restricted to trustworthy origins. 418 // Cache Storage API is restricted to trustworthy origins.
423 if (!secOrigin->isPotentiallyTrustworthy()) { 419 if (!secOrigin->isPotentiallyTrustworthy()) {
424 // Don't treat this as an error, just don't attempt to open and enumerate 420 // Don't treat this as an error, just don't attempt to open and enumerate
425 // the caches. 421 // the caches.
426 callback->sendSuccess(Array<protocol::CacheStorage::Cache>::create()); 422 callback->sendSuccess(Array<protocol::CacheStorage::Cache>::create());
427 return; 423 return;
428 } 424 }
429 425
430 ErrorString errorString; 426 std::unique_ptr<WebServiceWorkerCacheStorage> cache;
431 std::unique_ptr<WebServiceWorkerCacheStorage> cache = 427 Response response = assertCacheStorage(securityOrigin, cache);
432 assertCacheStorage(&errorString, securityOrigin); 428 if (!response.isSuccess()) {
433 if (!cache) { 429 callback->sendFailure(response);
434 callback->sendFailure(errorString);
435 return; 430 return;
436 } 431 }
437 cache->dispatchKeys( 432 cache->dispatchKeys(
438 new RequestCacheNames(securityOrigin, std::move(callback))); 433 new RequestCacheNames(securityOrigin, std::move(callback)));
439 } 434 }
440 435
441 void InspectorCacheStorageAgent::requestEntries( 436 void InspectorCacheStorageAgent::requestEntries(
442 const String& cacheId, 437 const String& cacheId,
443 int skipCount, 438 int skipCount,
444 int pageSize, 439 int pageSize,
445 std::unique_ptr<RequestEntriesCallback> callback) { 440 std::unique_ptr<RequestEntriesCallback> callback) {
446 ErrorString errorString;
447 String cacheName; 441 String cacheName;
448 std::unique_ptr<WebServiceWorkerCacheStorage> cache = 442 std::unique_ptr<WebServiceWorkerCacheStorage> cache;
449 assertCacheStorageAndNameForId(&errorString, cacheId, &cacheName); 443 Response response =
450 if (!cache) { 444 assertCacheStorageAndNameForId(cacheId, &cacheName, cache);
451 callback->sendFailure(errorString); 445 if (!response.isSuccess()) {
446 callback->sendFailure(response);
452 return; 447 return;
453 } 448 }
454 DataRequestParams params; 449 DataRequestParams params;
455 params.cacheName = cacheName; 450 params.cacheName = cacheName;
456 params.pageSize = pageSize; 451 params.pageSize = pageSize;
457 params.skipCount = skipCount; 452 params.skipCount = skipCount;
458 cache->dispatchOpen(new GetCacheForRequestData(params, std::move(callback)), 453 cache->dispatchOpen(new GetCacheForRequestData(params, std::move(callback)),
459 WebString(cacheName)); 454 WebString(cacheName));
460 } 455 }
461 456
462 void InspectorCacheStorageAgent::deleteCache( 457 void InspectorCacheStorageAgent::deleteCache(
463 const String& cacheId, 458 const String& cacheId,
464 std::unique_ptr<DeleteCacheCallback> callback) { 459 std::unique_ptr<DeleteCacheCallback> callback) {
465 String cacheName; 460 String cacheName;
466 ErrorString errorString; 461 std::unique_ptr<WebServiceWorkerCacheStorage> cache;
467 std::unique_ptr<WebServiceWorkerCacheStorage> cache = 462 Response response =
468 assertCacheStorageAndNameForId(&errorString, cacheId, &cacheName); 463 assertCacheStorageAndNameForId(cacheId, &cacheName, cache);
469 if (!cache) { 464 if (!response.isSuccess()) {
470 callback->sendFailure(errorString); 465 callback->sendFailure(response);
471 return; 466 return;
472 } 467 }
473 cache->dispatchDelete(new DeleteCache(std::move(callback)), 468 cache->dispatchDelete(new DeleteCache(std::move(callback)),
474 WebString(cacheName)); 469 WebString(cacheName));
475 } 470 }
476 471
477 void InspectorCacheStorageAgent::deleteEntry( 472 void InspectorCacheStorageAgent::deleteEntry(
478 const String& cacheId, 473 const String& cacheId,
479 const String& request, 474 const String& request,
480 std::unique_ptr<DeleteEntryCallback> callback) { 475 std::unique_ptr<DeleteEntryCallback> callback) {
481 String cacheName; 476 String cacheName;
482 ErrorString errorString; 477 std::unique_ptr<WebServiceWorkerCacheStorage> cache;
483 std::unique_ptr<WebServiceWorkerCacheStorage> cache = 478 Response response =
484 assertCacheStorageAndNameForId(&errorString, cacheId, &cacheName); 479 assertCacheStorageAndNameForId(cacheId, &cacheName, cache);
485 if (!cache) { 480 if (!response.isSuccess()) {
486 callback->sendFailure(errorString); 481 callback->sendFailure(response);
487 return; 482 return;
488 } 483 }
489 cache->dispatchOpen( 484 cache->dispatchOpen(
490 new GetCacheForDeleteEntry(request, cacheName, std::move(callback)), 485 new GetCacheForDeleteEntry(request, cacheName, std::move(callback)),
491 WebString(cacheName)); 486 WebString(cacheName));
492 } 487 }
493 488
494 } // namespace blink 489 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/modules/indexeddb/InspectorIndexedDBAgent.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698