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

Side by Side Diff: Source/modules/quota/NavigatorStorageQuota.cpp

Issue 1154573005: Expose Durable Storage API to script (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rename WebSomeCallbacks and SomeCallbacks Created 5 years, 5 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 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 15 matching lines...) Expand all
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 #include "config.h" 31 #include "config.h"
32 #include "modules/quota/NavigatorStorageQuota.h" 32 #include "modules/quota/NavigatorStorageQuota.h"
33 33
34 #include "core/frame/Navigator.h" 34 #include "core/frame/Navigator.h"
35 #include "modules/quota/DeprecatedStorageQuota.h" 35 #include "modules/quota/DeprecatedStorageQuota.h"
36 #include "modules/quota/StorageManager.h"
36 #include "modules/quota/StorageQuota.h" 37 #include "modules/quota/StorageQuota.h"
37 38
38 namespace blink { 39 namespace blink {
39 40
40 NavigatorStorageQuota::NavigatorStorageQuota(LocalFrame* frame) 41 NavigatorStorageQuota::NavigatorStorageQuota(LocalFrame* frame)
41 : DOMWindowProperty(frame) 42 : DOMWindowProperty(frame)
42 { 43 {
43 } 44 }
44 45
45 NavigatorStorageQuota::~NavigatorStorageQuota() 46 NavigatorStorageQuota::~NavigatorStorageQuota()
(...skipping 23 matching lines...) Expand all
69 DeprecatedStorageQuota* NavigatorStorageQuota::webkitTemporaryStorage(Navigator& navigator) 70 DeprecatedStorageQuota* NavigatorStorageQuota::webkitTemporaryStorage(Navigator& navigator)
70 { 71 {
71 return NavigatorStorageQuota::from(navigator).webkitTemporaryStorage(); 72 return NavigatorStorageQuota::from(navigator).webkitTemporaryStorage();
72 } 73 }
73 74
74 DeprecatedStorageQuota* NavigatorStorageQuota::webkitPersistentStorage(Navigator & navigator) 75 DeprecatedStorageQuota* NavigatorStorageQuota::webkitPersistentStorage(Navigator & navigator)
75 { 76 {
76 return NavigatorStorageQuota::from(navigator).webkitPersistentStorage(); 77 return NavigatorStorageQuota::from(navigator).webkitPersistentStorage();
77 } 78 }
78 79
80 StorageManager* NavigatorStorageQuota::storage(Navigator& navigator)
81 {
82 return NavigatorStorageQuota::from(navigator).storage();
83 }
84
79 StorageQuota* NavigatorStorageQuota::storageQuota() const 85 StorageQuota* NavigatorStorageQuota::storageQuota() const
80 { 86 {
81 if (!m_storageQuota && frame()) 87 if (!m_storageQuota && frame())
82 m_storageQuota = StorageQuota::create(); 88 m_storageQuota = StorageQuota::create();
83 return m_storageQuota.get(); 89 return m_storageQuota.get();
84 } 90 }
85 91
86 DeprecatedStorageQuota* NavigatorStorageQuota::webkitTemporaryStorage() const 92 DeprecatedStorageQuota* NavigatorStorageQuota::webkitTemporaryStorage() const
87 { 93 {
88 if (!m_temporaryStorage && frame()) 94 if (!m_temporaryStorage && frame())
89 m_temporaryStorage = DeprecatedStorageQuota::create(DeprecatedStorageQuo ta::Temporary); 95 m_temporaryStorage = DeprecatedStorageQuota::create(DeprecatedStorageQuo ta::Temporary);
90 return m_temporaryStorage.get(); 96 return m_temporaryStorage.get();
91 } 97 }
92 98
93 DeprecatedStorageQuota* NavigatorStorageQuota::webkitPersistentStorage() const 99 DeprecatedStorageQuota* NavigatorStorageQuota::webkitPersistentStorage() const
94 { 100 {
95 if (!m_persistentStorage && frame()) 101 if (!m_persistentStorage && frame())
96 m_persistentStorage = DeprecatedStorageQuota::create(DeprecatedStorageQu ota::Persistent); 102 m_persistentStorage = DeprecatedStorageQuota::create(DeprecatedStorageQu ota::Persistent);
97 return m_persistentStorage.get(); 103 return m_persistentStorage.get();
98 } 104 }
99 105
106 StorageManager* NavigatorStorageQuota::storage() const
107 {
108 if (!m_storageManager && frame())
109 m_storageManager = new StorageManager();
110 return m_storageManager.get();
111 }
112
100 DEFINE_TRACE(NavigatorStorageQuota) 113 DEFINE_TRACE(NavigatorStorageQuota)
101 { 114 {
102 visitor->trace(m_storageQuota); 115 visitor->trace(m_storageQuota);
103 visitor->trace(m_temporaryStorage); 116 visitor->trace(m_temporaryStorage);
104 visitor->trace(m_persistentStorage); 117 visitor->trace(m_persistentStorage);
118 visitor->trace(m_storageManager);
105 HeapSupplement<Navigator>::trace(visitor); 119 HeapSupplement<Navigator>::trace(visitor);
106 DOMWindowProperty::trace(visitor); 120 DOMWindowProperty::trace(visitor);
107 } 121 }
108 122
109 } // namespace blink 123 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698