REGRESSION (r235954): Fix build failure on watchOS
authorddkilzer@apple.com <ddkilzer@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 14 Sep 2018 16:38:19 +0000 (16:38 +0000)
committerddkilzer@apple.com <ddkilzer@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 14 Sep 2018 16:38:19 +0000 (16:38 +0000)
<https://webkit.org/b/189605>

Reviewed by Geoffrey Garen.

Remove `using WebCore::IndexedDB::KeyType;` from
Source/WebCore/Modules/indexeddb/IDBKey.h and fix all the
resulting build failures.

* Modules/indexeddb/IDBKey.cpp:
(WebCore::IDBKey::IDBKey):
(WebCore::IDBKey::isValid const):
(WebCore::IDBKey::compare const):
* Modules/indexeddb/IDBKey.h:
(WebCore::IDBKey::createNumber):
(WebCore::IDBKey::createDate):
(WebCore::IDBKey::type const):
(WebCore::IDBKey::array const):
(WebCore::IDBKey::string const):
(WebCore::IDBKey::date const):
(WebCore::IDBKey::number const):
(WebCore::IDBKey::binary const):
(WebCore::IDBKey::compareTypes):
(WebCore::IDBKey::IDBKey):
* Modules/indexeddb/IDBKeyData.cpp:
(WebCore::IDBKeyData::IDBKeyData):
(WebCore::IDBKeyData::maybeCreateIDBKey const):
(WebCore::IDBKeyData::isolatedCopy):
(WebCore::IDBKeyData::encode const):
(WebCore::IDBKeyData::decode):
(WebCore::IDBKeyData::compare const):
(WebCore::IDBKeyData::loggingString const):
(WebCore::IDBKeyData::setArrayValue):
(WebCore::IDBKeyData::setBinaryValue):
(WebCore::IDBKeyData::setStringValue):
(WebCore::IDBKeyData::setDateValue):
(WebCore::IDBKeyData::setNumberValue):
(WebCore::IDBKeyData::isValid const):
(WebCore::IDBKeyData::operator== const):
* Modules/indexeddb/IDBKeyData.h:
(WebCore::IDBKeyData::IDBKeyData):
(WebCore::IDBKeyData::minimum):
(WebCore::IDBKeyData::maximum):
(WebCore::IDBKeyData::type const):
(WebCore::IDBKeyData::hash const):
(WebCore::IDBKeyData::string const):
(WebCore::IDBKeyData::date const):
(WebCore::IDBKeyData::number const):
(WebCore::IDBKeyData::binary const):
(WebCore::IDBKeyData::array const):
(WebCore::IDBKeyData::encode const):
(WebCore::IDBKeyData::decode):
* Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:
(WebCore::IDBServer::SQLiteIDBBackingStore::uncheckedGetIndexRecordForOneKey):
* bindings/js/IDBBindingUtilities.cpp:
(WebCore::toJS):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@236007 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/Modules/indexeddb/IDBKey.cpp
Source/WebCore/Modules/indexeddb/IDBKey.h
Source/WebCore/Modules/indexeddb/IDBKeyData.cpp
Source/WebCore/Modules/indexeddb/IDBKeyData.h
Source/WebCore/Modules/indexeddb/server/SQLiteIDBBackingStore.cpp
Source/WebCore/bindings/js/IDBBindingUtilities.cpp

index 97661fa..1ceccd6 100644 (file)
@@ -1,3 +1,62 @@
+2018-09-14  David Kilzer  <ddkilzer@apple.com>
+
+        REGRESSION (r235954): Fix build failure on watchOS
+        <https://webkit.org/b/189605>
+
+        Reviewed by Geoffrey Garen.
+
+        Remove `using WebCore::IndexedDB::KeyType;` from
+        Source/WebCore/Modules/indexeddb/IDBKey.h and fix all the
+        resulting build failures.
+
+        * Modules/indexeddb/IDBKey.cpp:
+        (WebCore::IDBKey::IDBKey):
+        (WebCore::IDBKey::isValid const):
+        (WebCore::IDBKey::compare const):
+        * Modules/indexeddb/IDBKey.h:
+        (WebCore::IDBKey::createNumber):
+        (WebCore::IDBKey::createDate):
+        (WebCore::IDBKey::type const):
+        (WebCore::IDBKey::array const):
+        (WebCore::IDBKey::string const):
+        (WebCore::IDBKey::date const):
+        (WebCore::IDBKey::number const):
+        (WebCore::IDBKey::binary const):
+        (WebCore::IDBKey::compareTypes):
+        (WebCore::IDBKey::IDBKey):
+        * Modules/indexeddb/IDBKeyData.cpp:
+        (WebCore::IDBKeyData::IDBKeyData):
+        (WebCore::IDBKeyData::maybeCreateIDBKey const):
+        (WebCore::IDBKeyData::isolatedCopy):
+        (WebCore::IDBKeyData::encode const):
+        (WebCore::IDBKeyData::decode):
+        (WebCore::IDBKeyData::compare const):
+        (WebCore::IDBKeyData::loggingString const):
+        (WebCore::IDBKeyData::setArrayValue):
+        (WebCore::IDBKeyData::setBinaryValue):
+        (WebCore::IDBKeyData::setStringValue):
+        (WebCore::IDBKeyData::setDateValue):
+        (WebCore::IDBKeyData::setNumberValue):
+        (WebCore::IDBKeyData::isValid const):
+        (WebCore::IDBKeyData::operator== const):
+        * Modules/indexeddb/IDBKeyData.h:
+        (WebCore::IDBKeyData::IDBKeyData):
+        (WebCore::IDBKeyData::minimum):
+        (WebCore::IDBKeyData::maximum):
+        (WebCore::IDBKeyData::type const):
+        (WebCore::IDBKeyData::hash const):
+        (WebCore::IDBKeyData::string const):
+        (WebCore::IDBKeyData::date const):
+        (WebCore::IDBKeyData::number const):
+        (WebCore::IDBKeyData::binary const):
+        (WebCore::IDBKeyData::array const):
+        (WebCore::IDBKeyData::encode const):
+        (WebCore::IDBKeyData::decode):
+        * Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:
+        (WebCore::IDBServer::SQLiteIDBBackingStore::uncheckedGetIndexRecordForOneKey):
+        * bindings/js/IDBBindingUtilities.cpp:
+        (WebCore::toJS):
+
 2018-09-14  Xabier Rodriguez Calvar  <calvaris@igalia.com>
 
         [EME] Add support the waitingforkey event
