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

Side by Side Diff: Source/modules/cachestorage/Cache.cpp

Issue 1320563003: Oilpan: avoid using WeakPtr<> for heap residing objects. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: revert unrelated unit test addition Created 5 years, 3 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 | Annotate | Revision Log
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 "config.h" 5 #include "config.h"
6 #include "modules/cachestorage/Cache.h" 6 #include "modules/cachestorage/Cache.h"
7 7
8 #include "bindings/core/v8/CallbackPromiseAdapter.h" 8 #include "bindings/core/v8/CallbackPromiseAdapter.h"
9 #include "bindings/core/v8/ExceptionState.h" 9 #include "bindings/core/v8/ExceptionState.h"
10 #include "bindings/core/v8/ScriptPromiseResolver.h" 10 #include "bindings/core/v8/ScriptPromiseResolver.h"
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 } 270 }
271 271
272 private: 272 private:
273 const size_t m_index; 273 const size_t m_index;
274 Member<BarrierCallbackForPut> m_barrierCallback; 274 Member<BarrierCallbackForPut> m_barrierCallback;
275 275
276 WebServiceWorkerRequest m_webRequest; 276 WebServiceWorkerRequest m_webRequest;
277 WebServiceWorkerResponse m_webResponse; 277 WebServiceWorkerResponse m_webResponse;
278 }; 278 };
279 279
280 Cache* Cache::create(WeakPtr<GlobalFetch::ScopedFetcher> fetcher, PassOwnPtr<Web ServiceWorkerCache> webCache) 280 Cache* Cache::create(WeakPtrWillBeRawPtr<GlobalFetch::ScopedFetcher> fetcher, Pa ssOwnPtr<WebServiceWorkerCache> webCache)
281 { 281 {
282 return new Cache(fetcher, webCache); 282 return new Cache(fetcher, webCache);
283 } 283 }
284 284
285 ScriptPromise Cache::match(ScriptState* scriptState, const RequestInfo& request, const CacheQueryOptions& options, ExceptionState& exceptionState) 285 ScriptPromise Cache::match(ScriptState* scriptState, const RequestInfo& request, const CacheQueryOptions& options, ExceptionState& exceptionState)
286 { 286 {
287 ASSERT(!request.isNull()); 287 ASSERT(!request.isNull());
288 if (request.isRequest()) 288 if (request.isRequest())
289 return matchImpl(scriptState, request.getAsRequest(), options); 289 return matchImpl(scriptState, request.getAsRequest(), options);
290 Request* newRequest = Request::create(scriptState, request.getAsUSVString(), exceptionState); 290 Request* newRequest = Request::create(scriptState, request.getAsUSVString(), exceptionState);
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
382 WebServiceWorkerCache::QueryParams Cache::toWebQueryParams(const CacheQueryOptio ns& options) 382 WebServiceWorkerCache::QueryParams Cache::toWebQueryParams(const CacheQueryOptio ns& options)
383 { 383 {
384 WebServiceWorkerCache::QueryParams webQueryParams; 384 WebServiceWorkerCache::QueryParams webQueryParams;
385 webQueryParams.ignoreSearch = options.ignoreSearch(); 385 webQueryParams.ignoreSearch = options.ignoreSearch();
386 webQueryParams.ignoreMethod = options.ignoreMethod(); 386 webQueryParams.ignoreMethod = options.ignoreMethod();
387 webQueryParams.ignoreVary = options.ignoreVary(); 387 webQueryParams.ignoreVary = options.ignoreVary();
388 webQueryParams.cacheName = options.cacheName(); 388 webQueryParams.cacheName = options.cacheName();
389 return webQueryParams; 389 return webQueryParams;
390 } 390 }
391 391
392 Cache::Cache(WeakPtr<GlobalFetch::ScopedFetcher> fetcher, PassOwnPtr<WebServiceW orkerCache> webCache) 392 Cache::Cache(WeakPtrWillBeRawPtr<GlobalFetch::ScopedFetcher> fetcher, PassOwnPtr <WebServiceWorkerCache> webCache)
393 : m_scopedFetcher(fetcher) 393 : m_scopedFetcher(fetcher)
394 , m_webCache(webCache) { } 394 , m_webCache(webCache)
395 {
396 }
397
398 DEFINE_TRACE(Cache)
399 {
400 visitor->trace(m_scopedFetcher);
401 }
395 402
396 ScriptPromise Cache::matchImpl(ScriptState* scriptState, const Request* request, const CacheQueryOptions& options) 403 ScriptPromise Cache::matchImpl(ScriptState* scriptState, const Request* request, const CacheQueryOptions& options)
397 { 404 {
398 WebServiceWorkerRequest webRequest; 405 WebServiceWorkerRequest webRequest;
399 request->populateWebServiceWorkerRequest(webRequest); 406 request->populateWebServiceWorkerRequest(webRequest);
400 407
401 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState) ; 408 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState) ;
402 const ScriptPromise promise = resolver->promise(); 409 const ScriptPromise promise = resolver->promise();
403 m_webCache->dispatchMatch(new CacheMatchCallbacks(resolver), webRequest, toW ebQueryParams(options)); 410 m_webCache->dispatchMatch(new CacheMatchCallbacks(resolver), webRequest, toW ebQueryParams(options));
404 return promise; 411 return promise;
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
525 m_webCache->dispatchKeys(new CacheWithRequestsCallbacks(resolver), 0, toWebQ ueryParams(options)); 532 m_webCache->dispatchKeys(new CacheWithRequestsCallbacks(resolver), 0, toWebQ ueryParams(options));
526 return promise; 533 return promise;
527 } 534 }
528 535
529 WebServiceWorkerCache* Cache::webCache() const 536 WebServiceWorkerCache* Cache::webCache() const
530 { 537 {
531 return m_webCache.get(); 538 return m_webCache.get();
532 } 539 }
533 540
534 } // namespace blink 541 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698