OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 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 | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 13 matching lines...) Expand all Loading... |
24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 */ | 27 */ |
28 | 28 |
29 #ifndef IDBMetadata_h | 29 #ifndef IDBMetadata_h |
30 #define IDBMetadata_h | 30 #define IDBMetadata_h |
31 | 31 |
32 #include "modules/indexeddb/IDBKeyPath.h" | 32 #include "modules/indexeddb/IDBKeyPath.h" |
33 #include "public/platform/modules/indexeddb/WebIDBMetadata.h" | 33 #include "public/platform/modules/indexeddb/WebIDBMetadata.h" |
| 34 #include "wtf/Allocator.h" |
34 #include "wtf/HashMap.h" | 35 #include "wtf/HashMap.h" |
35 #include "wtf/text/StringHash.h" | 36 #include "wtf/text/StringHash.h" |
36 #include "wtf/text/WTFString.h" | 37 #include "wtf/text/WTFString.h" |
37 | 38 |
38 namespace blink { | 39 namespace blink { |
39 | 40 |
40 struct IDBIndexMetadata { | 41 struct IDBIndexMetadata { |
| 42 ALLOW_ONLY_INLINE_ALLOCATION(); |
41 IDBIndexMetadata() { } | 43 IDBIndexMetadata() { } |
42 IDBIndexMetadata(const String& name, int64_t id, const IDBKeyPath& keyPath,
bool unique, bool multiEntry) | 44 IDBIndexMetadata(const String& name, int64_t id, const IDBKeyPath& keyPath,
bool unique, bool multiEntry) |
43 : name(name) | 45 : name(name) |
44 , id(id) | 46 , id(id) |
45 , keyPath(keyPath) | 47 , keyPath(keyPath) |
46 , unique(unique) | 48 , unique(unique) |
47 , multiEntry(multiEntry) { } | 49 , multiEntry(multiEntry) { } |
48 String name; | 50 String name; |
49 int64_t id; | 51 int64_t id; |
50 IDBKeyPath keyPath; | 52 IDBKeyPath keyPath; |
51 bool unique; | 53 bool unique; |
52 bool multiEntry; | 54 bool multiEntry; |
53 | 55 |
54 static const int64_t InvalidId = -1; | 56 static const int64_t InvalidId = -1; |
55 }; | 57 }; |
56 | 58 |
57 struct IDBObjectStoreMetadata { | 59 struct IDBObjectStoreMetadata { |
| 60 ALLOW_ONLY_INLINE_ALLOCATION(); |
58 IDBObjectStoreMetadata() { } | 61 IDBObjectStoreMetadata() { } |
59 IDBObjectStoreMetadata(const String& name, int64_t id, const IDBKeyPath& key
Path, bool autoIncrement, int64_t maxIndexId) | 62 IDBObjectStoreMetadata(const String& name, int64_t id, const IDBKeyPath& key
Path, bool autoIncrement, int64_t maxIndexId) |
60 : name(name) | 63 : name(name) |
61 , id(id) | 64 , id(id) |
62 , keyPath(keyPath) | 65 , keyPath(keyPath) |
63 , autoIncrement(autoIncrement) | 66 , autoIncrement(autoIncrement) |
64 , maxIndexId(maxIndexId) | 67 , maxIndexId(maxIndexId) |
65 { | 68 { |
66 } | 69 } |
67 String name; | 70 String name; |
68 int64_t id; | 71 int64_t id; |
69 IDBKeyPath keyPath; | 72 IDBKeyPath keyPath; |
70 bool autoIncrement; | 73 bool autoIncrement; |
71 int64_t maxIndexId; | 74 int64_t maxIndexId; |
72 | 75 |
73 static const int64_t InvalidId = -1; | 76 static const int64_t InvalidId = -1; |
74 | 77 |
75 typedef HashMap<int64_t, IDBIndexMetadata> IndexMap; | 78 typedef HashMap<int64_t, IDBIndexMetadata> IndexMap; |
76 IndexMap indexes; | 79 IndexMap indexes; |
77 }; | 80 }; |
78 | 81 |
79 struct IDBDatabaseMetadata { | 82 struct IDBDatabaseMetadata { |
| 83 DISALLOW_ALLOCATION(); |
80 // FIXME: These can probably be collapsed into 0. | 84 // FIXME: These can probably be collapsed into 0. |
81 enum { | 85 enum { |
82 NoIntVersion = -1, | 86 NoIntVersion = -1, |
83 DefaultIntVersion = 0 | 87 DefaultIntVersion = 0 |
84 }; | 88 }; |
85 | 89 |
86 typedef HashMap<int64_t, IDBObjectStoreMetadata> ObjectStoreMap; | 90 typedef HashMap<int64_t, IDBObjectStoreMetadata> ObjectStoreMap; |
87 | 91 |
88 IDBDatabaseMetadata() | 92 IDBDatabaseMetadata() |
89 : intVersion(NoIntVersion) | 93 : intVersion(NoIntVersion) |
(...skipping 16 matching lines...) Expand all Loading... |
106 String version; | 110 String version; |
107 int64_t intVersion; | 111 int64_t intVersion; |
108 int64_t maxObjectStoreId; | 112 int64_t maxObjectStoreId; |
109 | 113 |
110 ObjectStoreMap objectStores; | 114 ObjectStoreMap objectStores; |
111 }; | 115 }; |
112 | 116 |
113 } | 117 } |
114 | 118 |
115 #endif // IDBMetadata_h | 119 #endif // IDBMetadata_h |
OLD | NEW |