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

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

Issue 1773813007: blink: Rename modules/ method to prefix with get when they collide. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: clash-modules: rebase-fixes Created 4 years, 9 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 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 22 matching lines...) Expand all
33 } 33 }
34 34
35 ~GlobalCacheStorageImpl() 35 ~GlobalCacheStorageImpl()
36 { 36 {
37 if (m_caches) 37 if (m_caches)
38 m_caches->dispose(); 38 m_caches->dispose();
39 } 39 }
40 40
41 CacheStorage* caches(T& fetchingScope, ExceptionState& exceptionState) 41 CacheStorage* caches(T& fetchingScope, ExceptionState& exceptionState)
42 { 42 {
43 ExecutionContext* context = fetchingScope.executionContext(); 43 ExecutionContext* context = fetchingScope.getExecutionContext();
44 if (!context->securityOrigin()->canAccessCacheStorage()) { 44 if (!context->getSecurityOrigin()->canAccessCacheStorage()) {
45 if (context->securityContext().isSandboxed(SandboxOrigin)) 45 if (context->securityContext().isSandboxed(SandboxOrigin))
46 exceptionState.throwSecurityError("Cache storage is disabled bec ause the context is sandboxed and lacks the 'allow-same-origin' flag."); 46 exceptionState.throwSecurityError("Cache storage is disabled bec ause the context is sandboxed and lacks the 'allow-same-origin' flag.");
47 else if (context->url().protocolIs("data")) 47 else if (context->url().protocolIs("data"))
48 exceptionState.throwSecurityError("Cache storage is disabled ins ide 'data:' URLs."); 48 exceptionState.throwSecurityError("Cache storage is disabled ins ide 'data:' URLs.");
49 else 49 else
50 exceptionState.throwSecurityError("Access to cache storage is de nied."); 50 exceptionState.throwSecurityError("Access to cache storage is de nied.");
51 return nullptr; 51 return nullptr;
52 } 52 }
53 53
54 if (!m_caches) { 54 if (!m_caches) {
55 m_caches = CacheStorage::create(GlobalFetch::ScopedFetcher::from(fet chingScope), Platform::current()->cacheStorage(WebSecurityOrigin(context->securi tyOrigin()))); 55 m_caches = CacheStorage::create(GlobalFetch::ScopedFetcher::from(fet chingScope), Platform::current()->cacheStorage(WebSecurityOrigin(context->getSec urityOrigin())));
56 } 56 }
57 return m_caches; 57 return m_caches;
58 } 58 }
59 59
60 // Promptly dispose of associated CacheStorage. 60 // Promptly dispose of associated CacheStorage.
61 EAGERLY_FINALIZE(); 61 EAGERLY_FINALIZE();
62 DEFINE_INLINE_VIRTUAL_TRACE() 62 DEFINE_INLINE_VIRTUAL_TRACE()
63 { 63 {
64 visitor->trace(m_caches); 64 visitor->trace(m_caches);
65 WillBeHeapSupplement<T>::trace(visitor); 65 WillBeHeapSupplement<T>::trace(visitor);
66 } 66 }
67 67
68 private: 68 private:
69 GlobalCacheStorageImpl() 69 GlobalCacheStorageImpl()
70 { 70 {
71 } 71 }
72 72
73 static const char* name() { return "CacheStorage"; } 73 static const char* name() { return "CacheStorage"; }
74 74
75 PersistentWillBeMember<CacheStorage> m_caches; 75 PersistentWillBeMember<CacheStorage> m_caches;
76 }; 76 };
77 77
78 } // namespace 78 } // namespace
79 79
80 CacheStorage* GlobalCacheStorage::caches(DOMWindow& window, ExceptionState& exce ptionState) 80 CacheStorage* GlobalCacheStorage::caches(DOMWindow& window, ExceptionState& exce ptionState)
81 { 81 {
82 return GlobalCacheStorageImpl<LocalDOMWindow>::from(toLocalDOMWindow(window) , window.executionContext()).caches(toLocalDOMWindow(window), exceptionState); 82 return GlobalCacheStorageImpl<LocalDOMWindow>::from(toLocalDOMWindow(window) , window.getExecutionContext()).caches(toLocalDOMWindow(window), exceptionState) ;
83 } 83 }
84 84
85 CacheStorage* GlobalCacheStorage::caches(WorkerGlobalScope& worker, ExceptionSta te& exceptionState) 85 CacheStorage* GlobalCacheStorage::caches(WorkerGlobalScope& worker, ExceptionSta te& exceptionState)
86 { 86 {
87 return GlobalCacheStorageImpl<WorkerGlobalScope>::from(worker, worker.execut ionContext()).caches(worker, exceptionState); 87 return GlobalCacheStorageImpl<WorkerGlobalScope>::from(worker, worker.getExe cutionContext()).caches(worker, exceptionState);
88 } 88 }
89 89
90 } // namespace blink 90 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698