| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 #ifndef CONTENT_COMMON_INDEXED_DB_INDEXED_DB_STRUCT_TRAITS_H_ | 5 #ifndef CONTENT_COMMON_INDEXED_DB_INDEXED_DB_STRUCT_TRAITS_H_ |
| 6 #define CONTENT_COMMON_INDEXED_DB_INDEXED_DB_STRUCT_TRAITS_H_ | 6 #define CONTENT_COMMON_INDEXED_DB_INDEXED_DB_STRUCT_TRAITS_H_ |
| 7 | 7 |
| 8 #include "content/common/indexed_db/indexed_db.mojom.h" | 8 #include "content/common/indexed_db/indexed_db.mojom.h" |
| 9 #include "content/common/indexed_db/indexed_db_metadata.h" | 9 #include "content/common/indexed_db/indexed_db_metadata.h" |
| 10 | 10 |
| 11 namespace mojo { | 11 namespace mojo { |
| 12 | 12 |
| 13 template <> | 13 template <> |
| 14 struct StructTraits<indexed_db::mojom::IndexKeysDataView, |
| 15 content::IndexedDBIndexKeys> { |
| 16 static int64_t index_id(const content::IndexedDBIndexKeys& index_keys) { |
| 17 return index_keys.first; |
| 18 } |
| 19 static const std::vector<content::IndexedDBKey>& index_keys( |
| 20 const content::IndexedDBIndexKeys& index_keys) { |
| 21 return index_keys.second; |
| 22 } |
| 23 static bool Read(indexed_db::mojom::IndexKeysDataView data, |
| 24 content::IndexedDBIndexKeys* out) { |
| 25 out->first = data.index_id(); |
| 26 return data.ReadIndexKeys(&out->second); |
| 27 } |
| 28 }; |
| 29 |
| 30 template <> |
| 14 struct StructTraits<indexed_db::mojom::IndexMetadataDataView, | 31 struct StructTraits<indexed_db::mojom::IndexMetadataDataView, |
| 15 content::IndexedDBIndexMetadata> { | 32 content::IndexedDBIndexMetadata> { |
| 16 static int64_t id(const content::IndexedDBIndexMetadata& metadata) { | 33 static int64_t id(const content::IndexedDBIndexMetadata& metadata) { |
| 17 return metadata.id; | 34 return metadata.id; |
| 18 } | 35 } |
| 19 static base::string16 name(const content::IndexedDBIndexMetadata& metadata) { | 36 static base::string16 name(const content::IndexedDBIndexMetadata& metadata) { |
| 20 return metadata.name; | 37 return metadata.name; |
| 21 } | 38 } |
| 22 static const content::IndexedDBKeyPath& key_path( | 39 static const content::IndexedDBKeyPath& key_path( |
| 23 const content::IndexedDBIndexMetadata& metadata) { | 40 const content::IndexedDBIndexMetadata& metadata) { |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 object_stores(const content::IndexedDBDatabaseMetadata& metadata) { | 101 object_stores(const content::IndexedDBDatabaseMetadata& metadata) { |
| 85 return MapValuesToArray(metadata.object_stores); | 102 return MapValuesToArray(metadata.object_stores); |
| 86 } | 103 } |
| 87 static bool Read(indexed_db::mojom::DatabaseMetadataDataView data, | 104 static bool Read(indexed_db::mojom::DatabaseMetadataDataView data, |
| 88 content::IndexedDBDatabaseMetadata* out); | 105 content::IndexedDBDatabaseMetadata* out); |
| 89 }; | 106 }; |
| 90 | 107 |
| 91 } // namespace mojo | 108 } // namespace mojo |
| 92 | 109 |
| 93 #endif // CONTENT_COMMON_INDEXED_DB_INDEXED_DB_STRUCT_TRAITS_H_ | 110 #endif // CONTENT_COMMON_INDEXED_DB_INDEXED_DB_STRUCT_TRAITS_H_ |
| OLD | NEW |