index cbd531c..2a98499 100644 (file)
@@ -55,7 +55,7 @@ Ref<IDBKey> IDBKey::createBinary(JSC::JSArrayBufferView& arrayBufferView)
     return adoptRef(*new IDBKey(ThreadSafeDataBuffer::copyData(bufferView->data(), bufferView->byteLength())));
 }
 
-IDBKey::IDBKey(KeyType type, double number)
+IDBKey::IDBKey(IndexedDB::KeyType type, double number)
     : m_type(type)
     , m_value(number)
     , m_sizeEstimate(OverheadSize + sizeof(double))
@@ -63,21 +63,21 @@ IDBKey::IDBKey(KeyType type, double number)
 }
 
 IDBKey::IDBKey(const String& value)
-    : m_type(KeyType::String)
+    : m_type(IndexedDB::KeyType::String)
     , m_value(value)
     , m_sizeEstimate(OverheadSize + value.length() * sizeof(UChar))
 {
 }
 
 IDBKey::IDBKey(const IDBKeyVector& keyArray, size_t arraySize)
-    : m_type(KeyType::Array)
+    : m_type(IndexedDB::KeyType::Array)
     , m_value(keyArray)
     , m_sizeEstimate(OverheadSize + arraySize)
 {
 }
 
 IDBKey::IDBKey(const ThreadSafeDataBuffer& buffer)
