OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/GlobalCacheStorage.h" | 5 #include "modules/cachestorage/GlobalCacheStorage.h" |
6 | 6 |
7 #include "core/dom/ExecutionContext.h" | 7 #include "core/dom/ExecutionContext.h" |
8 #include "core/frame/LocalDOMWindow.h" | 8 #include "core/frame/LocalDOMWindow.h" |
9 #include "core/frame/UseCounter.h" | 9 #include "core/frame/UseCounter.h" |
10 #include "core/workers/WorkerGlobalScope.h" | 10 #include "core/workers/WorkerGlobalScope.h" |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 "Cache storage is disabled inside 'data:' URLs."); | 53 "Cache storage is disabled inside 'data:' URLs."); |
54 else | 54 else |
55 exception_state.ThrowSecurityError( | 55 exception_state.ThrowSecurityError( |
56 "Access to cache storage is denied."); | 56 "Access to cache storage is denied."); |
57 return nullptr; | 57 return nullptr; |
58 } | 58 } |
59 | 59 |
60 if (!caches_) { | 60 if (!caches_) { |
61 caches_ = CacheStorage::Create( | 61 caches_ = CacheStorage::Create( |
62 GlobalFetch::ScopedFetcher::From(fetching_scope), | 62 GlobalFetch::ScopedFetcher::From(fetching_scope), |
63 Platform::Current()->CacheStorage( | 63 Platform::Current()->CreateCacheStorage( |
64 WebSecurityOrigin(context->GetSecurityOrigin()))); | 64 WebSecurityOrigin(context->GetSecurityOrigin()))); |
65 } | 65 } |
66 return caches_; | 66 return caches_; |
67 } | 67 } |
68 | 68 |
69 // Promptly dispose of associated CacheStorage. | 69 // Promptly dispose of associated CacheStorage. |
70 EAGERLY_FINALIZE(); | 70 EAGERLY_FINALIZE(); |
71 DEFINE_INLINE_VIRTUAL_TRACE() { | 71 DEFINE_INLINE_VIRTUAL_TRACE() { |
72 visitor->Trace(caches_); | 72 visitor->Trace(caches_); |
73 Supplement<T>::Trace(visitor); | 73 Supplement<T>::Trace(visitor); |
(...skipping 17 matching lines...) Expand all Loading... |
91 } | 91 } |
92 | 92 |
93 CacheStorage* GlobalCacheStorage::caches(WorkerGlobalScope& worker, | 93 CacheStorage* GlobalCacheStorage::caches(WorkerGlobalScope& worker, |
94 ExceptionState& exception_state) { | 94 ExceptionState& exception_state) { |
95 return GlobalCacheStorageImpl<WorkerGlobalScope>::From( | 95 return GlobalCacheStorageImpl<WorkerGlobalScope>::From( |
96 worker, worker.GetExecutionContext()) | 96 worker, worker.GetExecutionContext()) |
97 .Caches(worker, exception_state); | 97 .Caches(worker, exception_state); |
98 } | 98 } |
99 | 99 |
100 } // namespace blink | 100 } // namespace blink |
OLD | NEW |