Changeset 236007 in webkit
- Timestamp:
- Sep 14, 2018, 9:38:19 AM (8 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 7 edited
-
ChangeLog (modified) (1 diff)
-
Modules/indexeddb/IDBKey.cpp (modified) (7 diffs)
-
Modules/indexeddb/IDBKey.h (modified) (10 diffs)
-
Modules/indexeddb/IDBKeyData.cpp (modified) (26 diffs)
-
Modules/indexeddb/IDBKeyData.h (modified) (14 diffs)
-
Modules/indexeddb/server/SQLiteIDBBackingStore.cpp (modified) (1 diff)
-
bindings/js/IDBBindingUtilities.cpp (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r236006 r236007 1 2018-09-14 David Kilzer <ddkilzer@apple.com> 2 3 REGRESSION (r235954): Fix build failure on watchOS 4 <https://webkit.org/b/189605> 5 6 Reviewed by Geoffrey Garen. 7 8 Remove `using WebCore::IndexedDB::KeyType;` from 9 Source/WebCore/Modules/indexeddb/IDBKey.h and fix all the 10 resulting build failures. 11 12 * Modules/indexeddb/IDBKey.cpp: 13 (WebCore::IDBKey::IDBKey): 14 (WebCore::IDBKey::isValid const): 15 (WebCore::IDBKey::compare const): 16 * Modules/indexeddb/IDBKey.h: 17 (WebCore::IDBKey::createNumber): 18 (WebCore::IDBKey::createDate): 19 (WebCore::IDBKey::type const): 20 (WebCore::IDBKey::array const): 21 (WebCore::IDBKey::string const): 22 (WebCore::IDBKey::date const): 23 (WebCore::IDBKey::number const): 24 (WebCore::IDBKey::binary const): 25 (WebCore::IDBKey::compareTypes): 26 (WebCore::IDBKey::IDBKey): 27 * Modules/indexeddb/IDBKeyData.cpp: 28 (WebCore::IDBKeyData::IDBKeyData): 29 (WebCore::IDBKeyData::maybeCreateIDBKey const): 30 (WebCore::IDBKeyData::isolatedCopy): 31 (WebCore::IDBKeyData::encode const): 32 (WebCore::IDBKeyData::decode): 33 (WebCore::IDBKeyData::compare const): 34 (WebCore::IDBKeyData::loggingString const): 35 (WebCore::IDBKeyData::setArrayValue): 36 (WebCore::IDBKeyData::setBinaryValue): 37 (WebCore::IDBKeyData::setStringValue): 38 (WebCore::IDBKeyData::setDateValue): 39 (WebCore::IDBKeyData::setNumberValue): 40 (WebCore::IDBKeyData::isValid const): 41 (WebCore::IDBKeyData::operator== const): 42 * Modules/indexeddb/IDBKeyData.h: 43 (WebCore::IDBKeyData::IDBKeyData): 44 (WebCore::IDBKeyData::minimum): 45 (WebCore::IDBKeyData::maximum): 46 (WebCore::IDBKeyData::type const): 47 (WebCore::IDBKeyData::hash const): 48 (WebCore::IDBKeyData::string const): 49 (WebCore::IDBKeyData::date const): 50 (WebCore::IDBKeyData::number const): 51 (WebCore::IDBKeyData::binary const): 52 (WebCore::IDBKeyData::array const): 53 (WebCore::IDBKeyData::encode const): 54 (WebCore::IDBKeyData::decode): 55 * Modules/indexeddb/server/SQLiteIDBBackingStore.cpp: 56 (WebCore::IDBServer::SQLiteIDBBackingStore::uncheckedGetIndexRecordForOneKey): 57 * bindings/js/IDBBindingUtilities.cpp: 58 (WebCore::toJS): 59 1 60 2018-09-14 Xabier Rodriguez Calvar <calvaris@igalia.com> 2 61 -
trunk/Source/WebCore/Modules/indexeddb/IDBKey.cpp
r228218 r236007 56 56 } 57 57 58 IDBKey::IDBKey( KeyType type, double number)58 IDBKey::IDBKey(IndexedDB::KeyType type, double number) 59 59 : m_type(type) 60 60 , m_value(number) … … 64 64 65 65 IDBKey::IDBKey(const String& value) 66 : m_type( KeyType::String)66 : m_type(IndexedDB::KeyType::String) 67 67 , m_value(value) 68 68 , m_sizeEstimate(OverheadSize + value.length() * sizeof(UChar)) … … 71 71 72 72 IDBKey::IDBKey(const IDBKeyVector& keyArray, size_t arraySize) 73 : m_type( KeyType::Array)73 : m_type(IndexedDB::KeyType::Array) 74 74 , m_value(keyArray) 75 75 , m_sizeEstimate(OverheadSize + arraySize) … … 78 78 79 79 IDBKey::IDBKey(const ThreadSafeDataBuffer& buffer) 80 : m_type( KeyType::Binary)80 : m_type(IndexedDB::KeyType::Binary) 81 81 , m_value(buffer) 82 82 , m_sizeEstimate(OverheadSize + buffer.size()) … … 88 88 bool IDBKey::isValid() const 89 89 { 90 if (m_type == KeyType::Invalid)90 if (m_type == IndexedDB::KeyType::Invalid) 91 91 return false; 92 92 93 if (m_type == KeyType::Array) {93 if (m_type == IndexedDB::KeyType::Array) { 94 94 for (auto& key : WTF::get<IDBKeyVector>(m_value)) { 95 95 if (!key->isValid()) … … 107 107 108 108 switch (m_type) { 109 case KeyType::Array: {109 case IndexedDB::KeyType::Array: { 110 110 auto& array = WTF::get<IDBKeyVector>(m_value); 111 111 auto& otherArray = WTF::get<IDBKeyVector>(other.m_value); … … 120 120 return 0; 121 121 } 122 case KeyType::Binary:122 case IndexedDB::KeyType::Binary: 123 123 return compareBinaryKeyData(WTF::get<ThreadSafeDataBuffer>(m_value), WTF::get<ThreadSafeDataBuffer>(other.m_value)); 124 case KeyType::String:124 case IndexedDB::KeyType::String: 125 125 return -codePointCompare(WTF::get<String>(other.m_value), WTF::get<String>(m_value)); 126 case KeyType::Date:127 case KeyType::Number: {126 case IndexedDB::KeyType::Date: 127 case IndexedDB::KeyType::Number: { 128 128 auto number = WTF::get<double>(m_value); 129 129 auto otherNumber = WTF::get<double>(other.m_value); 130 130 return (number < otherNumber) ? -1 : ((number > otherNumber) ? 1 : 0); 131 131 } 132 case KeyType::Invalid:133 case KeyType::Min:134 case KeyType::Max:132 case IndexedDB::KeyType::Invalid: 133 case IndexedDB::KeyType::Min: 134 case IndexedDB::KeyType::Max: 135 135 ASSERT_NOT_REACHED(); 136 136 return 0; -
trunk/Source/WebCore/Modules/indexeddb/IDBKey.h
r208646 r236007 36 36 #include <wtf/text/WTFString.h> 37 37 38 using WebCore::IndexedDB::KeyType;39 40 38 namespace JSC { 41 39 class JSArrayBuffer; … … 54 52 static Ref<IDBKey> createNumber(double number) 55 53 { 56 return adoptRef(*new IDBKey( KeyType::Number, number));54 return adoptRef(*new IDBKey(IndexedDB::KeyType::Number, number)); 57 55 } 58 56 … … 64 62 static Ref<IDBKey> createDate(double date) 65 63 { 66 return adoptRef(*new IDBKey( KeyType::Date, date));64 return adoptRef(*new IDBKey(IndexedDB::KeyType::Date, date)); 67 65 } 68 66 … … 108 106 WEBCORE_EXPORT ~IDBKey(); 109 107 110 KeyType type() const { return m_type; }108 IndexedDB::KeyType type() const { return m_type; } 111 109 WEBCORE_EXPORT bool isValid() const; 112 110 113 111 const Vector<RefPtr<IDBKey>>& array() const 114 112 { 115 ASSERT(m_type == KeyType::Array);113 ASSERT(m_type == IndexedDB::KeyType::Array); 116 114 return WTF::get<Vector<RefPtr<IDBKey>>>(m_value); 117 115 } … … 119 117 const String& string() const 120 118 { 121 ASSERT(m_type == KeyType::String);119 ASSERT(m_type == IndexedDB::KeyType::String); 122 120 return WTF::get<String>(m_value); 123 121 } … … 125 123 double date() const 126 124 { 127 ASSERT(m_type == KeyType::Date);125 ASSERT(m_type == IndexedDB::KeyType::Date); 128 126 return WTF::get<double>(m_value); 129 127 } … … 131 129 double number() const 132 130 { 133 ASSERT(m_type == KeyType::Number);131 ASSERT(m_type == IndexedDB::KeyType::Number); 134 132 return WTF::get<double>(m_value); 135 133 } … … 137 135 const ThreadSafeDataBuffer& binary() const 138 136 { 139 ASSERT(m_type == KeyType::Binary);137 ASSERT(m_type == IndexedDB::KeyType::Binary); 140 138 return WTF::get<ThreadSafeDataBuffer>(m_value); 141 139 } … … 147 145 size_t sizeEstimate() const { return m_sizeEstimate; } 148 146 149 static int compareTypes( KeyType a,KeyType b)147 static int compareTypes(IndexedDB::KeyType a, IndexedDB::KeyType b) 150 148 { 151 149 return b - a; … … 161 159 private: 162 160 IDBKey() 163 : m_type( KeyType::Invalid)161 : m_type(IndexedDB::KeyType::Invalid) 164 162 , m_sizeEstimate(OverheadSize) 165 163 { 166 164 } 167 165 168 IDBKey( KeyType, double number);166 IDBKey(IndexedDB::KeyType, double number); 169 167 explicit IDBKey(const String& value); 170 168 IDBKey(const Vector<RefPtr<IDBKey>>& keyArray, size_t arraySize); 171 169 explicit IDBKey(const ThreadSafeDataBuffer&); 172 170 173 const KeyType m_type;171 const IndexedDB::KeyType m_type; 174 172 Variant<Vector<RefPtr<IDBKey>>, String, double, ThreadSafeDataBuffer> m_value; 175 173 -
trunk/Source/WebCore/Modules/indexeddb/IDBKeyData.cpp
r234501 r236007 35 35 36 36 IDBKeyData::IDBKeyData(const IDBKey* key) 37 : m_type( KeyType::Invalid)37 : m_type(IndexedDB::KeyType::Invalid) 38 38 { 39 39 if (!key) { … … 45 45 46 46 switch (m_type) { 47 case KeyType::Invalid:48 break; 49 case KeyType::Array: {47 case IndexedDB::KeyType::Invalid: 48 break; 49 case IndexedDB::KeyType::Array: { 50 50 m_value = Vector<IDBKeyData>(); 51 51 auto& array = WTF::get<Vector<IDBKeyData>>(m_value); … … 54 54 break; 55 55 } 56 case KeyType::Binary:56 case IndexedDB::KeyType::Binary: 57 57 m_value = key->binary(); 58 58 break; 59 case KeyType::String:59 case IndexedDB::KeyType::String: 60 60 m_value = key->string(); 61 61 break; 62 case KeyType::Date:62 case IndexedDB::KeyType::Date: 63 63 m_value = key->date(); 64 64 break; 65 case KeyType::Number:65 case IndexedDB::KeyType::Number: 66 66 m_value = key->number(); 67 67 break; 68 case KeyType::Max:69 case KeyType::Min:68 case IndexedDB::KeyType::Max: 69 case IndexedDB::KeyType::Min: 70 70 break; 71 71 } … … 78 78 79 79 switch (m_type) { 80 case KeyType::Invalid:80 case IndexedDB::KeyType::Invalid: 81 81 return IDBKey::createInvalid(); 82 case KeyType::Array: {82 case IndexedDB::KeyType::Array: { 83 83 Vector<RefPtr<IDBKey>> array; 84 84 for (auto& keyData : WTF::get<Vector<IDBKeyData>>(m_value)) { … … 88 88 return IDBKey::createArray(array); 89 89 } 90 case KeyType::Binary:90 case IndexedDB::KeyType::Binary: 91 91 return IDBKey::createBinary(WTF::get<ThreadSafeDataBuffer>(m_value)); 92 case KeyType::String:92 case IndexedDB::KeyType::String: 93 93 return IDBKey::createString(WTF::get<String>(m_value)); 94 case KeyType::Date:94 case IndexedDB::KeyType::Date: 95 95 return IDBKey::createDate(WTF::get<double>(m_value)); 96 case KeyType::Number:96 case IndexedDB::KeyType::Number: 97 97 return IDBKey::createNumber(WTF::get<double>(m_value)); 98 case KeyType::Max:99 case KeyType::Min:98 case IndexedDB::KeyType::Max: 99 case IndexedDB::KeyType::Min: 100 100 ASSERT_NOT_REACHED(); 101 101 return nullptr; … … 122 122 123 123 switch (source.m_type) { 124 case KeyType::Invalid:125 return; 126 case KeyType::Array: {124 case IndexedDB::KeyType::Invalid: 125 return; 126 case IndexedDB::KeyType::Array: { 127 127 destination.m_value = Vector<IDBKeyData>(); 128 128 auto& destinationArray = WTF::get<Vector<IDBKeyData>>(destination.m_value); … … 131 131 return; 132 132 } 133 case KeyType::Binary:133 case IndexedDB::KeyType::Binary: 134 134 destination.m_value = WTF::get<ThreadSafeDataBuffer>(source.m_value); 135 135 return; 136 case KeyType::String:136 case IndexedDB::KeyType::String: 137 137 destination.m_value = WTF::get<String>(source.m_value).isolatedCopy(); 138 138 return; 139 case KeyType::Date:140 case KeyType::Number:139 case IndexedDB::KeyType::Date: 140 case IndexedDB::KeyType::Number: 141 141 destination.m_value = WTF::get<double>(source.m_value); 142 142 return; 143 case KeyType::Max:144 case KeyType::Min:143 case IndexedDB::KeyType::Max: 144 case IndexedDB::KeyType::Min: 145 145 return; 146 146 } … … 158 158 159 159 switch (m_type) { 160 case KeyType::Invalid:161 return; 162 case KeyType::Array: {160 case IndexedDB::KeyType::Invalid: 161 return; 162 case IndexedDB::KeyType::Array: { 163 163 auto& array = WTF::get<Vector<IDBKeyData>>(m_value); 164 164 encoder.encodeObjects("array", array.begin(), array.end(), [](KeyedEncoder& encoder, const IDBKeyData& key) { … … 167 167 return; 168 168 } 169 case KeyType::Binary: {169 case IndexedDB::KeyType::Binary: { 170 170 auto* data = WTF::get<ThreadSafeDataBuffer>(m_value).data(); 171 171 encoder.encodeBool("hasBinary", !!data); … … 174 174 return; 175 175 } 176 case KeyType::String:176 case IndexedDB::KeyType::String: 177 177 encoder.encodeString("string", WTF::get<String>(m_value)); 178 178 return; 179 case KeyType::Date:180 case KeyType::Number:179 case IndexedDB::KeyType::Date: 180 case IndexedDB::KeyType::Number: 181 181 encoder.encodeDouble("number", WTF::get<double>(m_value)); 182 182 return; 183 case KeyType::Max:184 case KeyType::Min:183 case IndexedDB::KeyType::Max: 184 case IndexedDB::KeyType::Min: 185 185 return; 186 186 } … … 198 198 199 199 auto enumFunction = [](int64_t value) { 200 return value == KeyType::Max201 || value == KeyType::Invalid202 || value == KeyType::Array203 || value == KeyType::Binary204 || value == KeyType::String205 || value == KeyType::Date206 || value == KeyType::Number207 || value == KeyType::Min;200 return value == IndexedDB::KeyType::Max 201 || value == IndexedDB::KeyType::Invalid 202 || value == IndexedDB::KeyType::Array 203 || value == IndexedDB::KeyType::Binary 204 || value == IndexedDB::KeyType::String 205 || value == IndexedDB::KeyType::Date 206 || value == IndexedDB::KeyType::Number 207 || value == IndexedDB::KeyType::Min; 208 208 }; 209 209 if (!decoder.decodeEnum("type", result.m_type, enumFunction)) 210 210 return false; 211 211 212 if (result.m_type == KeyType::Invalid)213 return true; 214 215 if (result.m_type == KeyType::Max)216 return true; 217 218 if (result.m_type == KeyType::Min)219 return true; 220 221 if (result.m_type == KeyType::String) {212 if (result.m_type == IndexedDB::KeyType::Invalid) 213 return true; 214 215 if (result.m_type == IndexedDB::KeyType::Max) 216 return true; 217 218 if (result.m_type == IndexedDB::KeyType::Min) 219 return true; 220 221 if (result.m_type == IndexedDB::KeyType::String) { 222 222 result.m_value = String(); 223 223 return decoder.decodeString("string", WTF::get<String>(result.m_value)); 224 224 } 225 225 226 if (result.m_type == KeyType::Number || result.m_type ==KeyType::Date) {226 if (result.m_type == IndexedDB::KeyType::Number || result.m_type == IndexedDB::KeyType::Date) { 227 227 result.m_value = 0.0; 228 228 return decoder.decodeDouble("number", WTF::get<double>(result.m_value)); 229 229 } 230 230 231 if (result.m_type == KeyType::Binary) {231 if (result.m_type == IndexedDB::KeyType::Binary) { 232 232 result.m_value = ThreadSafeDataBuffer(); 233 233 … … 247 247 } 248 248 249 ASSERT(result.m_type == KeyType::Array);249 ASSERT(result.m_type == IndexedDB::KeyType::Array); 250 250 251 251 auto arrayFunction = [](KeyedDecoder& decoder, IDBKeyData& result) { … … 259 259 int IDBKeyData::compare(const IDBKeyData& other) const 260 260 { 261 if (m_type == KeyType::Invalid) {262 if (other.m_type != KeyType::Invalid)261 if (m_type == IndexedDB::KeyType::Invalid) { 262 if (other.m_type != IndexedDB::KeyType::Invalid) 263 263 return -1; 264 if (other.m_type == KeyType::Invalid)264 if (other.m_type == IndexedDB::KeyType::Invalid) 265 265 return 0; 266 } else if (other.m_type == KeyType::Invalid)266 } else if (other.m_type == IndexedDB::KeyType::Invalid) 267 267 return 1; 268 268 … … 273 273 // The types are the same, so handle actual value comparison. 274 274 switch (m_type) { 275 case KeyType::Invalid:275 case IndexedDB::KeyType::Invalid: 276 276 // Invalid type should have been fully handled above 277 277 ASSERT_NOT_REACHED(); 278 278 return 0; 279 case KeyType::Array: {279 case IndexedDB::KeyType::Array: { 280 280 auto& array = WTF::get<Vector<IDBKeyData>>(m_value); 281 281 auto& otherArray = WTF::get<Vector<IDBKeyData>>(other.m_value); … … 290 290 return 0; 291 291 } 292 case KeyType::Binary:292 case IndexedDB::KeyType::Binary: 293 293 return compareBinaryKeyData(WTF::get<ThreadSafeDataBuffer>(m_value), WTF::get<ThreadSafeDataBuffer>(other.m_value)); 294 case KeyType::String:294 case IndexedDB::KeyType::String: 295 295 return codePointCompare(WTF::get<String>(m_value), WTF::get<String>(other.m_value)); 296 case KeyType::Date:297 case KeyType::Number: {296 case IndexedDB::KeyType::Date: 297 case IndexedDB::KeyType::Number: { 298 298 auto number = WTF::get<double>(m_value); 299 299 auto otherNumber = WTF::get<double>(other.m_value); … … 303 303 return number > otherNumber ? 1 : -1; 304 304 } 305 case KeyType::Max:306 case KeyType::Min:305 case IndexedDB::KeyType::Max: 306 case IndexedDB::KeyType::Min: 307 307 return 0; 308 308 } … … 321 321 322 322 switch (m_type) { 323 case KeyType::Invalid:323 case IndexedDB::KeyType::Invalid: 324 324 return "<invalid>"; 325 case KeyType::Array: {325 case IndexedDB::KeyType::Array: { 326 326 StringBuilder builder; 327 327 builder.appendLiteral("<array> - { "); … … 336 336 break; 337 337 } 338 case KeyType::Binary: {338 case IndexedDB::KeyType::Binary: { 339 339 StringBuilder builder; 340 340 builder.append("<binary> - "); … … 357 357 break; 358 358 } 359 case KeyType::String:359 case IndexedDB::KeyType::String: 360 360 result = "<string> - " + WTF::get<String>(m_value); 361 361 break; 362 case KeyType::Date:362 case IndexedDB::KeyType::Date: 363 363 return String::format("<date> - %f", WTF::get<double>(m_value)); 364 case KeyType::Number:364 case IndexedDB::KeyType::Number: 365 365 return String::format("<number> - %f", WTF::get<double>(m_value)); 366 case KeyType::Max:366 case IndexedDB::KeyType::Max: 367 367 return "<maximum>"; 368 case KeyType::Min:368 case IndexedDB::KeyType::Min: 369 369 return "<minimum>"; 370 370 } … … 383 383 *this = IDBKeyData(); 384 384 m_value = value; 385 m_type = KeyType::Array;385 m_type = IndexedDB::KeyType::Array; 386 386 m_isNull = false; 387 387 } … … 391 391 *this = IDBKeyData(); 392 392 m_value = value; 393 m_type = KeyType::Binary;393 m_type = IndexedDB::KeyType::Binary; 394 394 m_isNull = false; 395 395 } … … 399 399 *this = IDBKeyData(); 400 400 m_value = value; 401 m_type = KeyType::String;401 m_type = IndexedDB::KeyType::String; 402 402 m_isNull = false; 403 403 } … … 407 407 *this = IDBKeyData(); 408 408 m_value = value; 409 m_type = KeyType::Date;409 m_type = IndexedDB::KeyType::Date; 410 410 m_isNull = false; 411 411 } … … 415 415 *this = IDBKeyData(); 416 416 m_value = value; 417 m_type = KeyType::Number;417 m_type = IndexedDB::KeyType::Number; 418 418 m_isNull = false; 419 419 } … … 429 429 bool IDBKeyData::isValid() const 430 430 { 431 if (m_type == KeyType::Invalid)431 if (m_type == IndexedDB::KeyType::Invalid) 432 432 return false; 433 433 434 if (m_type == KeyType::Array) {434 if (m_type == IndexedDB::KeyType::Array) { 435 435 for (auto& key : array()) { 436 436 if (!key.isValid()) … … 452 452 return false; 453 453 switch (m_type) { 454 case KeyType::Invalid:455 case KeyType::Max:456 case KeyType::Min:457 return true; 458 case KeyType::Number:459 case KeyType::Date:454 case IndexedDB::KeyType::Invalid: 455 case IndexedDB::KeyType::Max: 456 case IndexedDB::KeyType::Min: 457 return true; 458 case IndexedDB::KeyType::Number: 459 case IndexedDB::KeyType::Date: 460 460 return WTF::get<double>(m_value) == WTF::get<double>(other.m_value); 461 case KeyType::String:461 case IndexedDB::KeyType::String: 462 462 return WTF::get<String>(m_value) == WTF::get<String>(other.m_value); 463 case KeyType::Binary:463 case IndexedDB::KeyType::Binary: 464 464 return WTF::get<ThreadSafeDataBuffer>(m_value) == WTF::get<ThreadSafeDataBuffer>(other.m_value); 465 case KeyType::Array:465 case IndexedDB::KeyType::Array: 466 466 return WTF::get<Vector<IDBKeyData>>(m_value) == WTF::get<Vector<IDBKeyData>>(other.m_value); 467 467 } -
trunk/Source/WebCore/Modules/indexeddb/IDBKeyData.h
r234125 r236007 41 41 public: 42 42 IDBKeyData() 43 : m_type( KeyType::Invalid)43 : m_type(IndexedDB::KeyType::Invalid) 44 44 , m_isNull(true) 45 45 { … … 54 54 { 55 55 IDBKeyData result; 56 result.m_type = KeyType::Min;56 result.m_type = IndexedDB::KeyType::Min; 57 57 result.m_isNull = false; 58 58 return result; … … 62 62 { 63 63 IDBKeyData result; 64 result.m_type = KeyType::Max;64 result.m_type = IndexedDB::KeyType::Max; 65 65 result.m_isNull = false; 66 66 return result; … … 95 95 bool isNull() const { return m_isNull; } 96 96 bool isValid() const; 97 KeyType type() const { return m_type; }97 IndexedDB::KeyType type() const { return m_type; } 98 98 99 99 bool operator<(const IDBKeyData&) const; … … 126 126 hashCodes.append(m_isDeletedValue ? 1 : 0); 127 127 switch (m_type) { 128 case KeyType::Invalid:129 case KeyType::Max:130 case KeyType::Min:131 break; 132 case KeyType::Number:133 case KeyType::Date:128 case IndexedDB::KeyType::Invalid: 129 case IndexedDB::KeyType::Max: 130 case IndexedDB::KeyType::Min: 131 break; 132 case IndexedDB::KeyType::Number: 133 case IndexedDB::KeyType::Date: 134 134 hashCodes.append(StringHasher::hashMemory<sizeof(double)>(&WTF::get<double>(m_value))); 135 135 break; 136 case KeyType::String:136 case IndexedDB::KeyType::String: 137 137 hashCodes.append(StringHash::hash(WTF::get<String>(m_value))); 138 138 break; 139 case KeyType::Binary: {139 case IndexedDB::KeyType::Binary: { 140 140 auto* data = WTF::get<ThreadSafeDataBuffer>(m_value).data(); 141 141 if (!data) … … 145 145 break; 146 146 } 147 case KeyType::Array:147 case IndexedDB::KeyType::Array: 148 148 for (auto& key : WTF::get<Vector<IDBKeyData>>(m_value)) 149 149 hashCodes.append(key.hash()); … … 159 159 String string() const 160 160 { 161 ASSERT(m_type == KeyType::String);161 ASSERT(m_type == IndexedDB::KeyType::String); 162 162 return WTF::get<String>(m_value); 163 163 } … … 165 165 double date() const 166 166 { 167 ASSERT(m_type == KeyType::Date);167 ASSERT(m_type == IndexedDB::KeyType::Date); 168 168 return WTF::get<double>(m_value); 169 169 } … … 171 171 double number() const 172 172 { 173 ASSERT(m_type == KeyType::Number);173 ASSERT(m_type == IndexedDB::KeyType::Number); 174 174 return WTF::get<double>(m_value); 175 175 } … … 177 177 const ThreadSafeDataBuffer& binary() const 178 178 { 179 ASSERT(m_type == KeyType::Binary);179 ASSERT(m_type == IndexedDB::KeyType::Binary); 180 180 return WTF::get<ThreadSafeDataBuffer>(m_value); 181 181 } … … 183 183 const Vector<IDBKeyData>& array() const 184 184 { 185 ASSERT(m_type == KeyType::Array);185 ASSERT(m_type == IndexedDB::KeyType::Array); 186 186 return WTF::get<Vector<IDBKeyData>>(m_value); 187 187 } … … 190 190 static void isolatedCopy(const IDBKeyData& source, IDBKeyData& destination); 191 191 192 KeyType m_type;192 IndexedDB::KeyType m_type; 193 193 Variant<Vector<IDBKeyData>, String, double, ThreadSafeDataBuffer> m_value; 194 194 … … 239 239 240 240 switch (m_type) { 241 case KeyType::Invalid:242 case KeyType::Max:243 case KeyType::Min:244 break; 245 case KeyType::Array:241 case IndexedDB::KeyType::Invalid: 242 case IndexedDB::KeyType::Max: 243 case IndexedDB::KeyType::Min: 244 break; 245 case IndexedDB::KeyType::Array: 246 246 encoder << WTF::get<Vector<IDBKeyData>>(m_value); 247 247 break; 248 case KeyType::Binary:248 case IndexedDB::KeyType::Binary: 249 249 encoder << WTF::get<ThreadSafeDataBuffer>(m_value); 250 250 break; 251 case KeyType::String:251 case IndexedDB::KeyType::String: 252 252 encoder << WTF::get<String>(m_value); 253 253 break; 254 case KeyType::Date:255 case KeyType::Number:254 case IndexedDB::KeyType::Date: 255 case IndexedDB::KeyType::Number: 256 256 encoder << WTF::get<double>(m_value); 257 257 break; … … 273 273 274 274 switch (keyData.m_type) { 275 case KeyType::Invalid:276 case KeyType::Max:277 case KeyType::Min:278 break; 279 case KeyType::Array:275 case IndexedDB::KeyType::Invalid: 276 case IndexedDB::KeyType::Max: 277 case IndexedDB::KeyType::Min: 278 break; 279 case IndexedDB::KeyType::Array: 280 280 keyData.m_value = Vector<IDBKeyData>(); 281 281 if (!decoder.decode(WTF::get<Vector<IDBKeyData>>(keyData.m_value))) 282 282 return std::nullopt; 283 283 break; 284 case KeyType::Binary:284 case IndexedDB::KeyType::Binary: 285 285 keyData.m_value = ThreadSafeDataBuffer(); 286 286 if (!decoder.decode(WTF::get<ThreadSafeDataBuffer>(keyData.m_value))) 287 287 return std::nullopt; 288 288 break; 289 case KeyType::String:289 case IndexedDB::KeyType::String: 290 290 keyData.m_value = String(); 291 291 if (!decoder.decode(WTF::get<String>(keyData.m_value))) 292 292 return std::nullopt; 293 293 break; 294 case KeyType::Date:295 case KeyType::Number:294 case IndexedDB::KeyType::Date: 295 case IndexedDB::KeyType::Number: 296 296 keyData.m_value = 0.0; 297 297 if (!decoder.decode(WTF::get<double>(keyData.m_value))) -
trunk/Source/WebCore/Modules/indexeddb/server/SQLiteIDBBackingStore.cpp
r234501 r236007 2220 2220 LOG(IndexedDB, "SQLiteIDBBackingStore::uncheckedGetIndexRecordForOneKey"); 2221 2221 2222 ASSERT(key.isValid() && key.type() != KeyType::Max && key.type() !=KeyType::Min);2222 ASSERT(key.isValid() && key.type() != IndexedDB::KeyType::Max && key.type() != IndexedDB::KeyType::Min); 2223 2223 2224 2224 RefPtr<SharedBuffer> buffer = serializeIDBKeyData(key); -
trunk/Source/WebCore/bindings/js/IDBBindingUtilities.cpp
r229410 r236007 97 97 98 98 switch (key->type()) { 99 case KeyType::Array: {99 case IndexedDB::KeyType::Array: { 100 100 auto& inArray = key->array(); 101 101 unsigned size = inArray.size(); … … 108 108 return outArray; 109 109 } 110 case KeyType::Binary: {110 case IndexedDB::KeyType::Binary: { 111 111 auto* data = key->binary().data(); 112 112 if (!data) { … … 122 122 return JSArrayBuffer::create(state.vm(), structure, WTFMove(arrayBuffer)); 123 123 } 124 case KeyType::String:124 case IndexedDB::KeyType::String: 125 125 return jsStringWithCache(&state, key->string()); 126 case KeyType::Date:126 case IndexedDB::KeyType::Date: 127 127 // FIXME: This should probably be toJS<IDLDate>(...) as per: 128 128 // http://w3c.github.io/IndexedDB/#request-convert-a-key-to-a-value 129 129 return toJS<IDLNullable<IDLDate>>(state, key->date()); 130 case KeyType::Number:130 case IndexedDB::KeyType::Number: 131 131 return jsNumber(key->number()); 132 case KeyType::Min:133 case KeyType::Max:134 case KeyType::Invalid:132 case IndexedDB::KeyType::Min: 133 case IndexedDB::KeyType::Max: 134 case IndexedDB::KeyType::Invalid: 135 135 ASSERT_NOT_REACHED(); 136 136 return jsUndefined();
Note:
See TracChangeset
for help on using the changeset viewer.