| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "chrome/common/common_param_traits.h" | |
| 6 | |
| 7 #define IPC_MESSAGE_IMPL | |
| 8 #include "chrome/common/indexed_db_messages.h" | |
| 9 | |
| 10 IndexedDBHostMsg_FactoryOpen_Params::IndexedDBHostMsg_FactoryOpen_Params() | |
| 11 : routing_id(0), | |
| 12 response_id(0), | |
| 13 maximum_size(0) { | |
| 14 } | |
| 15 | |
| 16 IndexedDBHostMsg_FactoryOpen_Params::~IndexedDBHostMsg_FactoryOpen_Params() { | |
| 17 } | |
| 18 | |
| 19 IndexedDBHostMsg_DatabaseCreateObjectStore_Params:: | |
| 20 IndexedDBHostMsg_DatabaseCreateObjectStore_Params() | |
| 21 : auto_increment(false), | |
| 22 transaction_id(0), | |
| 23 idb_database_id(0) { | |
| 24 } | |
| 25 | |
| 26 IndexedDBHostMsg_DatabaseCreateObjectStore_Params:: | |
| 27 ~IndexedDBHostMsg_DatabaseCreateObjectStore_Params() { | |
| 28 } | |
| 29 | |
| 30 IndexedDBHostMsg_IndexOpenCursor_Params:: | |
| 31 IndexedDBHostMsg_IndexOpenCursor_Params() | |
| 32 : response_id(0), | |
| 33 lower_open(false), | |
| 34 upper_open(false), | |
| 35 direction(0), | |
| 36 idb_index_id(0), | |
| 37 transaction_id(0) { | |
| 38 } | |
| 39 | |
| 40 IndexedDBHostMsg_IndexOpenCursor_Params:: | |
| 41 ~IndexedDBHostMsg_IndexOpenCursor_Params() { | |
| 42 } | |
| 43 | |
| 44 | |
| 45 IndexedDBHostMsg_ObjectStorePut_Params:: | |
| 46 IndexedDBHostMsg_ObjectStorePut_Params() | |
| 47 : idb_object_store_id(0), | |
| 48 response_id(0), | |
| 49 put_mode(), | |
| 50 transaction_id(0) { | |
| 51 } | |
| 52 | |
| 53 IndexedDBHostMsg_ObjectStorePut_Params:: | |
| 54 ~IndexedDBHostMsg_ObjectStorePut_Params() { | |
| 55 } | |
| 56 | |
| 57 IndexedDBHostMsg_ObjectStoreCreateIndex_Params:: | |
| 58 IndexedDBHostMsg_ObjectStoreCreateIndex_Params() | |
| 59 : unique(false), | |
| 60 transaction_id(0), | |
| 61 idb_object_store_id(0) { | |
| 62 } | |
| 63 | |
| 64 IndexedDBHostMsg_ObjectStoreCreateIndex_Params:: | |
| 65 ~IndexedDBHostMsg_ObjectStoreCreateIndex_Params() { | |
| 66 } | |
| 67 | |
| 68 | |
| 69 IndexedDBHostMsg_ObjectStoreOpenCursor_Params:: | |
| 70 IndexedDBHostMsg_ObjectStoreOpenCursor_Params() | |
| 71 : response_id(0), | |
| 72 lower_open(false), | |
| 73 upper_open(false), | |
| 74 direction(0), | |
| 75 idb_object_store_id(0), | |
| 76 transaction_id(0) { | |
| 77 } | |
| 78 | |
| 79 IndexedDBHostMsg_ObjectStoreOpenCursor_Params:: | |
| 80 ~IndexedDBHostMsg_ObjectStoreOpenCursor_Params() { | |
| 81 } | |
| 82 | |
| 83 namespace IPC { | |
| 84 | |
| 85 void ParamTraits<IndexedDBHostMsg_FactoryOpen_Params>::Write( | |
| 86 Message* m, | |
| 87 const param_type& p) { | |
| 88 WriteParam(m, p.routing_id); | |
| 89 WriteParam(m, p.response_id); | |
| 90 WriteParam(m, p.origin); | |
| 91 WriteParam(m, p.name); | |
| 92 WriteParam(m, p.maximum_size); | |
| 93 } | |
| 94 | |
| 95 bool ParamTraits<IndexedDBHostMsg_FactoryOpen_Params>::Read(const Message* m, | |
| 96 void** iter, | |
| 97 param_type* p) { | |
| 98 return | |
| 99 ReadParam(m, iter, &p->routing_id) && | |
| 100 ReadParam(m, iter, &p->response_id) && | |
| 101 ReadParam(m, iter, &p->origin) && | |
| 102 ReadParam(m, iter, &p->name) && | |
| 103 ReadParam(m, iter, &p->maximum_size); | |
| 104 } | |
| 105 | |
| 106 void ParamTraits<IndexedDBHostMsg_FactoryOpen_Params>::Log(const param_type& p, | |
| 107 std::string* l) { | |
| 108 l->append("("); | |
| 109 LogParam(p.routing_id, l); | |
| 110 l->append(", "); | |
| 111 LogParam(p.response_id, l); | |
| 112 l->append(", "); | |
| 113 LogParam(p.origin, l); | |
| 114 l->append(", "); | |
| 115 LogParam(p.name, l); | |
| 116 l->append(", "); | |
| 117 LogParam(p.maximum_size, l); | |
| 118 l->append(")"); | |
| 119 } | |
| 120 | |
| 121 void ParamTraits<IndexedDBHostMsg_DatabaseCreateObjectStore_Params>::Write( | |
| 122 Message* m, | |
| 123 const param_type& p) { | |
| 124 WriteParam(m, p.name); | |
| 125 WriteParam(m, p.key_path); | |
| 126 WriteParam(m, p.auto_increment); | |
| 127 WriteParam(m, p.transaction_id); | |
| 128 WriteParam(m, p.idb_database_id); | |
| 129 } | |
| 130 | |
| 131 bool ParamTraits<IndexedDBHostMsg_DatabaseCreateObjectStore_Params>::Read( | |
| 132 const Message* m, | |
| 133 void** iter, | |
| 134 param_type* p) { | |
| 135 return | |
| 136 ReadParam(m, iter, &p->name) && | |
| 137 ReadParam(m, iter, &p->key_path) && | |
| 138 ReadParam(m, iter, &p->auto_increment) && | |
| 139 ReadParam(m, iter, &p->transaction_id) && | |
| 140 ReadParam(m, iter, &p->idb_database_id); | |
| 141 } | |
| 142 | |
| 143 void ParamTraits<IndexedDBHostMsg_DatabaseCreateObjectStore_Params>::Log( | |
| 144 const param_type& p, | |
| 145 std::string* l) { | |
| 146 l->append("("); | |
| 147 LogParam(p.name, l); | |
| 148 l->append(", "); | |
| 149 LogParam(p.key_path, l); | |
| 150 l->append(", "); | |
| 151 LogParam(p.auto_increment, l); | |
| 152 l->append(", "); | |
| 153 LogParam(p.transaction_id, l); | |
| 154 l->append(", "); | |
| 155 LogParam(p.idb_database_id, l); | |
| 156 l->append(")"); | |
| 157 } | |
| 158 | |
| 159 void ParamTraits<IndexedDBHostMsg_IndexOpenCursor_Params>::Write( | |
| 160 Message* m, | |
| 161 const param_type& p) { | |
| 162 WriteParam(m, p.response_id); | |
| 163 WriteParam(m, p.lower_key); | |
| 164 WriteParam(m, p.upper_key); | |
| 165 WriteParam(m, p.lower_open); | |
| 166 WriteParam(m, p.upper_open); | |
| 167 WriteParam(m, p.direction); | |
| 168 WriteParam(m, p.idb_index_id); | |
| 169 WriteParam(m, p.transaction_id); | |
| 170 } | |
| 171 | |
| 172 bool ParamTraits<IndexedDBHostMsg_IndexOpenCursor_Params>::Read( | |
| 173 const Message* m, | |
| 174 void** iter, | |
| 175 param_type* p) { | |
| 176 return | |
| 177 ReadParam(m, iter, &p->response_id) && | |
| 178 ReadParam(m, iter, &p->lower_key) && | |
| 179 ReadParam(m, iter, &p->upper_key) && | |
| 180 ReadParam(m, iter, &p->lower_open) && | |
| 181 ReadParam(m, iter, &p->upper_open) && | |
| 182 ReadParam(m, iter, &p->direction) && | |
| 183 ReadParam(m, iter, &p->idb_index_id) && | |
| 184 ReadParam(m, iter, &p->transaction_id); | |
| 185 } | |
| 186 | |
| 187 void ParamTraits<IndexedDBHostMsg_IndexOpenCursor_Params>::Log( | |
| 188 const param_type& p, | |
| 189 std::string* l) { | |
| 190 l->append("("); | |
| 191 LogParam(p.response_id, l); | |
| 192 l->append(", "); | |
| 193 LogParam(p.lower_key, l); | |
| 194 l->append(", "); | |
| 195 LogParam(p.upper_key, l); | |
| 196 l->append(", "); | |
| 197 LogParam(p.lower_open, l); | |
| 198 l->append(", "); | |
| 199 LogParam(p.upper_open, l); | |
| 200 l->append(", "); | |
| 201 LogParam(p.direction, l); | |
| 202 l->append(", "); | |
| 203 LogParam(p.idb_index_id, l); | |
| 204 l->append(","); | |
| 205 LogParam(p.transaction_id, l); | |
| 206 l->append(")"); | |
| 207 } | |
| 208 | |
| 209 void ParamTraits<IndexedDBHostMsg_ObjectStorePut_Params>::Write( | |
| 210 Message* m, | |
| 211 const param_type& p) { | |
| 212 WriteParam(m, p.idb_object_store_id); | |
| 213 WriteParam(m, p.response_id); | |
| 214 WriteParam(m, p.serialized_value); | |
| 215 WriteParam(m, p.key); | |
| 216 WriteParam(m, p.put_mode); | |
| 217 WriteParam(m, p.transaction_id); | |
| 218 } | |
| 219 | |
| 220 bool ParamTraits<IndexedDBHostMsg_ObjectStorePut_Params>::Read( | |
| 221 const Message* m, | |
| 222 void** iter, | |
| 223 param_type* p) { | |
| 224 return | |
| 225 ReadParam(m, iter, &p->idb_object_store_id) && | |
| 226 ReadParam(m, iter, &p->response_id) && | |
| 227 ReadParam(m, iter, &p->serialized_value) && | |
| 228 ReadParam(m, iter, &p->key) && | |
| 229 ReadParam(m, iter, &p->put_mode) && | |
| 230 ReadParam(m, iter, &p->transaction_id); | |
| 231 } | |
| 232 | |
| 233 void ParamTraits<IndexedDBHostMsg_ObjectStorePut_Params>::Log( | |
| 234 const param_type& p, | |
| 235 std::string* l) { | |
| 236 l->append("("); | |
| 237 LogParam(p.idb_object_store_id, l); | |
| 238 l->append(", "); | |
| 239 LogParam(p.response_id, l); | |
| 240 l->append(", "); | |
| 241 LogParam(p.serialized_value, l); | |
| 242 l->append(", "); | |
| 243 LogParam(p.key, l); | |
| 244 l->append(", "); | |
| 245 LogParam(p.put_mode, l); | |
| 246 l->append(", "); | |
| 247 LogParam(p.transaction_id, l); | |
| 248 l->append(")"); | |
| 249 } | |
| 250 | |
| 251 void ParamTraits<IndexedDBHostMsg_ObjectStoreCreateIndex_Params>::Write( | |
| 252 Message* m, | |
| 253 const param_type& p) { | |
| 254 WriteParam(m, p.name); | |
| 255 WriteParam(m, p.key_path); | |
| 256 WriteParam(m, p.unique); | |
| 257 WriteParam(m, p.transaction_id); | |
| 258 WriteParam(m, p.idb_object_store_id); | |
| 259 } | |
| 260 | |
| 261 bool ParamTraits<IndexedDBHostMsg_ObjectStoreCreateIndex_Params>::Read( | |
| 262 const Message* m, | |
| 263 void** iter, | |
| 264 param_type* p) { | |
| 265 return | |
| 266 ReadParam(m, iter, &p->name) && | |
| 267 ReadParam(m, iter, &p->key_path) && | |
| 268 ReadParam(m, iter, &p->unique) && | |
| 269 ReadParam(m, iter, &p->transaction_id) && | |
| 270 ReadParam(m, iter, &p->idb_object_store_id); | |
| 271 } | |
| 272 | |
| 273 void ParamTraits<IndexedDBHostMsg_ObjectStoreCreateIndex_Params>::Log( | |
| 274 const param_type& p, | |
| 275 std::string* l) { | |
| 276 l->append("("); | |
| 277 LogParam(p.name, l); | |
| 278 l->append(", "); | |
| 279 LogParam(p.key_path, l); | |
| 280 l->append(", "); | |
| 281 LogParam(p.unique, l); | |
| 282 l->append(", "); | |
| 283 LogParam(p.transaction_id, l); | |
| 284 l->append(", "); | |
| 285 LogParam(p.idb_object_store_id, l); | |
| 286 l->append(")"); | |
| 287 } | |
| 288 | |
| 289 void ParamTraits<IndexedDBHostMsg_ObjectStoreOpenCursor_Params>::Write( | |
| 290 Message* m, | |
| 291 const param_type& p) { | |
| 292 WriteParam(m, p.response_id); | |
| 293 WriteParam(m, p.lower_key); | |
| 294 WriteParam(m, p.upper_key); | |
| 295 WriteParam(m, p.lower_open); | |
| 296 WriteParam(m, p.upper_open); | |
| 297 WriteParam(m, p.direction); | |
| 298 WriteParam(m, p.idb_object_store_id); | |
| 299 WriteParam(m, p.transaction_id); | |
| 300 } | |
| 301 | |
| 302 bool ParamTraits<IndexedDBHostMsg_ObjectStoreOpenCursor_Params>::Read( | |
| 303 const Message* m, | |
| 304 void** iter, | |
| 305 param_type* p) { | |
| 306 return | |
| 307 ReadParam(m, iter, &p->response_id) && | |
| 308 ReadParam(m, iter, &p->lower_key) && | |
| 309 ReadParam(m, iter, &p->upper_key) && | |
| 310 ReadParam(m, iter, &p->lower_open) && | |
| 311 ReadParam(m, iter, &p->upper_open) && | |
| 312 ReadParam(m, iter, &p->direction) && | |
| 313 ReadParam(m, iter, &p->idb_object_store_id) && | |
| 314 ReadParam(m, iter, &p->transaction_id); | |
| 315 } | |
| 316 | |
| 317 void ParamTraits<IndexedDBHostMsg_ObjectStoreOpenCursor_Params>::Log( | |
| 318 const param_type& p, | |
| 319 std::string* l) { | |
| 320 l->append("("); | |
| 321 LogParam(p.response_id, l); | |
| 322 l->append(", "); | |
| 323 LogParam(p.lower_key, l); | |
| 324 l->append(", "); | |
| 325 LogParam(p.upper_key, l); | |
| 326 l->append(", "); | |
| 327 LogParam(p.lower_open, l); | |
| 328 l->append(", "); | |
| 329 LogParam(p.upper_open, l); | |
| 330 l->append(", "); | |
| 331 LogParam(p.direction, l); | |
| 332 l->append(", "); | |
| 333 LogParam(p.idb_object_store_id, l); | |
| 334 l->append(","); | |
| 335 LogParam(p.transaction_id, l); | |
| 336 l->append(")"); | |
| 337 } | |
| 338 | |
| 339 void ParamTraits<WebKit::WebIDBObjectStore::PutMode>::Write( | |
| 340 Message* m, | |
| 341 const param_type& p) { | |
| 342 WriteParam(m, static_cast<int>(p)); | |
| 343 } | |
| 344 | |
| 345 bool ParamTraits<WebKit::WebIDBObjectStore::PutMode>::Read( | |
| 346 const Message* m, | |
| 347 void** iter, | |
| 348 param_type* p) { | |
| 349 int i; | |
| 350 bool ok = ReadParam(m, iter, &i); | |
| 351 if (!ok) | |
| 352 i = 0; | |
| 353 *p = static_cast<param_type>(i); | |
| 354 return ok; | |
| 355 } | |
| 356 | |
| 357 void ParamTraits<WebKit::WebIDBObjectStore::PutMode>::Log( | |
| 358 const param_type& p, | |
| 359 std::string* l) { | |
| 360 LogParam(static_cast<int>(p), l); | |
| 361 } | |
| 362 | |
| 363 } // namespace IPC | |
| OLD | NEW |