Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(24)

Side by Side Diff: content/common/indexed_db/indexed_db_struct_traits.h

Issue 2449953008: Port messages sent by WebIDBDatabaseImpl to Mojo. (Closed)
Patch Set: Address dcheng@'s comments. Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 };
26
27 template <>
14 struct StructTraits<indexed_db::mojom::IndexMetadataDataView, 28 struct StructTraits<indexed_db::mojom::IndexMetadataDataView,
15 content::IndexedDBIndexMetadata> { 29 content::IndexedDBIndexMetadata> {
16 static int64_t id(const content::IndexedDBIndexMetadata& metadata) { 30 static int64_t id(const content::IndexedDBIndexMetadata& metadata) {
17 return metadata.id; 31 return metadata.id;
18 } 32 }
19 static base::string16 name(const content::IndexedDBIndexMetadata& metadata) { 33 static base::string16 name(const content::IndexedDBIndexMetadata& metadata) {
20 return metadata.name; 34 return metadata.name;
21 } 35 }
22 static const content::IndexedDBKeyPath& key_path( 36 static const content::IndexedDBKeyPath& key_path(
23 const content::IndexedDBIndexMetadata& metadata) { 37 const content::IndexedDBIndexMetadata& metadata) {
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 object_stores(const content::IndexedDBDatabaseMetadata& metadata) { 98 object_stores(const content::IndexedDBDatabaseMetadata& metadata) {
85 return MapValuesToArray(metadata.object_stores); 99 return MapValuesToArray(metadata.object_stores);
86 } 100 }
87 static bool Read(indexed_db::mojom::DatabaseMetadataDataView data, 101 static bool Read(indexed_db::mojom::DatabaseMetadataDataView data,
88 content::IndexedDBDatabaseMetadata* out); 102 content::IndexedDBDatabaseMetadata* out);
89 }; 103 };
90 104
91 } // namespace mojo 105 } // namespace mojo
92 106
93 #endif // CONTENT_COMMON_INDEXED_DB_INDEXED_DB_STRUCT_TRAITS_H_ 107 #endif // CONTENT_COMMON_INDEXED_DB_INDEXED_DB_STRUCT_TRAITS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698