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

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

Issue 1865913005: Nuke WebPassOwnPtr<T> and replace it with std::unique_ptr<T>. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 8 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 #include "modules/cachestorage/InspectorCacheStorageAgent.h" 5 #include "modules/cachestorage/InspectorCacheStorageAgent.h"
6
7 #include "platform/heap/Handle.h" 6 #include "platform/heap/Handle.h"
8 #include "platform/inspector_protocol/Dispatcher.h" 7 #include "platform/inspector_protocol/Dispatcher.h"
9 #include "platform/inspector_protocol/TypeBuilder.h" 8 #include "platform/inspector_protocol/TypeBuilder.h"
10 #include "platform/inspector_protocol/Values.h" 9 #include "platform/inspector_protocol/Values.h"
11 #include "platform/weborigin/KURL.h" 10 #include "platform/weborigin/KURL.h"
12 #include "platform/weborigin/SecurityOrigin.h" 11 #include "platform/weborigin/SecurityOrigin.h"
13 #include "public/platform/Platform.h" 12 #include "public/platform/Platform.h"
14 #include "public/platform/WebPassOwnPtr.h"
15 #include "public/platform/WebSecurityOrigin.h" 13 #include "public/platform/WebSecurityOrigin.h"
16 #include "public/platform/WebString.h" 14 #include "public/platform/WebString.h"
17 #include "public/platform/WebURL.h" 15 #include "public/platform/WebURL.h"
18 #include "public/platform/WebVector.h" 16 #include "public/platform/WebVector.h"
19 #include "public/platform/modules/serviceworker/WebServiceWorkerCache.h" 17 #include "public/platform/modules/serviceworker/WebServiceWorkerCache.h"
20 #include "public/platform/modules/serviceworker/WebServiceWorkerCacheError.h" 18 #include "public/platform/modules/serviceworker/WebServiceWorkerCacheError.h"
21 #include "public/platform/modules/serviceworker/WebServiceWorkerCacheStorage.h" 19 #include "public/platform/modules/serviceworker/WebServiceWorkerCacheStorage.h"
22 #include "public/platform/modules/serviceworker/WebServiceWorkerRequest.h" 20 #include "public/platform/modules/serviceworker/WebServiceWorkerRequest.h"
23 #include "public/platform/modules/serviceworker/WebServiceWorkerResponse.h" 21 #include "public/platform/modules/serviceworker/WebServiceWorkerResponse.h"
24 #include "wtf/Noncopyable.h" 22 #include "wtf/Noncopyable.h"
25 #include "wtf/OwnPtr.h" 23 #include "wtf/OwnPtr.h"
26 #include "wtf/PassRefPtr.h" 24 #include "wtf/PassRefPtr.h"
27 #include "wtf/RefCounted.h" 25 #include "wtf/RefCounted.h"
28 #include "wtf/RefPtr.h" 26 #include "wtf/RefPtr.h"
29 #include "wtf/Vector.h" 27 #include "wtf/Vector.h"
30 #include "wtf/text/StringBuilder.h" 28 #include "wtf/text/StringBuilder.h"
31 29
32 #include <algorithm> 30 #include <algorithm>
31 #include <memory>
33 32
34 using blink::protocol::Array; 33 using blink::protocol::Array;
35 using blink::protocol::CacheStorage::Cache; 34 using blink::protocol::CacheStorage::Cache;
36 using blink::protocol::CacheStorage::DataEntry; 35 using blink::protocol::CacheStorage::DataEntry;
37 36
38 typedef blink::protocol::Backend::CacheStorage::DeleteCacheCallback DeleteCacheC allback; 37 typedef blink::protocol::Backend::CacheStorage::DeleteCacheCallback DeleteCacheC allback;
39 typedef blink::protocol::Backend::CacheStorage::DeleteEntryCallback DeleteEntryC allback; 38 typedef blink::protocol::Backend::CacheStorage::DeleteEntryCallback DeleteEntryC allback;
40 typedef blink::protocol::Backend::CacheStorage::RequestCacheNamesCallback Reques tCacheNamesCallback; 39 typedef blink::protocol::Backend::CacheStorage::RequestCacheNamesCallback Reques tCacheNamesCallback;
41 typedef blink::protocol::Backend::CacheStorage::RequestEntriesCallback RequestEn triesCallback; 40 typedef blink::protocol::Backend::CacheStorage::RequestEntriesCallback RequestEn triesCallback;
42 typedef blink::protocol::Dispatcher::CallbackBase RequestCallback; 41 typedef blink::protocol::Dispatcher::CallbackBase RequestCallback;
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 WTF_MAKE_NONCOPYABLE(GetCacheForRequestData); 291 WTF_MAKE_NONCOPYABLE(GetCacheForRequestData);
293 292
294 public: 293 public:
295 GetCacheForRequestData(const DataRequestParams& params, PassOwnPtr<RequestEn triesCallback> callback) 294 GetCacheForRequestData(const DataRequestParams& params, PassOwnPtr<RequestEn triesCallback> callback)
296 : m_params(params) 295 : m_params(params)
297 , m_callback(callback) 296 , m_callback(callback)
298 { 297 {
299 } 298 }
300 ~GetCacheForRequestData() override { } 299 ~GetCacheForRequestData() override { }
301 300
302 void onSuccess(WebPassOwnPtr<WebServiceWorkerCache> cache) override 301 void onSuccess(std::unique_ptr<WebServiceWorkerCache> cache) override
303 { 302 {
304 auto* cacheRequest = new GetCacheKeysForRequestData(m_params, cache.rele ase(), m_callback.release()); 303 auto* cacheRequest = new GetCacheKeysForRequestData(m_params, adoptPtr(c ache.release()), m_callback.release());
305 cacheRequest->cache()->dispatchKeys(cacheRequest, nullptr, WebServiceWor kerCache::QueryParams()); 304 cacheRequest->cache()->dispatchKeys(cacheRequest, nullptr, WebServiceWor kerCache::QueryParams());
306 } 305 }
307 306
308 void onError(WebServiceWorkerCacheError error) override 307 void onError(WebServiceWorkerCacheError error) override
309 { 308 {
310 m_callback->sendFailure(String::format("Error requesting cache %s: %s", m_params.cacheName.utf8().data(), serviceWorkerCacheErrorString(error).data())); 309 m_callback->sendFailure(String::format("Error requesting cache %s: %s", m_params.cacheName.utf8().data(), serviceWorkerCacheErrorString(error).data()));
311 } 310 }
312 311
313 private: 312 private:
314 DataRequestParams m_params; 313 DataRequestParams m_params;
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
369 368
370 public: 369 public:
371 GetCacheForDeleteEntry(const String& requestSpec, const String& cacheName, P assOwnPtr<DeleteEntryCallback> callback) 370 GetCacheForDeleteEntry(const String& requestSpec, const String& cacheName, P assOwnPtr<DeleteEntryCallback> callback)
372 : m_requestSpec(requestSpec) 371 : m_requestSpec(requestSpec)
373 , m_cacheName(cacheName) 372 , m_cacheName(cacheName)
374 , m_callback(callback) 373 , m_callback(callback)
375 { 374 {
376 } 375 }
377 ~GetCacheForDeleteEntry() override { } 376 ~GetCacheForDeleteEntry() override { }
378 377
379 void onSuccess(WebPassOwnPtr<WebServiceWorkerCache> cache) override 378 void onSuccess(std::unique_ptr<WebServiceWorkerCache> cache) override
380 { 379 {
381 auto* deleteRequest = new DeleteCacheEntry(m_callback.release()); 380 auto* deleteRequest = new DeleteCacheEntry(m_callback.release());
382 BatchOperation deleteOperation; 381 BatchOperation deleteOperation;
383 deleteOperation.operationType = WebServiceWorkerCache::OperationTypeDele te; 382 deleteOperation.operationType = WebServiceWorkerCache::OperationTypeDele te;
384 deleteOperation.request.setURL(KURL(ParsedURLString, m_requestSpec)); 383 deleteOperation.request.setURL(KURL(ParsedURLString, m_requestSpec));
385 Vector<BatchOperation> operations; 384 Vector<BatchOperation> operations;
386 operations.append(deleteOperation); 385 operations.append(deleteOperation);
387 cache.release()->dispatchBatch(deleteRequest, WebVector<BatchOperation>( operations)); 386 cache.release()->dispatchBatch(deleteRequest, WebVector<BatchOperation>( operations));
388 } 387 }
389 388
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
463 OwnPtr<WebServiceWorkerCacheStorage> cache = assertCacheStorageAndNameForId( errorString, cacheId, &cacheName); 462 OwnPtr<WebServiceWorkerCacheStorage> cache = assertCacheStorageAndNameForId( errorString, cacheId, &cacheName);
464 if (!cache) { 463 if (!cache) {
465 callback->sendFailure(*errorString); 464 callback->sendFailure(*errorString);
466 return; 465 return;
467 } 466 }
468 cache->dispatchOpen(new GetCacheForDeleteEntry(request, cacheName, callback) , WebString(cacheName)); 467 cache->dispatchOpen(new GetCacheForDeleteEntry(request, cacheName, callback) , WebString(cacheName));
469 } 468 }
470 469
471 470
472 } // namespace blink 471 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698