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

Side by Side Diff: content/common/indexed_db/indexed_db_param_traits.cc

Issue 1966983003: Generate param traits size methods for IPC files in content/ (and traits it depends on). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix owners Created 4 years, 7 months 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "content/common/indexed_db/indexed_db_param_traits.h" 5 #include "content/common/indexed_db/indexed_db_param_traits.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 #include "content/common/indexed_db/indexed_db_key.h" 9 #include "content/common/indexed_db/indexed_db_key.h"
10 #include "content/common/indexed_db/indexed_db_key_path.h" 10 #include "content/common/indexed_db/indexed_db_key_path.h"
(...skipping 12 matching lines...) Expand all
23 using blink::WebIDBKeyTypeBinary; 23 using blink::WebIDBKeyTypeBinary;
24 using blink::WebIDBKeyTypeDate; 24 using blink::WebIDBKeyTypeDate;
25 using blink::WebIDBKeyTypeInvalid; 25 using blink::WebIDBKeyTypeInvalid;
26 using blink::WebIDBKeyTypeMin; 26 using blink::WebIDBKeyTypeMin;
27 using blink::WebIDBKeyTypeNull; 27 using blink::WebIDBKeyTypeNull;
28 using blink::WebIDBKeyTypeNumber; 28 using blink::WebIDBKeyTypeNumber;
29 using blink::WebIDBKeyTypeString; 29 using blink::WebIDBKeyTypeString;
30 30
31 namespace IPC { 31 namespace IPC {
32 32
33 void ParamTraits<IndexedDBKey>::GetSize(base::PickleSizer* s,
34 const param_type& p) {
35 GetParamSize(s, static_cast<int>(p.type()));
36 switch (p.type()) {
37 case WebIDBKeyTypeArray:
38 GetParamSize(s, p.array());
39 return;
40 case WebIDBKeyTypeBinary:
41 GetParamSize(s, p.binary());
42 return;
43 case WebIDBKeyTypeString:
44 GetParamSize(s, p.string());
45 return;
46 case WebIDBKeyTypeDate:
47 GetParamSize(s, p.date());
48 return;
49 case WebIDBKeyTypeNumber:
50 GetParamSize(s, p.number());
51 return;
52 case WebIDBKeyTypeInvalid:
53 case WebIDBKeyTypeNull:
54 return;
55 case WebIDBKeyTypeMin:
56 default:
57 NOTREACHED();
58 return;
59 }
60 }
61
33 void ParamTraits<IndexedDBKey>::Write(base::Pickle* m, const param_type& p) { 62 void ParamTraits<IndexedDBKey>::Write(base::Pickle* m, const param_type& p) {
34 WriteParam(m, static_cast<int>(p.type())); 63 WriteParam(m, static_cast<int>(p.type()));
35 switch (p.type()) { 64 switch (p.type()) {
36 case WebIDBKeyTypeArray: 65 case WebIDBKeyTypeArray:
37 WriteParam(m, p.array()); 66 WriteParam(m, p.array());
38 return; 67 return;
39 case WebIDBKeyTypeBinary: 68 case WebIDBKeyTypeBinary:
40 WriteParam(m, p.binary()); 69 WriteParam(m, p.binary());
41 return; 70 return;
42 case WebIDBKeyTypeString: 71 case WebIDBKeyTypeString:
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 l->append("null"); 175 l->append("null");
147 break; 176 break;
148 case WebIDBKeyTypeMin: 177 case WebIDBKeyTypeMin:
149 default: 178 default:
150 NOTREACHED(); 179 NOTREACHED();
151 break; 180 break;
152 } 181 }
153 l->append(")"); 182 l->append(")");
154 } 183 }
155 184
185 void ParamTraits<IndexedDBKeyPath>::GetSize(base::PickleSizer* s,
186 const param_type& p) {
187 GetParamSize(s, static_cast<int>(p.type()));
188 switch (p.type()) {
189 case WebIDBKeyPathTypeArray:
190 GetParamSize(s, p.array());
191 return;
192 case WebIDBKeyPathTypeString:
193 GetParamSize(s, p.string());
194 return;
195 case WebIDBKeyPathTypeNull:
196 return;
197 default:
198 NOTREACHED();
199 return;
200 }
201 }
202
156 void ParamTraits<IndexedDBKeyPath>::Write(base::Pickle* m, 203 void ParamTraits<IndexedDBKeyPath>::Write(base::Pickle* m,
157 const param_type& p) { 204 const param_type& p) {
158 WriteParam(m, static_cast<int>(p.type())); 205 WriteParam(m, static_cast<int>(p.type()));
159 switch (p.type()) { 206 switch (p.type()) {
160 case WebIDBKeyPathTypeArray: 207 case WebIDBKeyPathTypeArray:
161 WriteParam(m, p.array()); 208 WriteParam(m, p.array());
162 return; 209 return;
163 case WebIDBKeyPathTypeString: 210 case WebIDBKeyPathTypeString:
164 WriteParam(m, p.string()); 211 WriteParam(m, p.string());
165 return; 212 return;
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 case WebIDBKeyPathTypeNull: 271 case WebIDBKeyPathTypeNull:
225 l->append("null"); 272 l->append("null");
226 break; 273 break;
227 default: 274 default:
228 NOTREACHED(); 275 NOTREACHED();
229 break; 276 break;
230 } 277 }
231 l->append(")"); 278 l->append(")");
232 } 279 }
233 280
281 void ParamTraits<IndexedDBKeyRange>::GetSize(base::PickleSizer* s,
282 const param_type& p) {
283 GetParamSize(s, p.lower());
284 GetParamSize(s, p.upper());
285 GetParamSize(s, p.lower_open());
286 GetParamSize(s, p.upper_open());
287 }
288
234 void ParamTraits<IndexedDBKeyRange>::Write(base::Pickle* m, 289 void ParamTraits<IndexedDBKeyRange>::Write(base::Pickle* m,
235 const param_type& p) { 290 const param_type& p) {
236 WriteParam(m, p.lower()); 291 WriteParam(m, p.lower());
237 WriteParam(m, p.upper()); 292 WriteParam(m, p.upper());
238 WriteParam(m, p.lower_open()); 293 WriteParam(m, p.lower_open());
239 WriteParam(m, p.upper_open()); 294 WriteParam(m, p.upper_open());
240 } 295 }
241 296
242 bool ParamTraits<IndexedDBKeyRange>::Read(const base::Pickle* m, 297 bool ParamTraits<IndexedDBKeyRange>::Read(const base::Pickle* m,
243 base::PickleIterator* iter, 298 base::PickleIterator* iter,
(...skipping 24 matching lines...) Expand all
268 l->append(", upper="); 323 l->append(", upper=");
269 LogParam(p.upper(), l); 324 LogParam(p.upper(), l);
270 l->append(", lower_open="); 325 l->append(", lower_open=");
271 LogParam(p.lower_open(), l); 326 LogParam(p.lower_open(), l);
272 l->append(", upper_open="); 327 l->append(", upper_open=");
273 LogParam(p.upper_open(), l); 328 LogParam(p.upper_open(), l);
274 l->append(")"); 329 l->append(")");
275 } 330 }
276 331
277 } // namespace IPC 332 } // namespace IPC
OLDNEW
« no previous file with comments | « content/common/indexed_db/indexed_db_param_traits.h ('k') | content/common/input/input_param_traits.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698