| 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 11 matching lines...) Expand all Loading... |
| 22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
| 23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | 23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
| 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 "Source/modules/indexeddb/indexed_db.mojom-blink.h" |
| 32 #include "modules/indexeddb/IDBKeyPath.h" | 33 #include "modules/indexeddb/IDBKeyPath.h" |
| 33 #include "public/platform/modules/indexeddb/WebIDBMetadata.h" | |
| 34 #include "wtf/Allocator.h" | 34 #include "wtf/Allocator.h" |
| 35 #include "wtf/HashMap.h" | 35 #include "wtf/HashMap.h" |
| 36 #include "wtf/text/StringHash.h" | 36 #include "wtf/text/StringHash.h" |
| 37 #include "wtf/text/WTFString.h" | 37 #include "wtf/text/WTFString.h" |
| 38 | 38 |
| 39 namespace blink { | 39 namespace blink { |
| 40 | 40 |
| 41 struct IDBIndexMetadata { | 41 struct IDBIndexMetadata { |
| 42 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); | 42 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); |
| 43 IDBIndexMetadata() { } | 43 IDBIndexMetadata() { } |
| (...skipping 24 matching lines...) Expand all Loading... |
| 68 { | 68 { |
| 69 } | 69 } |
| 70 String name; | 70 String name; |
| 71 int64_t id; | 71 int64_t id; |
| 72 IDBKeyPath keyPath; | 72 IDBKeyPath keyPath; |
| 73 bool autoIncrement; | 73 bool autoIncrement; |
| 74 int64_t maxIndexId; | 74 int64_t maxIndexId; |
| 75 | 75 |
| 76 static const int64_t InvalidId = -1; | 76 static const int64_t InvalidId = -1; |
| 77 | 77 |
| 78 typedef HashMap<int64_t, IDBIndexMetadata> IndexMap; | 78 HashMap<int64_t, IDBIndexMetadata> indexes; |
| 79 IndexMap indexes; | |
| 80 }; | 79 }; |
| 81 | 80 |
| 82 struct IDBDatabaseMetadata { | 81 struct IDBDatabaseMetadata { |
| 83 DISALLOW_NEW(); | 82 DISALLOW_NEW(); |
| 84 // FIXME: These can probably be collapsed into 0. | 83 // FIXME: These can probably be collapsed into 0. |
| 85 enum { | 84 enum { |
| 86 NoVersion = -1, | 85 NoVersion = -1, |
| 87 DefaultVersion = 0 | 86 DefaultVersion = 0 |
| 88 }; | 87 }; |
| 89 | 88 |
| 90 typedef HashMap<int64_t, IDBObjectStoreMetadata> ObjectStoreMap; | |
| 91 | |
| 92 IDBDatabaseMetadata() | 89 IDBDatabaseMetadata() |
| 93 : version(NoVersion) | 90 : version(NoVersion) |
| 94 { | 91 { |
| 95 } | 92 } |
| 96 | 93 |
| 97 IDBDatabaseMetadata(const String& name, int64_t id, int64_t version, int64_t
maxObjectStoreId) | 94 IDBDatabaseMetadata(const String& name, int64_t id, int64_t version, int64_t
maxObjectStoreId) |
| 98 : name(name) | 95 : name(name) |
| 99 , id(id) | 96 , id(id) |
| 100 , version(version) | 97 , version(version) |
| 101 , maxObjectStoreId(maxObjectStoreId) | 98 , maxObjectStoreId(maxObjectStoreId) |
| 102 { | 99 { |
| 103 } | 100 } |
| 104 | 101 |
| 105 explicit IDBDatabaseMetadata(const WebIDBMetadata&); | 102 explicit IDBDatabaseMetadata(indexed_db::mojom::blink::DatabaseMetadataPtr); |
| 106 | 103 |
| 107 String name; | 104 String name; |
| 108 int64_t id; | 105 int64_t id; |
| 109 int64_t version; | 106 int64_t version; |
| 110 int64_t maxObjectStoreId; | 107 int64_t maxObjectStoreId; |
| 111 | 108 |
| 112 ObjectStoreMap objectStores; | 109 HashMap<int64_t, IDBObjectStoreMetadata> objectStores; |
| 113 }; | 110 }; |
| 114 | 111 |
| 115 } // namespace blink | 112 } // namespace blink |
| 116 | 113 |
| 117 #endif // IDBMetadata_h | 114 #endif // IDBMetadata_h |
| OLD | NEW |