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

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

Issue 2509913002: Implement StructTraits for remaining IndexedDB IPC types. (Closed)
Patch Set: Fix compile error on GCC. 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"
10 9
11 namespace mojo { 10 namespace mojo {
12 11
13 template <> 12 template <>
13 struct StructTraits<indexed_db::mojom::KeyDataView, content::IndexedDBKey> {
14 static indexed_db::mojom::KeyDataPtr data(const content::IndexedDBKey& key);
15 static bool Read(indexed_db::mojom::KeyDataView data,
16 content::IndexedDBKey* out);
17 };
18
19 template <>
20 struct StructTraits<indexed_db::mojom::KeyPathDataView,
21 content::IndexedDBKeyPath> {
22 static indexed_db::mojom::KeyPathDataPtr data(
23 const content::IndexedDBKeyPath& key_path);
24 static bool Read(indexed_db::mojom::KeyPathDataView data,
25 content::IndexedDBKeyPath* out);
26 };
27
28 template <>
29 struct StructTraits<indexed_db::mojom::KeyRangeDataView,
30 content::IndexedDBKeyRange> {
31 static const content::IndexedDBKey& lower(
32 const content::IndexedDBKeyRange& key_range) {
33 return key_range.lower();
34 }
35 static const content::IndexedDBKey& upper(
36 const content::IndexedDBKeyRange& key_range) {
37 return key_range.upper();
38 }
39 static bool lower_open(const content::IndexedDBKeyRange& key_range) {
40 return key_range.lower_open();
41 }
42 static bool upper_open(const content::IndexedDBKeyRange& key_range) {
43 return key_range.upper_open();
44 }
45 static bool Read(indexed_db::mojom::KeyRangeDataView data,
46 content::IndexedDBKeyRange* out);
47 };
48
49 template <>
14 struct StructTraits<indexed_db::mojom::IndexKeysDataView, 50 struct StructTraits<indexed_db::mojom::IndexKeysDataView,
15 content::IndexedDBIndexKeys> { 51 content::IndexedDBIndexKeys> {
16 static int64_t index_id(const content::IndexedDBIndexKeys& index_keys) { 52 static int64_t index_id(const content::IndexedDBIndexKeys& index_keys) {
17 return index_keys.first; 53 return index_keys.first;
18 } 54 }
19 static const std::vector<content::IndexedDBKey>& index_keys( 55 static const std::vector<content::IndexedDBKey>& index_keys(
20 const content::IndexedDBIndexKeys& index_keys) { 56 const content::IndexedDBIndexKeys& index_keys) {
21 return index_keys.second; 57 return index_keys.second;
22 } 58 }
23 static bool Read(indexed_db::mojom::IndexKeysDataView data, 59 static bool Read(indexed_db::mojom::IndexKeysDataView data,
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 object_stores(const content::IndexedDBDatabaseMetadata& metadata) { 134 object_stores(const content::IndexedDBDatabaseMetadata& metadata) {
99 return MapValuesToArray(metadata.object_stores); 135 return MapValuesToArray(metadata.object_stores);
100 } 136 }
101 static bool Read(indexed_db::mojom::DatabaseMetadataDataView data, 137 static bool Read(indexed_db::mojom::DatabaseMetadataDataView data,
102 content::IndexedDBDatabaseMetadata* out); 138 content::IndexedDBDatabaseMetadata* out);
103 }; 139 };
104 140
105 } // namespace mojo 141 } // namespace mojo
106 142
107 #endif // CONTENT_COMMON_INDEXED_DB_INDEXED_DB_STRUCT_TRAITS_H_ 143 #endif // CONTENT_COMMON_INDEXED_DB_INDEXED_DB_STRUCT_TRAITS_H_
OLDNEW
« no previous file with comments | « content/common/indexed_db/indexed_db_param_traits.cc ('k') | content/common/indexed_db/indexed_db_struct_traits.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698