-    : m_type(KeyType::Binary)
+    : m_type(IndexedDB::KeyType::Binary)
     , m_value(buffer)
     , m_sizeEstimate(OverheadSize + buffer.size())
 {
@@ -87,10 +87,10 @@ IDBKey::~IDBKey() = default;
 
 bool IDBKey::isValid() const
 {
-    if (m_type == KeyType::Invalid)
+    if (m_type == IndexedDB::KeyType::Invalid)
         return false;
 
-    if (m_type == KeyType::Array) {
+    if (m_type == IndexedDB::KeyType::Array) {
         for (auto& key : WTF::get<IDBKeyVector>(m_value)) {
             if (!key->isValid())
                 return false;
@@ -106,7 +106,7 @@ int IDBKey::compare(const IDBKey& other) const
         return m_type > other.m_type ? -1 : 1;
 
     switch (m_type) {
-    case KeyType::Array: {
+    case IndexedDB::KeyType::Array: {
         auto& array = WTF::get<IDBKeyVector>(m_value);
         auto& otherArray = WTF::get<IDBKeyVector>(other.m_value);
         for (size_t i = 0; i < array.size() && i < otherArray.size(); ++i) {
@@ -119,19 +119,19 @@ int IDBKey::compare(const IDBKey& other) const
             return 1;
         return 0;
     }
-    case KeyType::Binary:
+    case IndexedDB::KeyType::Binary:
         return compareBinaryKeyData(WTF::get<ThreadSafeDataBuffer>(m_value), WTF::get<ThreadSafeDataBuffer>(other.m_value));
-    case KeyType::String:
+    case IndexedDB::KeyType::String:
         return -codePointCompare(WTF::get<String>(other.m_value), WTF::get<String>(m_value));
-    case KeyType::Date:
-    case KeyType::Number: {
+    case IndexedDB::KeyType::Date:
+    case IndexedDB::KeyType::Number: {
         auto number = WTF::get<double>(m_value);
         auto otherNumber = WTF::get<double>(other.m_value);
         return (number < otherNumber) ? -1 : ((number > otherNumber) ? 1 : 0);
     }
-    case KeyType::Invalid:
-    case KeyType::Min:
-    case KeyType::Max:
+    case IndexedDB::KeyType::Invalid:
+    case IndexedDB::KeyType::Min:
+    case IndexedDB::KeyType::Max:
         ASSERT_NOT_REACHED();
         return 0;
     }
index bc5ed50..8b3ce23 100644 (file)
@@ -35,8 +35,6 @@
 #include <wtf/Vector.h>
 #include <wtf/text/WTFString.h>
 
-using WebCore::IndexedDB::KeyType;
-
 namespace JSC {
 class JSArrayBuffer;
 class JSArrayBufferView;
@@ -53,7 +51,7 @@ public:
 
     static Ref<IDBKey> createNumber(double number)
     {
-        return adoptRef(*new IDBKey(KeyType::Number, number));
+        return adoptRef(*new IDBKey(IndexedDB::KeyType::Number, number));
     }
 
     static Ref<IDBKey> createString(const String& string)
@@ -63,7 +61,7 @@ public:
 
     static Ref<IDBKey> createDate(double date)
     {
-        return adoptRef(*new IDBKey(KeyType::Date, date));
+        return adoptRef(*new IDBKey(IndexedDB::KeyType::Date, date));
     }
 
     static Ref<IDBKey> createMultiEntryArray(const Vector<RefPtr<IDBKey>>& array)
@@ -107,36 +105,36 @@ public:
 
     WEBCORE_EXPORT ~IDBKey();
 
-    KeyType type() const { return m_type; }
+    IndexedDB::KeyType type() const { return m_type; }
     WEBCORE_EXPORT bool isValid() const;
 
     const Vector<RefPtr<IDBKey>>& array() const
     {
-        ASSERT(m_type == KeyType::Array);
+        ASSERT(m_type == IndexedDB::KeyType::Array);
         return WTF::get<Vector<RefPtr<IDBKey>>>(m_value);
     }
 
     const String& string() const
     {
-        ASSERT(m_type == KeyType::String);
+        ASSERT(m_type == IndexedDB::KeyType::String);
         return WTF::get<String>(m_value);
     }
 
     double date() const
     {
-        ASSERT(m_type == KeyType::Date);
+        ASSERT(m_type == IndexedDB::KeyType::Date);
         return WTF::get<double>(m_value);
     }
 
     double number() const
     {
-        ASSERT(m_type == KeyType::Number);
+        ASSERT(m_type == IndexedDB::KeyType::Number);
         return WTF::get<double>(m_value);
     }
 
     const ThreadSafeDataBuffer& binary() const
     {
-        ASSERT(m_type == KeyType::Binary);
+        ASSERT(m_type == IndexedDB::KeyType::Binary);
         return WTF::get<ThreadSafeDataBuffer>(m_value);
     }
 
@@ -146,7 +144,7 @@ public:
 
     size_t sizeEstimate() const { return m_sizeEstimate; }
 
-    static int compareTypes(KeyType a, KeyType b)
+    static int compareTypes(IndexedDB::KeyType a, IndexedDB::KeyType b)
     {
         return b - a;
     }
@@ -160,17 +158,17 @@ public:
 
 private:
     IDBKey()
-        : m_type(KeyType::Invalid)
+        : m_type(IndexedDB::KeyType::Invalid)
         , m_sizeEstimate(OverheadSize)
     {
     }
 
-    IDBKey(KeyType, double number);
+    IDBKey(IndexedDB::KeyType, double number);
     explicit IDBKey(const String& value);
     IDBKey(const Vector<RefPtr<IDBKey>>& keyArray, size_t arraySize);
     explicit IDBKey(const ThreadSafeDataBuffer&);
 
-    const KeyType m_type;
+    const IndexedDB::KeyType m_type;
     Variant<Vector<RefPtr<IDBKey>>, String, double, ThreadSafeDataBuffer> m_value;
 
     const size_t m_sizeEstimate;
index 2e8cedc..40fd3b1 100644 (file)
@@ -34,7 +34,7 @@
 namespace WebCore {
 
 IDBKeyData::IDBKeyData(const IDBKey* key)
-    : m_type(KeyType::Invalid)
+    : m_type(IndexedDB::KeyType::Invalid)
 {
     if (!key) {
         m_isNull = true;
@@ -44,29 +44,29 @@ IDBKeyData::IDBKeyData(const IDBKey* key)
     m_type = key->type();
 
     switch (m_type) {
-    case KeyType::Invalid:
+    case IndexedDB::KeyType::Invalid:
         break;
-    case KeyType::Array: {
+    case IndexedDB::KeyType::Array: {
         m_value = Vector<IDBKeyData>();
         auto& array = WTF::get<Vector<IDBKeyData>>(m_value);
         for (auto& key2 : key->array())
             array.append(IDBKeyData(key2.get()));
         break;
     }
-    case KeyType::Binary:
+    case IndexedDB::KeyType::Binary:
         m_value = key->binary();
         break;
-    case KeyType::String:
+    case IndexedDB::KeyType::String:
         m_value = key->string();
         break;
-    case KeyType::Date:
+    case IndexedDB::KeyType::Date:
         m_value = key->date();
         break;
-    case KeyType::Number:
+    case IndexedDB::KeyType::Number:
         m_value = key->number();
         break;
-    case KeyType::Max:
-    case KeyType::Min:
+    case IndexedDB::KeyType::Max:
+    case IndexedDB::KeyType::Min:
         break;
     }
 }
@@ -77,9 +77,9 @@ RefPtr<IDBKey> IDBKeyData::maybeCreateIDBKey() const
         return nullptr;
 
     switch (m_type) {
-    case KeyType::Invalid:
+    case IndexedDB::KeyType::Invalid:
         return IDBKey::createInvalid();
-    case KeyType::Array: {
+    case IndexedDB::KeyType::Array: {
         Vector<RefPtr<IDBKey>> array;
         for (auto& keyData : WTF::get<Vector<IDBKeyData>>(m_value)) {
             array.append(keyData.maybeCreateIDBKey());
@@ -87,16 +87,16 @@ RefPtr<IDBKey> IDBKeyData::maybeCreateIDBKey() const
         }
         return IDBKey::createArray(array);
     }
-    case KeyType::Binary:
+    case IndexedDB::KeyType::Binary:
         return IDBKey::createBinary(WTF::get<ThreadSafeDataBuffer>(m_value));
-    case KeyType::String:
+    case IndexedDB::KeyType::String:
         return IDBKey::createString(WTF::get<String>(m_value));
-    case KeyType::Date:
+    case IndexedDB::KeyType::Date:
         return IDBKey::createDate(WTF::get<double>(m_value));
-    case KeyType::Number:
+    case IndexedDB::KeyType::Number:
         return IDBKey::createNumber(WTF::get<double>(m_value));
-    case KeyType::Max:
-    case KeyType::Min:
+    case IndexedDB::KeyType::Max:
+    case IndexedDB::KeyType::Min:
         ASSERT_NOT_REACHED();
         return nullptr;
     }
@@ -121,27 +121,27 @@ void IDBKeyData::isolatedCopy(const IDBKeyData& source, IDBKeyData& destination)
     destination.m_isNull = source.m_isNull;
 
     switch (source.m_type) {
-    case KeyType::Invalid:
+    case IndexedDB::KeyType::Invalid:
         return;
-    case KeyType::Array: {
+    case IndexedDB::KeyType::Array: {
         destination.m_value = Vector<IDBKeyData>();
         auto& destinationArray = WTF::get<Vector<IDBKeyData>>(destination.m_value);
         for (auto& key : WTF::get<Vector<IDBKeyData>>(source.m_value))
             destinationArray.append(key.isolatedCopy());
         return;
     }
-    case KeyType::Binary:
+    case IndexedDB::KeyType::Binary:
         destination.m_value = WTF::get<ThreadSafeDataBuffer>(source.m_value);
         return;
-    case KeyType::String:
+    case IndexedDB::KeyType::String:
         destination.m_value = WTF::get<String>(source.m_value).isolatedCopy();
         return;
-    case KeyType::Date:
-    case KeyType::Number:
+    case IndexedDB::KeyType::Date:
+    case IndexedDB::KeyType::Number:
         destination.m_value = WTF::get<double>(source.m_value);
         return;
-    case KeyType::Max:
-    case KeyType::Min:
+    case IndexedDB::KeyType::Max:
+    case IndexedDB::KeyType::Min:
         return;
     }
 
@@ -157,31 +157,31 @@ void IDBKeyData::encode(KeyedEncoder& encoder) const
     encoder.encodeEnum("type", m_type);
 
     switch (m_type) {
-    case KeyType::Invalid:
+    case IndexedDB::KeyType::Invalid:
         return;
-    case KeyType::Array: {
+    case IndexedDB::KeyType::Array: {
         auto& array = WTF::get<Vector<IDBKeyData>>(m_value);
         encoder.encodeObjects("array", array.begin(), array.end(), [](KeyedEncoder& encoder, const IDBKeyData& key) {
             key.encode(encoder);
         });
         return;
     }
-    case KeyType::Binary: {
+    case IndexedDB::KeyType::Binary: {
         auto* data = WTF::get<ThreadSafeDataBuffer>(m_value).data();
         encoder.encodeBool("hasBinary", !!data);
         if (data)
             encoder.encodeBytes("binary", data->data(), data->size());
         return;
     }
-    case KeyType::String:
+    case IndexedDB::KeyType::String:
         encoder.encodeString("string", WTF::get<String>(m_value));
         return;
-    case KeyType::Date:
-    case KeyType::Number:
+    case IndexedDB::KeyType::Date:
+    case IndexedDB::KeyType::Number:
         encoder.encodeDouble("number", WTF::get<double>(m_value));
         return;
-    case KeyType::Max:
-    case KeyType::Min:
+    case IndexedDB::KeyType::Max:
+    case IndexedDB::KeyType::Min:
         return;
     }
 
@@ -197,38 +197,38 @@ bool IDBKeyData::decode(KeyedDecoder& decoder, IDBKeyData& result)
         return true;
 
     auto enumFunction = [](int64_t value) {
-        return value == KeyType::Max
-            || value == KeyType::Invalid
-            || value == KeyType::Array
-            || value == KeyType::Binary
-            || value == KeyType::String
-            || value == KeyType::Date
-            || value == KeyType::Number
-            || value == KeyType::Min;
+        return value == IndexedDB::KeyType::Max
+            || value == IndexedDB::KeyType::Invalid
+            || value == IndexedDB::KeyType::Array
+            || value == IndexedDB::KeyType::Binary
+            || value == IndexedDB::KeyType::String
+            || value == IndexedDB::KeyType::Date
+            || value == IndexedDB::KeyType::Number
+            || value == IndexedDB::KeyType::Min;
     };
     if (!decoder.decodeEnum("type", result.m_type, enumFunction))
         return false;
 
-    if (result.m_type == KeyType::Invalid)
+    if (result.m_type == IndexedDB::KeyType::Invalid)
         return true;
 
-    if (result.m_type == KeyType::Max)
+    if (result.m_type == IndexedDB::KeyType::Max)
         return true;
 
-    if (result.m_type == KeyType::Min)
+    if (result.m_type == IndexedDB::KeyType::Min)
         return true;
 
-    if (result.m_type == KeyType::String) {
+    if (result.m_type == IndexedDB::KeyType::String) {
         result.m_value = String();
         return decoder.decodeString("string", WTF::get<String>(result.m_value));
     }
 
-    if (result.m_type == KeyType::Number || result.m_type == KeyType::Date) {
+    if (result.m_type == IndexedDB::KeyType::Number || result.m_type == IndexedDB::KeyType::Date) {
         result.m_value = 0.0;
         return decoder.decodeDouble("number", WTF::get<double>(result.m_value));
     }
 
-    if (result.m_type == KeyType::Binary) {
+    if (result.m_type == IndexedDB::KeyType::Binary) {
         result.m_value = ThreadSafeDataBuffer();
 
         bool hasBinaryData;
@@ -246,7 +246,7 @@ bool IDBKeyData::decode(KeyedDecoder& decoder, IDBKeyData& result)
         return true;
     }
 
-    ASSERT(result.m_type == KeyType::Array);
+    ASSERT(result.m_type == IndexedDB::KeyType::Array);
 
     auto arrayFunction = [](KeyedDecoder& decoder, IDBKeyData& result) {
         return decode(decoder, result);
@@ -258,12 +258,12 @@ bool IDBKeyData::decode(KeyedDecoder& decoder, IDBKeyData& result)
 
 int IDBKeyData::compare(const IDBKeyData& other) const
 {
-    if (m_type == KeyType::Invalid) {
-        if (other.m_type != KeyType::Invalid)
+    if (m_type == IndexedDB::KeyType::Invalid) {
+        if (other.m_type != IndexedDB::KeyType::Invalid)
             return -1;
-        if (other.m_type == KeyType::Invalid)
+        if (other.m_type == IndexedDB::KeyType::Invalid)
             return 0;
-    } else if (other.m_type == KeyType::Invalid)
+    } else if (other.m_type == IndexedDB::KeyType::Invalid)
         return 1;
 
     // The IDBKey::m_type enum is in reverse sort order.
@@ -272,11 +272,11 @@ int IDBKeyData::compare(const IDBKeyData& other) const
 
     // The types are the same, so handle actual value comparison.
     switch (m_type) {
-    case KeyType::Invalid:
+    case IndexedDB::KeyType::Invalid:
         // Invalid type should have been fully handled above
         ASSERT_NOT_REACHED();
         return 0;
-    case KeyType::Array: {
+    case IndexedDB::KeyType::Array: {
         auto& array = WTF::get<Vector<IDBKeyData>>(m_value);
         auto& otherArray = WTF::get<Vector<IDBKeyData>>(other.m_value);
         for (size_t i = 0; i < array.size() && i < otherArray.size(); ++i) {
@@ -289,12 +289,12 @@ int IDBKeyData::compare(const IDBKeyData& other) const
             return 1;
         return 0;
     }
-    case KeyType::Binary:
+    case IndexedDB::KeyType::Binary:
         return compareBinaryKeyData(WTF::get<ThreadSafeDataBuffer>(m_value), WTF::get<ThreadSafeDataBuffer>(other.m_value));
-    case KeyType::String:
+    case IndexedDB::KeyType::String:
         return codePointCompare(WTF::get<String>(m_value), WTF::get<String>(other.m_value));
-    case KeyType::Date:
-    case KeyType::Number: {
+    case IndexedDB::KeyType::Date:
+    case IndexedDB::KeyType::Number: {
         auto number = WTF::get<double>(m_value);
         auto otherNumber = WTF::get<double>(other.m_value);
 
@@ -302,8 +302,8 @@ int IDBKeyData::compare(const IDBKeyData& other) const
             return 0;
         return number > otherNumber ? 1 : -1;
     }
-    case KeyType::Max:
-    case KeyType::Min:
+    case IndexedDB::KeyType::Max:
+    case IndexedDB::KeyType::Min:
         return 0;
     }
 
@@ -320,9 +320,9 @@ String IDBKeyData::loggingString() const
     String result;
 
     switch (m_type) {
-    case KeyType::Invalid:
+    case IndexedDB::KeyType::Invalid:
         return "<invalid>";
-    case KeyType::Array: {
+    case IndexedDB::KeyType::Array: {
         StringBuilder builder;
         builder.appendLiteral("<array> - { ");
         auto& array = WTF::get<Vector<IDBKeyData>>(m_value);
@@ -335,7 +335,7 @@ String IDBKeyData::loggingString() const
         result = builder.toString();
         break;
     }
-    case KeyType::Binary: {
+    case IndexedDB::KeyType::Binary: {
         StringBuilder builder;
         builder.append("<binary> - ");
 
@@ -356,16 +356,16 @@ String IDBKeyData::loggingString() const
         result = builder.toString();
         break;
     }
-    case KeyType::String:
+    case IndexedDB::KeyType::String:
         result = "<string> - " + WTF::get<String>(m_value);
         break;
-    case KeyType::Date:
+    case IndexedDB::KeyType::Date:
         return String::format("<date> - %f", WTF::get<double>(m_value));
-    case KeyType::Number:
+    case IndexedDB::KeyType::Number:
         return String::format("<number> - %f", WTF::get<double>(m_value));
-    case KeyType::Max:
+    case IndexedDB::KeyType::Max:
         return "<maximum>";
-    case KeyType::Min:
+    case IndexedDB::KeyType::Min:
         return "<minimum>";
     }
 
@@ -382,7 +382,7 @@ void IDBKeyData::setArrayValue(const Vector<IDBKeyData>& value)
 {
     *this = IDBKeyData();
     m_value = value;
-    m_type = KeyType::Array;
+    m_type = IndexedDB::KeyType::Array;
     m_isNull = false;
 }
 
@@ -390,7 +390,7 @@ void IDBKeyData::setBinaryValue(const ThreadSafeDataBuffer& value)
 {
     *this = IDBKeyData();
     m_value = value;
-    m_type = KeyType::Binary;
+    m_type = IndexedDB::KeyType::Binary;
     m_isNull = false;
 }
 
@@ -398,7 +398,7 @@ void IDBKeyData::setStringValue(const String& value)
 {
     *this = IDBKeyData();
     m_value = value;
-    m_type = KeyType::String;
+    m_type = IndexedDB::KeyType::String;
     m_isNull = false;
 }
 
@@ -406,7 +406,7 @@ void IDBKeyData::setDateValue(double value)
 {
     *this = IDBKeyData();
     m_value = value;
-    m_type = KeyType::Date;
+    m_type = IndexedDB::KeyType::Date;
     m_isNull = false;
 }
 
@@ -414,7 +414,7 @@ void IDBKeyData::setNumberValue(double value)
 {
     *this = IDBKeyData();
     m_value = value;
-    m_type = KeyType::Number;
+    m_type = IndexedDB::KeyType::Number;
     m_isNull = false;
 }
 
@@ -428,10 +428,10 @@ IDBKeyData IDBKeyData::deletedValue()
 
 bool IDBKeyData::isValid() const
 {
-    if (m_type == KeyType::Invalid)
+    if (m_type == IndexedDB::KeyType::Invalid)
         return false;
     
-    if (m_type == KeyType::Array) {
+    if (m_type == IndexedDB::KeyType::Array) {
         for (auto& key : array()) {
             if (!key.isValid())
                 return false;
@@ -451,18 +451,18 @@ bool IDBKeyData::operator==(const IDBKeyData& other) const
     if (m_type != other.m_type || m_isNull != other.m_isNull || m_isDeletedValue != other.m_isDeletedValue)
         return false;
     switch (m_type) {
-    case KeyType::Invalid:
-    case KeyType::Max:
-    case KeyType::Min:
+    case IndexedDB::KeyType::Invalid:
+    case IndexedDB::KeyType::Max:
+    case IndexedDB::KeyType::Min:
         return true;
-    case KeyType::Number:
-    case KeyType::Date:
+    case IndexedDB::KeyType::Number:
+    case IndexedDB::KeyType::Date:
         return WTF::get<double>(m_value) == WTF::get<double>(other.m_value);
-    case KeyType::String:
+    case IndexedDB::KeyType::String:
         return WTF::get<String>(m_value) == WTF::get<String>(other.m_value);
-    case KeyType::Binary:
+    case IndexedDB::KeyType::Binary:
         return WTF::get<ThreadSafeDataBuffer>(m_value) == WTF::get<ThreadSafeDataBuffer>(other.m_value);
-    case KeyType::Array:
+    case IndexedDB::KeyType::Array:
         return WTF::get<Vector<IDBKeyData>>(m_value) == WTF::get<Vector<IDBKeyData>>(other.m_value);
     }
     RELEASE_ASSERT_NOT_REACHED();
index abd9d06..482780f 100644 (file)
@@ -40,7 +40,7 @@ class KeyedEncoder;
 class IDBKeyData {
 public:
     IDBKeyData()
-        : m_type(KeyType::Invalid)
+        : m_type(IndexedDB::KeyType::Invalid)
         , m_isNull(true)
     {
     }
@@ -53,7 +53,7 @@ public:
     static IDBKeyData minimum()
     {
         IDBKeyData result;
-        result.m_type = KeyType::Min;
+        result.m_type = IndexedDB::KeyType::Min;
         result.m_isNull = false;
         return result;
     }
@@ -61,7 +61,7 @@ public:
     static IDBKeyData maximum()
     {
         IDBKeyData result;
-        result.m_type = KeyType::Max;
+        result.m_type = IndexedDB::KeyType::Max;
         result.m_isNull = false;
         return result;
     }
@@ -94,7 +94,7 @@ public:
 
     bool isNull() const { return m_isNull; }
     bool isValid() const;
-    KeyType type() const { return m_type; }
+    IndexedDB::KeyType type() const { return m_type; }
 
     bool operator<(const IDBKeyData&) const;
     bool operator>(const IDBKeyData& other) const
@@ -125,18 +125,18 @@ public:
         hashCodes.append(m_isNull ? 1 : 0);
         hashCodes.append(m_isDeletedValue ? 1 : 0);
         switch (m_type) {
-        case KeyType::Invalid:
-        case KeyType::Max:
-        case KeyType::Min:
+        case IndexedDB::KeyType::Invalid:
+        case IndexedDB::KeyType::Max:
+        case IndexedDB::KeyType::Min:
             break;
-        case KeyType::Number:
-        case KeyType::Date:
+        case IndexedDB::KeyType::Number:
+        case IndexedDB::KeyType::Date:
             hashCodes.append(StringHasher::hashMemory<sizeof(double)>(&WTF::get<double>(m_value)));
             break;
-        case KeyType::String:
+        case IndexedDB::KeyType::String:
             hashCodes.append(StringHash::hash(WTF::get<String>(m_value)));
             break;
-        case KeyType::Binary: {
+        case IndexedDB::KeyType::Binary: {
             auto* data = WTF::get<ThreadSafeDataBuffer>(m_value).data();
             if (!data)
                 hashCodes.append(0);
@@ -144,7 +144,7 @@ public:
                 hashCodes.append(StringHasher::hashMemory(data->data(), data->size()));
             break;
         }
-        case KeyType::Array:
+        case IndexedDB::KeyType::Array:
             for (auto& key : WTF::get<Vector<IDBKeyData>>(m_value))
                 hashCodes.append(key.hash());
             break;
@@ -158,38 +158,38 @@ public:
 
     String string() const
     {
-        ASSERT(m_type == KeyType::String);
+        ASSERT(m_type == IndexedDB::KeyType::String);
         return WTF::get<String>(m_value);
     }
 
     double date() const
     {
-        ASSERT(m_type == KeyType::Date);
+        ASSERT(m_type == IndexedDB::KeyType::Date);
         return WTF::get<double>(m_value);
     }
 
     double number() const
     {
-        ASSERT(m_type == KeyType::Number);
+        ASSERT(m_type == IndexedDB::KeyType::Number);
         return WTF::get<double>(m_value);
     }
 
     const ThreadSafeDataBuffer& binary() const
     {
-        ASSERT(m_type == KeyType::Binary);
+        ASSERT(m_type == IndexedDB::KeyType::Binary);
         return WTF::get<ThreadSafeDataBuffer>(m_value);
     }
 
     const Vector<IDBKeyData>& array() const
     {
-        ASSERT(m_type == KeyType::Array);
+        ASSERT(m_type == IndexedDB::KeyType::Array);
         return WTF::get<Vector<IDBKeyData>>(m_value);
     }
 
 private:
     static void isolatedCopy(const IDBKeyData& source, IDBKeyData& destination);
 
-    KeyType m_type;
+    IndexedDB::KeyType m_type;
     Variant<Vector<IDBKeyData>, String, double, ThreadSafeDataBuffer> m_value;
 
     bool m_isNull { false };
@@ -238,21 +238,21 @@ void IDBKeyData::encode(Encoder& encoder) const
     encoder.encodeEnum(m_type);
 
     switch (m_type) {
-    case KeyType::Invalid:
-    case KeyType::Max:
-    case KeyType::Min:
+    case IndexedDB::KeyType::Invalid:
+    case IndexedDB::KeyType::Max:
+    case IndexedDB::KeyType::Min:
         break;
-    case KeyType::Array:
+    case IndexedDB::KeyType::Array:
         encoder << WTF::get<Vector<IDBKeyData>>(m_value);
         break;
-    case KeyType::Binary:
+    case IndexedDB::KeyType::Binary:
         encoder << WTF::get<ThreadSafeDataBuffer>(m_value);
         break;
-    case KeyType::String:
+    case IndexedDB::KeyType::String:
         encoder << WTF::get<String>(m_value);
         break;
-    case KeyType::Date:
-    case KeyType::Number:
+    case IndexedDB::KeyType::Date:
+    case IndexedDB::KeyType::Number:
         encoder << WTF::get<double>(m_value);
         break;
     }
@@ -272,27 +272,27 @@ std::optional<IDBKeyData> IDBKeyData::decode(Decoder& decoder)
         return std::nullopt;
 
     switch (keyData.m_type) {
-    case KeyType::Invalid:
-    case KeyType::Max:
-    case KeyType::Min:
+    case IndexedDB::KeyType::Invalid:
+    case IndexedDB::KeyType::Max:
+    case IndexedDB::KeyType::Min:
         break;
-    case KeyType::Array:
+    case IndexedDB::KeyType::Array:
         keyData.m_value = Vector<IDBKeyData>();
         if (!decoder.decode(WTF::get<Vector<IDBKeyData>>(keyData.m_value)))
             return std::nullopt;
         break;
-    case KeyType::Binary:
+    case IndexedDB::KeyType::Binary:
         keyData.m_value = ThreadSafeDataBuffer();
         if (!decoder.decode(WTF::get<ThreadSafeDataBuffer>(keyData.m_value)))
             return std::nullopt;
         break;
-    case KeyType::String:
+    case IndexedDB::KeyType::String:
         keyData.m_value = String();
         if (!decoder.decode(WTF::get<String>(keyData.m_value)))
             return std::nullopt;
         break;
-    case KeyType::Date:
-    case KeyType::Number:
+    case IndexedDB::KeyType::Date:
+    case IndexedDB::KeyType::Number:
         keyData.m_value = 0.0;
         if (!decoder.decode(WTF::get<double>(keyData.m_value)))
             return std::nullopt;
index 5e5d76c..a1db7a2 100644 (file)
@@ -2219,7 +2219,7 @@ IDBError SQLiteIDBBackingStore::uncheckedGetIndexRecordForOneKey(int64_t indexID
 {
     LOG(IndexedDB, "SQLiteIDBBackingStore::uncheckedGetIndexRecordForOneKey");
 
-    ASSERT(key.isValid() && key.type() != KeyType::Max && key.type() != KeyType::Min);
+    ASSERT(key.isValid() && key.type() != IndexedDB::KeyType::Max && key.type() != IndexedDB::KeyType::Min);
 
     RefPtr<SharedBuffer> buffer = serializeIDBKeyData(key);
     if (!buffer) {
index 7dda1fa..2a980fa 100644 (file)
@@ -96,7 +96,7 @@ JSValue toJS(ExecState& state, JSGlobalObject& globalObject, IDBKey* key)
     auto scope = DECLARE_THROW_SCOPE(vm);
 
     switch (key->type()) {
-    case KeyType::Array: {
+    case IndexedDB::KeyType::Array: {
         auto& inArray = key->array();
         unsigned size = inArray.size();
         auto outArray = constructEmptyArray(&state, 0, &globalObject, size);
@@ -107,7 +107,7 @@ JSValue toJS(ExecState& state, JSGlobalObject& globalObject, IDBKey* key)
         }
         return outArray;
     }
-    case KeyType::Binary: {
+    case IndexedDB::KeyType::Binary: {
         auto* data = key->binary().data();
         if (!data) {
             ASSERT_NOT_REACHED();
@@ -121,17 +121,17 @@ JSValue toJS(ExecState& state, JSGlobalObject& globalObject, IDBKey* key)
 
         return JSArrayBuffer::create(state.vm(), structure, WTFMove(arrayBuffer));
     }
-    case KeyType::String:
+    case IndexedDB::KeyType::String:
         return jsStringWithCache(&state, key->string());
-    case KeyType::Date:
+    case IndexedDB::KeyType::Date:
         // FIXME: This should probably be toJS<IDLDate>(...) as per:
         // http://w3c.github.io/IndexedDB/#request-convert-a-key-to-a-value
         return toJS<IDLNullable<IDLDate>>(state, key->date());
-    case KeyType::Number:
+    case IndexedDB::KeyType::Number:
         return jsNumber(key->number());
-    case KeyType::Min:
-    case KeyType::Max:
-    case KeyType::Invalid:
+    case IndexedDB::KeyType::Min:
+    case IndexedDB::KeyType::Max:
+    case IndexedDB::KeyType::Invalid:
         ASSERT_NOT_REACHED();
         return jsUndefined();
     }