| 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 #include "modules/cachestorage/Cache.h" | 5 #include "modules/cachestorage/Cache.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/CallbackPromiseAdapter.h" | 7 #include "bindings/core/v8/CallbackPromiseAdapter.h" |
| 8 #include "bindings/core/v8/ExceptionState.h" | 8 #include "bindings/core/v8/ExceptionState.h" |
| 9 #include "bindings/core/v8/ScriptPromiseResolver.h" | 9 #include "bindings/core/v8/ScriptPromiseResolver.h" |
| 10 #include "bindings/core/v8/ScriptState.h" | 10 #include "bindings/core/v8/ScriptState.h" |
| (...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 353 } | 353 } |
| 354 | 354 |
| 355 private: | 355 private: |
| 356 const size_t m_index; | 356 const size_t m_index; |
| 357 Member<BarrierCallbackForPut> m_barrierCallback; | 357 Member<BarrierCallbackForPut> m_barrierCallback; |
| 358 | 358 |
| 359 WebServiceWorkerRequest m_webRequest; | 359 WebServiceWorkerRequest m_webRequest; |
| 360 WebServiceWorkerResponse m_webResponse; | 360 WebServiceWorkerResponse m_webResponse; |
| 361 }; | 361 }; |
| 362 | 362 |
| 363 Cache* Cache::create(WeakPtrWillBeRawPtr<GlobalFetch::ScopedFetcher> fetcher, Pa
ssOwnPtr<WebServiceWorkerCache> webCache) | 363 Cache* Cache::create(RawPtr<GlobalFetch::ScopedFetcher> fetcher, PassOwnPtr<WebS
erviceWorkerCache> webCache) |
| 364 { | 364 { |
| 365 return new Cache(fetcher, webCache); | 365 return new Cache(fetcher, webCache); |
| 366 } | 366 } |
| 367 | 367 |
| 368 ScriptPromise Cache::match(ScriptState* scriptState, const RequestInfo& request,
const CacheQueryOptions& options, ExceptionState& exceptionState) | 368 ScriptPromise Cache::match(ScriptState* scriptState, const RequestInfo& request,
const CacheQueryOptions& options, ExceptionState& exceptionState) |
| 369 { | 369 { |
| 370 ASSERT(!request.isNull()); | 370 ASSERT(!request.isNull()); |
| 371 if (request.isRequest()) | 371 if (request.isRequest()) |
| 372 return matchImpl(scriptState, request.getAsRequest(), options); | 372 return matchImpl(scriptState, request.getAsRequest(), options); |
| 373 Request* newRequest = Request::create(scriptState, request.getAsUSVString(),
exceptionState); | 373 Request* newRequest = Request::create(scriptState, request.getAsUSVString(),
exceptionState); |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 465 WebServiceWorkerCache::QueryParams Cache::toWebQueryParams(const CacheQueryOptio
ns& options) | 465 WebServiceWorkerCache::QueryParams Cache::toWebQueryParams(const CacheQueryOptio
ns& options) |
| 466 { | 466 { |
| 467 WebServiceWorkerCache::QueryParams webQueryParams; | 467 WebServiceWorkerCache::QueryParams webQueryParams; |
| 468 webQueryParams.ignoreSearch = options.ignoreSearch() && RuntimeEnabledFeatur
es::cacheIgnoreSearchOptionEnabled(); | 468 webQueryParams.ignoreSearch = options.ignoreSearch() && RuntimeEnabledFeatur
es::cacheIgnoreSearchOptionEnabled(); |
| 469 webQueryParams.ignoreMethod = options.ignoreMethod(); | 469 webQueryParams.ignoreMethod = options.ignoreMethod(); |
| 470 webQueryParams.ignoreVary = options.ignoreVary(); | 470 webQueryParams.ignoreVary = options.ignoreVary(); |
| 471 webQueryParams.cacheName = options.cacheName(); | 471 webQueryParams.cacheName = options.cacheName(); |
| 472 return webQueryParams; | 472 return webQueryParams; |
| 473 } | 473 } |
| 474 | 474 |
| 475 Cache::Cache(WeakPtrWillBeRawPtr<GlobalFetch::ScopedFetcher> fetcher, PassOwnPtr
<WebServiceWorkerCache> webCache) | 475 Cache::Cache(RawPtr<GlobalFetch::ScopedFetcher> fetcher, PassOwnPtr<WebServiceWo
rkerCache> webCache) |
| 476 : m_scopedFetcher(fetcher) | 476 : m_scopedFetcher(fetcher) |
| 477 , m_webCache(webCache) | 477 , m_webCache(webCache) |
| 478 { | 478 { |
| 479 } | 479 } |
| 480 | 480 |
| 481 DEFINE_TRACE(Cache) | 481 DEFINE_TRACE(Cache) |
| 482 { | 482 { |
| 483 visitor->trace(m_scopedFetcher); | 483 visitor->trace(m_scopedFetcher); |
| 484 } | 484 } |
| 485 | 485 |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 617 m_webCache->dispatchKeys(new CacheWithRequestsCallbacks(resolver), 0, toWebQ
ueryParams(options)); | 617 m_webCache->dispatchKeys(new CacheWithRequestsCallbacks(resolver), 0, toWebQ
ueryParams(options)); |
| 618 return promise; | 618 return promise; |
| 619 } | 619 } |
| 620 | 620 |
| 621 WebServiceWorkerCache* Cache::webCache() const | 621 WebServiceWorkerCache* Cache::webCache() const |
| 622 { | 622 { |
| 623 return m_webCache.get(); | 623 return m_webCache.get(); |
| 624 } | 624 } |
| 625 | 625 |
| 626 } // namespace blink | 626 } // namespace blink |
| OLD | NEW |