OLD | NEW |
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/indexeddb/IDBMetadata.h" | 5 #include "modules/indexeddb/IDBMetadata.h" |
6 | 6 |
7 #include "public/platform/modules/indexeddb/WebIDBMetadata.h" | |
8 | |
9 namespace blink { | 7 namespace blink { |
10 | 8 |
11 IDBDatabaseMetadata::IDBDatabaseMetadata(const WebIDBMetadata& webMetadata) | 9 IDBDatabaseMetadata::IDBDatabaseMetadata(indexed_db::mojom::blink::DatabaseMetad
ataPtr databaseMetadata) |
12 : name(webMetadata.name) | 10 : name(databaseMetadata->name) |
13 , id(webMetadata.id) | 11 , id(databaseMetadata->id) |
14 , version(webMetadata.version) | 12 , version(databaseMetadata->version) |
15 , maxObjectStoreId(webMetadata.maxObjectStoreId) | 13 , maxObjectStoreId(databaseMetadata->max_object_store_id) |
16 { | 14 { |
17 for (size_t i = 0; i < webMetadata.objectStores.size(); ++i) { | |
18 const WebIDBMetadata::ObjectStore webObjectStore = webMetadata.objectSto
res[i]; | |
19 IDBObjectStoreMetadata objectStore(webObjectStore.name, webObjectStore.i
d, IDBKeyPath(webObjectStore.keyPath), webObjectStore.autoIncrement, webObjectSt
ore.maxIndexId); | |
20 | 15 |
21 for (size_t j = 0; j < webObjectStore.indexes.size(); ++j) { | 16 for (size_t idxStore = 0; idxStore < databaseMetadata->object_stores.size();
idxStore++) { |
22 const WebIDBMetadata::Index webIndex = webObjectStore.indexes[j]; | 17 const auto& storeMetadata = databaseMetadata->object_stores[idxStore]; |
23 IDBIndexMetadata index(webIndex.name, webIndex.id, IDBKeyPath(webInd
ex.keyPath), webIndex.unique, webIndex.multiEntry); | 18 IDBObjectStoreMetadata objectStore(storeMetadata->name, storeMetadata->i
d, IDBKeyPath(storeMetadata->key_path), storeMetadata->auto_increment, storeMeta
data->max_index_id); |
| 19 |
| 20 for (size_t idxIndex = 0; idxIndex < storeMetadata->indexes.size(); idxI
ndex++) { |
| 21 const auto& indexMetadata = storeMetadata->indexes[idxIndex]; |
| 22 IDBIndexMetadata index(indexMetadata->name, indexMetadata->id, IDBKe
yPath(indexMetadata->key_path), indexMetadata->unique, indexMetadata->multi_entr
y); |
24 objectStore.indexes.set(index.id, index); | 23 objectStore.indexes.set(index.id, index); |
25 } | 24 } |
26 objectStores.set(objectStore.id, objectStore); | 25 objectStores.set(objectStore.id, objectStore); |
27 } | 26 } |
28 } | 27 } |
29 | 28 |
30 } // namespace blink | 29 } // namespace blink |
OLD | NEW |