OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 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 25 matching lines...) Expand all Loading... |
36 namespace WebKit { | 36 namespace WebKit { |
37 | 37 |
38 class WebStorageArea; | 38 class WebStorageArea; |
39 class WebString; | 39 class WebString; |
40 | 40 |
41 // WebStorageNamespace represents a collection of StorageAreas. Typically, you'l
l have | 41 // WebStorageNamespace represents a collection of StorageAreas. Typically, you'l
l have |
42 // multiple StorageNamespaces to represent the SessionStorage for each tab and a
single | 42 // multiple StorageNamespaces to represent the SessionStorage for each tab and a
single |
43 // StorageNamespace to represent LocalStorage for the entire browser. | 43 // StorageNamespace to represent LocalStorage for the entire browser. |
44 class WebStorageNamespace { | 44 class WebStorageNamespace { |
45 public: | 45 public: |
46 // Create a new WebStorageNamespace. LocalStorageNamespaces require a path t
o specify | |
47 // where the SQLite databases that make LocalStorage data persistent are loc
ated. | |
48 // If path is empty, data will not persist. You should call delete on the re
turned | |
49 // object when you're finished. | |
50 WEBKIT_EXPORT static WebStorageNamespace* createLocalStorageNamespace(const
WebString& backingDirectoryPath, unsigned quota); | |
51 WEBKIT_EXPORT static WebStorageNamespace* createSessionStorageNamespace(unsi
gned quota); | |
52 | |
53 // The quota for each storage area. Suggested by the spec. | |
54 static const unsigned m_localStorageQuota = 5 * 1024 * 1024; | |
55 | |
56 // Since SessionStorage memory is allocated in the browser process, we place
a | |
57 // per-origin quota on it. Like LocalStorage there are known attacks agains
t | |
58 // this, so it's more of a sanity check than a real security measure. | |
59 static const unsigned m_sessionStorageQuota = 5 * 1024 * 1024; | |
60 | |
61 static const unsigned noQuota = UINT_MAX; | |
62 | |
63 virtual ~WebStorageNamespace() { } | 46 virtual ~WebStorageNamespace() { } |
64 | 47 |
65 // Create a new WebStorageArea object. Two subsequent calls with the same or
igin | 48 // Create a new WebStorageArea object. Two subsequent calls with the same or
igin |
66 // will return two different WebStorageArea objects that share the same back
ing store. | 49 // will return two different WebStorageArea objects that share the same back
ing store. |
67 // You should call delete on the returned object when you're finished. | 50 // You should call delete on the returned object when you're finished. |
68 virtual WebStorageArea* createStorageArea(const WebString& origin) = 0; | 51 virtual WebStorageArea* createStorageArea(const WebString& origin) = 0; |
69 | 52 |
70 // Copy a StorageNamespace. This only makes sense in the case of SessionStor
age. | 53 // Copy a StorageNamespace. This only makes sense in the case of SessionStor
age. |
71 virtual WebStorageNamespace* copy() = 0; | 54 virtual WebStorageNamespace* copy() = 0; |
72 | 55 |
73 // Shutdown the StorageNamespace. Write all StorageArea's to disk and disall
ow new | 56 // DEPRECATED |
74 // write activity. | 57 virtual void close() { } |
75 virtual void close() = 0; | |
76 }; | 58 }; |
77 | 59 |
78 } // namespace WebKit | 60 } // namespace WebKit |
79 | 61 |
80 #endif // WebStorageNamespace_h | 62 #endif // WebStorageNamespace_h |
OLD | NEW |