Changeset 159597 in webkit
- Timestamp:
- Nov 20, 2013, 5:11:28 PM (12 years ago)
- Location:
- trunk/Source/WebKit2
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r159586 r159597 1 2013-11-20 Brady Eidson <beidson@apple.com> 2 3 Add argument coders for IDBDatabaseMetadata classes 4 https://bugs.webkit.org/show_bug.cgi?id=124689 5 6 Reviewed by Anders Carlsson. 7 8 Add coders for: 9 - IDBDatabaseMetadata 10 - IDBIndexMetadata 11 - IDBKeyPath 12 - IDBObjectStoreMetadata 13 14 * Shared/WebCoreArgumentCoders.cpp: 15 (CoreIPC::::encode): 16 (CoreIPC::::decode): 17 * Shared/WebCoreArgumentCoders.h: 18 1 19 2013-11-20 Anders Carlsson <andersca@apple.com> 2 20 -
trunk/Source/WebKit2/Shared/WebCoreArgumentCoders.cpp
r158486 r159597 41 41 #include <WebCore/GraphicsContext.h> 42 42 #include <WebCore/GraphicsLayer.h> 43 #include <WebCore/IDBDatabaseMetadata.h> 44 #include <WebCore/IDBKeyPath.h> 43 45 #include <WebCore/Image.h> 44 46 #include <WebCore/Length.h> … … 1309 1311 #endif // ENABLE(CSS_FILTERS) && !USE(COORDINATED_GRAPHICS) 1310 1312 1313 #if ENABLE(INDEXED_DATABASE) 1314 void ArgumentCoder<IDBDatabaseMetadata>::encode(ArgumentEncoder& encoder, const IDBDatabaseMetadata& metadata) 1315 { 1316 encoder << metadata.name << metadata.id << metadata.version << metadata.maxObjectStoreId << metadata.objectStores; 1317 } 1318 1319 bool ArgumentCoder<IDBDatabaseMetadata>::decode(ArgumentDecoder& decoder, IDBDatabaseMetadata& metadata) 1320 { 1321 if (!decoder.decode(metadata.name)) 1322 return false; 1323 1324 if (!decoder.decode(metadata.id)) 1325 return false; 1326 1327 if (!decoder.decode(metadata.version)) 1328 return false; 1329 1330 if (!decoder.decode(metadata.maxObjectStoreId)) 1331 return false; 1332 1333 if (!decoder.decode(metadata.objectStores)) 1334 return false; 1335 1336 return true; 1337 } 1338 1339 void ArgumentCoder<IDBIndexMetadata>::encode(ArgumentEncoder& encoder, const IDBIndexMetadata& metadata) 1340 { 1341 encoder << metadata.name << metadata.id << metadata.keyPath << metadata.unique << metadata.multiEntry; 1342 } 1343 1344 bool ArgumentCoder<IDBIndexMetadata>::decode(ArgumentDecoder& decoder, IDBIndexMetadata& metadata) 1345 { 1346 if (!decoder.decode(metadata.name)) 1347 return false; 1348 1349 if (!decoder.decode(metadata.id)) 1350 return false; 1351 1352 if (!decoder.decode(metadata.keyPath)) 1353 return false; 1354 1355 if (!decoder.decode(metadata.unique)) 1356 return false; 1357 1358 if (!decoder.decode(metadata.multiEntry)) 1359 return false; 1360 1361 return true; 1362 } 1363 1364 void ArgumentCoder<IDBKeyPath>::encode(ArgumentEncoder& encoder, const IDBKeyPath& keyPath) 1365 { 1366 encoder.encodeEnum(keyPath.type()); 1367 1368 switch (keyPath.type()) { 1369 case IDBKeyPath::NullType: 1370 break; 1371 case IDBKeyPath::StringType: 1372 encoder << keyPath.string(); 1373 break; 1374 case IDBKeyPath::ArrayType: 1375 encoder << keyPath.array(); 1376 break; 1377 default: 1378 ASSERT_NOT_REACHED(); 1379 } 1380 } 1381 1382 bool ArgumentCoder<IDBKeyPath>::decode(ArgumentDecoder& decoder, IDBKeyPath& keyPath) 1383 { 1384 IDBKeyPath::Type type; 1385 if (!decoder.decodeEnum(type)) 1386 return false; 1387 1388 switch (type) { 1389 case IDBKeyPath::NullType: 1390 keyPath = IDBKeyPath(); 1391 return true; 1392 1393 case IDBKeyPath::StringType: { 1394 String string; 1395 if (!decoder.decode(string)) 1396 return false; 1397 1398 keyPath = IDBKeyPath(string); 1399 return true; 1400 } 1401 case IDBKeyPath::ArrayType: { 1402 Vector<String> array; 1403 if (!decoder.decode(array)) 1404 return false; 1405 1406 keyPath = IDBKeyPath(array); 1407 return true; 1408 } 1409 default: 1410 return false; 1411 } 1412 } 1413 1414 void ArgumentCoder<IDBObjectStoreMetadata>::encode(ArgumentEncoder& encoder, const IDBObjectStoreMetadata& metadata) 1415 { 1416 encoder << metadata.name << metadata.id << metadata.keyPath << metadata.autoIncrement << metadata.maxIndexId << metadata.indexes; 1417 } 1418 1419 bool ArgumentCoder<IDBObjectStoreMetadata>::decode(ArgumentDecoder& decoder, IDBObjectStoreMetadata& metadata) 1420 { 1421 if (!decoder.decode(metadata.name)) 1422 return false; 1423 1424 if (!decoder.decode(metadata.id)) 1425 return false; 1426 1427 if (!decoder.decode(metadata.keyPath)) 1428 return false; 1429 1430 if (!decoder.decode(metadata.autoIncrement)) 1431 return false; 1432 1433 if (!decoder.decode(metadata.maxIndexId)) 1434 return false; 1435 1436 if (!decoder.decode(metadata.indexes)) 1437 return false; 1438 1439 return true; 1440 } 1441 #endif 1442 1311 1443 } // namespace CoreIPC -
trunk/Source/WebKit2/Shared/WebCoreArgumentCoders.h
r158081 r159597 42 42 class FloatSize; 43 43 class HTTPHeaderMap; 44 class IDBKeyPath; 44 45 class IntPoint; 45 46 class IntRect; … … 61 62 struct DragSession; 62 63 struct FileChooserSettings; 64 struct IDBDatabaseMetadata; 65 struct IDBIndexMetadata; 66 struct IDBObjectStoreMetadata; 63 67 struct Length; 64 68 struct GrammarDetail; … … 299 303 #endif 300 304 305 #if ENABLE(INDEXED_DATABASE) 306 template<> struct ArgumentCoder<WebCore::IDBDatabaseMetadata> { 307 static void encode(ArgumentEncoder&, const WebCore::IDBDatabaseMetadata&); 308 static bool decode(ArgumentDecoder&, WebCore::IDBDatabaseMetadata&); 309 }; 310 311 template<> struct ArgumentCoder<WebCore::IDBIndexMetadata> { 312 static void encode(ArgumentEncoder&, const WebCore::IDBIndexMetadata&); 313 static bool decode(ArgumentDecoder&, WebCore::IDBIndexMetadata&); 314 }; 315 316 template<> struct ArgumentCoder<WebCore::IDBKeyPath> { 317 static void encode(ArgumentEncoder&, const WebCore::IDBKeyPath&); 318 static bool decode(ArgumentDecoder&, WebCore::IDBKeyPath&); 319 }; 320 321 template<> struct ArgumentCoder<WebCore::IDBObjectStoreMetadata> { 322 static void encode(ArgumentEncoder&, const WebCore::IDBObjectStoreMetadata&); 323 static bool decode(ArgumentDecoder&, WebCore::IDBObjectStoreMetadata&); 324 }; 325 #endif 326 301 327 } // namespace CoreIPC 302 328
Note:
See TracChangeset
for help on using the changeset viewer.