Changeset 88019 in webkit
- Timestamp:
- Jun 3, 2011 8:02:48 AM (13 years ago)
- Location:
- trunk/Source
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r88016 r88019 1 2011-06-03 Hans Wennborg <hans@chromium.org> 2 3 Reviewed by Steve Block. 4 5 IndexedDB: Clean-up use of INT64_MAX in LevelDB back-end 6 https://bugs.webkit.org/show_bug.cgi?id=62009 7 8 This constant should only be needed inside IDBLevelDBCoding.cpp. 9 10 No new functionality, no new tests. 11 12 * storage/IDBLevelDBBackingStore.cpp: 13 (WebCore::getNewDatabaseId): 14 (WebCore::IDBLevelDBBackingStore::getObjectStores): 15 (WebCore::getNewObjectStoreId): 16 (WebCore::IDBLevelDBBackingStore::deleteObjectStore): 17 (WebCore::getNewIndexId): 18 * storage/IDBLevelDBCoding.cpp: 19 (WebCore::IDBLevelDBCoding::DatabaseFreeListKey::encodeMaxKey): 20 (WebCore::IDBLevelDBCoding::ObjectStoreMetaDataKey::encodeMaxKey): 21 (WebCore::IDBLevelDBCoding::IndexMetaDataKey::encodeMaxKey): 22 (WebCore::IDBLevelDBCoding::ObjectStoreFreeListKey::encodeMaxKey): 23 (WebCore::IDBLevelDBCoding::IndexFreeListKey::encodeMaxKey): 24 * storage/IDBLevelDBCoding.h: 25 1 26 2011-06-03 Siddharth Mathur <siddharth.mathur@nokia.com> 2 27 -
trunk/Source/WebCore/storage/IDBLevelDBBackingStore.cpp
r87491 r88019 42 42 #include "SecurityOrigin.h" 43 43 44 #ifndef INT64_MAX45 // FIXME: We shouldn't need to rely on these macros.46 #define INT64_MAX 0x7fffffffffffffffLL47 #endif48 49 44 namespace WebCore { 50 45 … … 184 179 { 185 180 const Vector<char> freeListStartKey = DatabaseFreeListKey::encode(0); 186 const Vector<char> freeListStopKey = DatabaseFreeListKey::encode (INT64_MAX);181 const Vector<char> freeListStopKey = DatabaseFreeListKey::encodeMaxKey(); 187 182 188 183 OwnPtr<LevelDBIterator> it = db->createIterator(); … … 235 230 { 236 231 const Vector<char> startKey = ObjectStoreMetaDataKey::encode(databaseId, 1, 0); 237 const Vector<char> stopKey = ObjectStoreMetaDataKey::encode (databaseId, INT64_MAX, 0);232 const Vector<char> stopKey = ObjectStoreMetaDataKey::encodeMaxKey(databaseId); 238 233 239 234 OwnPtr<LevelDBIterator> it = m_db->createIterator(); … … 292 287 { 293 288 const Vector<char> freeListStartKey = ObjectStoreFreeListKey::encode(databaseId, 0); 294 const Vector<char> freeListStopKey = ObjectStoreFreeListKey::encode (databaseId, INT64_MAX);289 const Vector<char> freeListStopKey = ObjectStoreFreeListKey::encodeMaxKey(databaseId); 295 290 296 291 OwnPtr<LevelDBIterator> it = transaction->createIterator(); … … 407 402 m_currentTransaction->remove(ObjectStoreNamesKey::encode(databaseId, objectStoreName)); 408 403 409 if (!deleteRange(m_currentTransaction.get(), IndexFreeListKey::encode(databaseId, objectStoreId, 0), IndexFreeListKey::encode (databaseId, objectStoreId, INT64_MAX)))404 if (!deleteRange(m_currentTransaction.get(), IndexFreeListKey::encode(databaseId, objectStoreId, 0), IndexFreeListKey::encodeMaxKey(databaseId, objectStoreId))) 410 405 return; // FIXME: Report error. 411 if (!deleteRange(m_currentTransaction.get(), IndexMetaDataKey::encode(databaseId, objectStoreId, 0, 0), IndexMetaDataKey::encode (databaseId, objectStoreId, INT64_MAX, 0)))406 if (!deleteRange(m_currentTransaction.get(), IndexMetaDataKey::encode(databaseId, objectStoreId, 0, 0), IndexMetaDataKey::encodeMaxKey(databaseId, objectStoreId))) 412 407 return; // FIXME: Report error. 413 408 … … 640 635 { 641 636 const Vector<char> startKey = IndexFreeListKey::encode(databaseId, objectStoreId, 0); 642 const Vector<char> stopKey = IndexFreeListKey::encode (databaseId, objectStoreId, INT64_MAX);637 const Vector<char> stopKey = IndexFreeListKey::encodeMaxKey(databaseId, objectStoreId); 643 638 644 639 OwnPtr<LevelDBIterator> it = transaction->createIterator(); -
trunk/Source/WebCore/storage/IDBLevelDBCoding.cpp
r86425 r88019 146 146 147 147 #ifndef INT64_MAX 148 // FIXME: We shouldn't need to rely on these macros.149 148 #define INT64_MAX 0x7fffffffffffffffLL 150 149 #endif … … 751 750 } 752 751 752 Vector<char> DatabaseFreeListKey::encodeMaxKey() 753 { 754 return encode(INT64_MAX); 755 } 756 753 757 int64_t DatabaseFreeListKey::databaseId() const 754 758 { … … 847 851 ret.append(encodeVarInt(metaDataType)); 848 852 return ret; 853 } 854 855 Vector<char> ObjectStoreMetaDataKey::encodeMaxKey(int64_t databaseId) 856 { 857 return encode(databaseId, INT64_MAX, INT64_MAX); 849 858 } 850 859 … … 914 923 } 915 924 925 Vector<char> IndexMetaDataKey::encodeMaxKey(int64_t databaseId, int64_t objectStoreId) 926 { 927 return encode(databaseId, objectStoreId, INT64_MAX, 255); 928 } 929 916 930 int IndexMetaDataKey::compare(const IndexMetaDataKey& other) 917 931 { … … 964 978 } 965 979 980 Vector<char> ObjectStoreFreeListKey::encodeMaxKey(int64_t databaseId) 981 { 982 return encode(databaseId, INT64_MAX); 983 } 984 966 985 int64_t ObjectStoreFreeListKey::objectStoreId() const 967 986 { … … 1014 1033 ret.append(encodeVarInt(indexId)); 1015 1034 return ret; 1035 } 1036 1037 Vector<char> IndexFreeListKey::encodeMaxKey(int64_t databaseId, int64_t objectStoreId) 1038 { 1039 return encode(databaseId, objectStoreId, INT64_MAX); 1016 1040 } 1017 1041 -
trunk/Source/WebCore/storage/IDBLevelDBCoding.h
r85045 r88019 105 105 static const char* decode(const char* start, const char* limit, DatabaseFreeListKey* result); 106 106 static Vector<char> encode(int64_t databaseId); 107 static Vector<char> encodeMaxKey(); 107 108 int64_t databaseId() const; 108 109 int compare(const DatabaseFreeListKey& other) const; … … 142 143 static const char* decode(const char* start, const char* limit, ObjectStoreMetaDataKey* result); 143 144 static Vector<char> encode(int64_t databaseId, int64_t objectStoreId, int64_t metaDataType); 145 static Vector<char> encodeMaxKey(int64_t databaseId); 144 146 int64_t objectStoreId() const; 145 147 int64_t metaDataType() const; … … 156 158 static const char* decode(const char* start, const char* limit, IndexMetaDataKey* result); 157 159 static Vector<char> encode(int64_t databaseId, int64_t objectStoreId, int64_t indexId, unsigned char metaDataType); 160 static Vector<char> encodeMaxKey(int64_t databaseId, int64_t objectStoreId); 158 161 int compare(const IndexMetaDataKey& other); 159 162 int64_t indexId() const; … … 171 174 static const char* decode(const char* start, const char* limit, ObjectStoreFreeListKey* result); 172 175 static Vector<char> encode(int64_t databaseId, int64_t objectStoreId); 176 static Vector<char> encodeMaxKey(int64_t databaseId); 173 177 int64_t objectStoreId() const; 174 178 int compare(const ObjectStoreFreeListKey& other); … … 183 187 static const char* decode(const char* start, const char* limit, IndexFreeListKey* result); 184 188 static Vector<char> encode(int64_t databaseId, int64_t objectStoreId, int64_t indexId); 189 static Vector<char> encodeMaxKey(int64_t databaseId, int64_t objectStoreId); 185 190 int compare(const IndexFreeListKey& other); 186 191 int64_t objectStoreId() const; -
trunk/Source/WebKit/chromium/ChangeLog
r88010 r88019 1 2011-06-03 Hans Wennborg <hans@chromium.org> 2 3 Reviewed by Steve Block. 4 5 IndexedDB: Clean-up use of INT64_MAX in LevelDB back-end 6 https://bugs.webkit.org/show_bug.cgi?id=62009 7 8 Don't use INT64_MAX, use the various encodeMaxKey() functions instead. 9 10 * tests/IDBLevelDBCodingTest.cpp: 11 (IDBLevelDBCoding::TEST): 12 1 13 2011-06-03 Mikhail Naganov <mnaganov@chromium.org> 2 14 -
trunk/Source/WebKit/chromium/tests/IDBLevelDBCodingTest.cpp
r86425 r88019 35 35 #include <wtf/Vector.h> 36 36 37 #ifndef INT64_MAX38 // FIXME: We shouldn't need to rely on these macros.39 #define INT64_MAX 0x7fffffffffffffffLL40 #endif41 42 37 using namespace WebCore; 43 38 using namespace IDBLevelDBCoding; … … 346 341 keys.append(MaxDatabaseIdKey::encode()); 347 342 keys.append(DatabaseFreeListKey::encode(0)); 348 keys.append(DatabaseFreeListKey::encode (INT64_MAX));343 keys.append(DatabaseFreeListKey::encodeMaxKey()); 349 344 keys.append(DatabaseNameKey::encode("", "")); 350 345 keys.append(DatabaseNameKey::encode("", "a")); … … 352 347 keys.append(DatabaseMetaDataKey::encode(1, DatabaseMetaDataKey::kOriginName)); 353 348 keys.append(ObjectStoreMetaDataKey::encode(1, 1, 0)); 354 keys.append(ObjectStoreMetaDataKey::encode (1, INT64_MAX, 0));349 keys.append(ObjectStoreMetaDataKey::encodeMaxKey(1)); 355 350 keys.append(IndexMetaDataKey::encode(1, 1, 30, 0)); 356 keys.append(IndexMetaDataKey::encode(1, 1, INT64_MAX, 0)); 351 keys.append(IndexMetaDataKey::encode(1, 1, 31, 0)); 352 keys.append(IndexMetaDataKey::encode(1, 1, 31, 1)); 357 353 keys.append(ObjectStoreFreeListKey::encode(1, 1)); 358 keys.append(ObjectStoreFreeListKey::encode (1, INT64_MAX));359 keys.append(IndexFreeListKey::encode(1, 1, 30));360 keys.append(IndexFreeListKey::encode (1, 1, INT64_MAX));361 keys.append(IndexFreeListKey::encode(1, INT64_MAX, 30));362 keys.append(IndexFreeListKey::encode (1, INT64_MAX, INT64_MAX));354 keys.append(ObjectStoreFreeListKey::encodeMaxKey(1)); 355 keys.append(IndexFreeListKey::encode(1, 1, kMinimumIndexId)); 356 keys.append(IndexFreeListKey::encodeMaxKey(1, 1)); 357 keys.append(IndexFreeListKey::encode(1, 2, kMinimumIndexId)); 358 keys.append(IndexFreeListKey::encodeMaxKey(1, 2)); 363 359 keys.append(ObjectStoreNamesKey::encode(1, "")); 364 360 keys.append(ObjectStoreNamesKey::encode(1, "a")); 365 361 keys.append(IndexNamesKey::encode(1, 1, "")); 366 362 keys.append(IndexNamesKey::encode(1, 1, "a")); 367 keys.append(IndexNamesKey::encode(1, INT64_MAX, "a"));363 keys.append(IndexNamesKey::encode(1, 2, "a")); 368 364 keys.append(ObjectStoreDataKey::encode(1, 1, minIDBKey())); 369 365 keys.append(ObjectStoreDataKey::encode(1, 1, maxIDBKey())); … … 371 367 keys.append(ExistsEntryKey::encode(1, 1, maxIDBKey())); 372 368 keys.append(IndexDataKey::encode(1, 1, 30, minIDBKey(), 0)); 373 keys.append(IndexDataKey::encode(1, 1, 30, minIDBKey(), INT64_MAX));369 keys.append(IndexDataKey::encode(1, 1, 30, minIDBKey(), 1)); 374 370 keys.append(IndexDataKey::encode(1, 1, 30, maxIDBKey(), 0)); 375 keys.append(IndexDataKey::encode(1, 1, 30, maxIDBKey(), INT64_MAX));371 keys.append(IndexDataKey::encode(1, 1, 30, maxIDBKey(), 1)); 376 372 keys.append(IndexDataKey::encode(1, 1, 31, minIDBKey(), 0)); 377 373 keys.append(IndexDataKey::encode(1, 2, 30, minIDBKey(), 0)); 378 374 keys.append(IndexDataKey::encodeMaxKey(1, 2)); 379 keys.append(ObjectStoreDataKey::encode(1, INT64_MAX, minIDBKey()));380 keys.append(ExistsEntryKey::encode(1, INT64_MAX, maxIDBKey()));381 keys.append(IndexDataKey::encodeMaxKey(1, INT64_MAX));382 keys.append(DatabaseMetaDataKey::encode(INT64_MAX, DatabaseMetaDataKey::kOriginName));383 keys.append(IndexDataKey::encodeMaxKey(INT64_MAX, INT64_MAX));384 375 385 376 for (size_t i = 0; i < keys.size(); ++i) {
Note: See TracChangeset
for help on using the changeset viewer.