⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 236007 in webkit


Ignore:
Timestamp:
Sep 14, 2018, 9:38:19 AM (8 years ago)
Author:
ddkilzer@apple.com
Message:

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):

Location:
trunk/Source/WebCore
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r236006 r236007  
     12018-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
    1602018-09-14  Xabier Rodriguez Calvar  <calvaris@igalia.com>
    261
  • trunk/Source/WebCore/Modules/indexeddb/IDBKey.cpp

    r228218 r236007  
    5656}
    5757
    58 IDBKey::IDBKey(KeyType type, double number)
     58IDBKey::IDBKey(IndexedDB::KeyType type, double number)
    5959    : m_type(type)
    6060    , m_value(number)
    … …  
    6464
    6565IDBKey::IDBKey(const String& value)
    66     : m_type(KeyType::String)
     66    : m_type(IndexedDB::KeyType::String)
    6767    , m_value(value)
    6868    , m_sizeEstimate(OverheadSize + value.length() * sizeof(UChar))
    … …  
    7171
    7272IDBKey::IDBKey(const IDBKeyVector& keyArray, size_t arraySize)
    73     : m_type(KeyType::Array)
     73    : m_type(IndexedDB::KeyType::Array)
    7474    , m_value(keyArray)
    7575    , m_sizeEstimate(OverheadSize + arraySize)
    … …  
    7878
    7979IDBKey::IDBKey(const ThreadSafeDataBuffer& buffer)
    80     : m_type(KeyType::Binary)
     80    : m_type(IndexedDB::KeyType::Binary)
    8181    , m_value(buffer)
    8282    , m_sizeEstimate(OverheadSize + buffer.size())
    … …  
    8888bool IDBKey::isValid() const
    8989{
    90     if (m_type == KeyType::Invalid)
     90    if (m_type == IndexedDB::KeyType::Invalid)
    9191        return false;
    9292
    93     if (m_type == KeyType::Array) {
     93    if (m_type == IndexedDB::KeyType::Array) {
    9494        for (auto& key : WTF::get<IDBKeyVector>(m_value)) {
    9595            if (!key->isValid())
    … …  
    107107
    108108    switch (m_type) {
    109     case KeyType::Array: {
     109    case IndexedDB::KeyType::Array: {
    110110        auto& array = WTF::get<IDBKeyVector>(m_value);
    111111        auto& otherArray = WTF::get<IDBKeyVector>(other.m_value);
    … …  
    120120        return 0;
    121121    }
    122     case KeyType::Binary:
     122    case IndexedDB::KeyType::Binary:
    123123        return compareBinaryKeyData(WTF::get<ThreadSafeDataBuffer>(m_value), WTF::get<ThreadSafeDataBuffer>(other.m_value));
    124     case KeyType::String:
     124    case IndexedDB::KeyType::String:
    125125        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: {
    128128        auto number = WTF::get<double>(m_value);
    129129        auto otherNumber = WTF::get<double>(other.m_value);
    130130        return (number < otherNumber) ? -1 : ((number > otherNumber) ? 1 : 0);
    131131    }
    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:
    135135        ASSERT_NOT_REACHED();
    136136        return 0;
  • trunk/Source/WebCore/Modules/indexeddb/IDBKey.h

    r208646 r236007  
    3636#include <wtf/text/WTFString.h>
    3737
    38 using WebCore::IndexedDB::KeyType;
    39 
    4038namespace JSC {
    4139class JSArrayBuffer;
    … …  
    5452    static Ref<IDBKey> createNumber(double number)
    5553    {
    56         return adoptRef(*new IDBKey(KeyType::Number, number));
     54        return adoptRef(*new IDBKey(IndexedDB::KeyType::Number, number));
    5755    }
    5856
    … …  
    6462    static Ref<IDBKey> createDate(double date)
    6563    {
    66         return adoptRef(*new IDBKey(KeyType::Date, date));
     64        return adoptRef(*new IDBKey(IndexedDB::KeyType::Date, date));
    6765    }
    6866
    … …  
    108106    WEBCORE_EXPORT ~IDBKey();
    109107
    110     KeyType type() const { return m_type; }
     108    IndexedDB::KeyType type() const { return m_type; }
    111109    WEBCORE_EXPORT bool isValid() const;
    112110
    113111    const Vector<RefPtr<IDBKey>>& array() const
    114112    {
    115         ASSERT(m_type == KeyType::Array);
     113        ASSERT(m_type == IndexedDB::KeyType::Array);
    116114        return WTF::get<Vector<RefPtr<IDBKey>>>(m_value);
    117115    }
    … …  
    119117    const String& string() const
    120118    {
    121         ASSERT(m_type == KeyType::String);
     119        ASSERT(m_type == IndexedDB::KeyType::String);
    122120        return WTF::get<String>(m_value);
    123121    }
    … …  
    125123    double date() const
    126124    {
    127         ASSERT(m_type == KeyType::Date);
     125        ASSERT(m_type == IndexedDB::KeyType::Date);
    128126        return WTF::get<double>(m_value);
    129127    }
    … …  
    131129    double number() const
    132130    {
    133         ASSERT(m_type == KeyType::Number);
     131        ASSERT(m_type == IndexedDB::KeyType::Number);
    134132        return WTF::get<double>(m_value);
    135133    }
    … …  
    137135    const ThreadSafeDataBuffer& binary() const
    138136    {
    139         ASSERT(m_type == KeyType::Binary);
     137        ASSERT(m_type == IndexedDB::KeyType::Binary);
    140138        return WTF::get<ThreadSafeDataBuffer>(m_value);
    141139    }
    … …  
    147145    size_t sizeEstimate() const { return m_sizeEstimate; }
    148146
    149     static int compareTypes(KeyType a, KeyType b)
     147    static int compareTypes(IndexedDB::KeyType a, IndexedDB::KeyType b)
    150148    {
    151149        return b - a;
    … …  
    161159private:
    162160    IDBKey()
    163         : m_type(KeyType::Invalid)
     161        : m_type(IndexedDB::KeyType::Invalid)
    164162        , m_sizeEstimate(OverheadSize)
    165163    {
    166164    }
    167165
    168     IDBKey(KeyType, double number);
     166    IDBKey(IndexedDB::KeyType, double number);
    169167    explicit IDBKey(const String& value);
    170168    IDBKey(const Vector<RefPtr<IDBKey>>& keyArray, size_t arraySize);
    171169    explicit IDBKey(const ThreadSafeDataBuffer&);
    172170
    173     const KeyType m_type;
     171    const IndexedDB::KeyType m_type;
    174172    Variant<Vector<RefPtr<IDBKey>>, String, double, ThreadSafeDataBuffer> m_value;
    175173
  • trunk/Source/WebCore/Modules/indexeddb/IDBKeyData.cpp

    r234501 r236007  
    3535
    3636IDBKeyData::IDBKeyData(const IDBKey* key)
    37     : m_type(KeyType::Invalid)
     37    : m_type(IndexedDB::KeyType::Invalid)
    3838{
    3939    if (!key) {
    … …  
    4545
    4646    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: {
    5050        m_value = Vector<IDBKeyData>();
    5151        auto& array = WTF::get<Vector<IDBKeyData>>(m_value);
    … …  
    5454        break;
    5555    }
    56     case KeyType::Binary:
     56    case IndexedDB::KeyType::Binary:
    5757        m_value = key->binary();
    5858        break;
    59     case KeyType::String:
     59    case IndexedDB::KeyType::String:
    6060        m_value = key->string();
    6161        break;
    62     case KeyType::Date:
     62    case IndexedDB::KeyType::Date:
    6363        m_value = key->date();
    6464        break;
    65     case KeyType::Number:
     65    case IndexedDB::KeyType::Number:
    6666        m_value = key->number();
    6767        break;
    68     case KeyType::Max:
    69     case KeyType::Min:
     68    case IndexedDB::KeyType::Max:
     69    case IndexedDB::KeyType::Min:
    7070        break;
    7171    }
    … …  
    7878
    7979    switch (m_type) {
    80     case KeyType::Invalid:
     80    case IndexedDB::KeyType::Invalid:
    8181        return IDBKey::createInvalid();
    82     case KeyType::Array: {
     82    case IndexedDB::KeyType::Array: {
    8383        Vector<RefPtr<IDBKey>> array;
    8484        for (auto& keyData : WTF::get<Vector<IDBKeyData>>(m_value)) {
    … …  
    8888        return IDBKey::createArray(array);
    8989    }
    90     case KeyType::Binary:
     90    case IndexedDB::KeyType::Binary:
    9191        return IDBKey::createBinary(WTF::get<ThreadSafeDataBuffer>(m_value));
    92     case KeyType::String:
     92    case IndexedDB::KeyType::String:
    9393        return IDBKey::createString(WTF::get<String>(m_value));
    94     case KeyType::Date:
     94    case IndexedDB::KeyType::Date:
    9595        return IDBKey::createDate(WTF::get<double>(m_value));
    96     case KeyType::Number:
     96    case IndexedDB::KeyType::Number:
    9797        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:
    100100        ASSERT_NOT_REACHED();
    101101        return nullptr;
    … …  
    122122
    123123    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: {
    127127        destination.m_value = Vector<IDBKeyData>();
    128128        auto& destinationArray = WTF::get<Vector<IDBKeyData>>(destination.m_value);
    … …  
    131131        return;
    132132    }
    133     case KeyType::Binary:
     133    case IndexedDB::KeyType::Binary:
    134134        destination.m_value = WTF::get<ThreadSafeDataBuffer>(source.m_value);
    135135        return;
    136     case KeyType::String:
     136    case IndexedDB::KeyType::String:
    137137        destination.m_value = WTF::get<String>(source.m_value).isolatedCopy();
    138138        return;
    139     case KeyType::Date:
    140     case KeyType::Number:
     139    case IndexedDB::KeyType::Date:
     140    case IndexedDB::KeyType::Number:
    141141        destination.m_value = WTF::get<double>(source.m_value);
    142142        return;
    143     case KeyType::Max:
    144     case KeyType::Min:
     143    case IndexedDB::KeyType::Max:
     144    case IndexedDB::KeyType::Min:
    145145        return;
    146146    }
    … …  
    158158
    159159    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: {
    163163        auto& array = WTF::get<Vector<IDBKeyData>>(m_value);
    164164        encoder.encodeObjects("array", array.begin(), array.end(), [](KeyedEncoder& encoder, const IDBKeyData& key) {
    … …  
    167167        return;
    168168    }
    169     case KeyType::Binary: {
     169    case IndexedDB::KeyType::Binary: {
    170170        auto* data = WTF::get<ThreadSafeDataBuffer>(m_value).data();
    171171        encoder.encodeBool("hasBinary", !!data);
    … …  
    174174        return;
    175175    }
    176     case KeyType::String:
     176    case IndexedDB::KeyType::String:
    177177        encoder.encodeString("string", WTF::get<String>(m_value));
    178178        return;
    179     case KeyType::Date:
    180     case KeyType::Number:
     179    case IndexedDB::KeyType::Date:
     180    case IndexedDB::KeyType::Number:
    181181        encoder.encodeDouble("number", WTF::get<double>(m_value));
    182182        return;
    183     case KeyType::Max:
    184     case KeyType::Min:
     183    case IndexedDB::KeyType::Max:
     184    case IndexedDB::KeyType::Min:
    185185        return;
    186186    }
    … …  
    198198
    199199    auto enumFunction = [](int64_t value) {
    200         return value == KeyType::Max
    201             || value == KeyType::Invalid
    202             || value == KeyType::Array
    203             || value == KeyType::Binary
    204             || value == KeyType::String
    205             || value == KeyType::Date
    206             || value == KeyType::Number
    207             || 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;
    208208    };
    209209    if (!decoder.decodeEnum("type", result.m_type, enumFunction))
    210210        return false;
    211211
    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) {
    222222        result.m_value = String();
    223223        return decoder.decodeString("string", WTF::get<String>(result.m_value));
    224224    }
    225225
    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) {
    227227        result.m_value = 0.0;
    228228        return decoder.decodeDouble("number", WTF::get<double>(result.m_value));
    229229    }
    230230
    231     if (result.m_type == KeyType::Binary) {
     231    if (result.m_type == IndexedDB::KeyType::Binary) {
    232232        result.m_value = ThreadSafeDataBuffer();
    233233
    … …  
    247247    }
    248248
    249     ASSERT(result.m_type == KeyType::Array);
     249    ASSERT(result.m_type == IndexedDB::KeyType::Array);
    250250
    251251    auto arrayFunction = [](KeyedDecoder& decoder, IDBKeyData& result) {
    … …  
    259259int IDBKeyData::compare(const IDBKeyData& other) const
    260260{
    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)
    263263            return -1;
    264         if (other.m_type == KeyType::Invalid)
     264        if (other.m_type == IndexedDB::KeyType::Invalid)
    265265            return 0;
    266     } else if (other.m_type == KeyType::Invalid)
     266    } else if (other.m_type == IndexedDB::KeyType::Invalid)
    267267        return 1;
    268268
    … …  
    273273    // The types are the same, so handle actual value comparison.
    274274    switch (m_type) {
    275     case KeyType::Invalid:
     275    case IndexedDB::KeyType::Invalid:
    276276        // Invalid type should have been fully handled above
    277277        ASSERT_NOT_REACHED();
    278278        return 0;
    279     case KeyType::Array: {
     279    case IndexedDB::KeyType::Array: {
    280280        auto& array = WTF::get<Vector<IDBKeyData>>(m_value);
    281281        auto& otherArray = WTF::get<Vector<IDBKeyData>>(other.m_value);
    … …  
    290290        return 0;
    291291    }
    292     case KeyType::Binary:
     292    case IndexedDB::KeyType::Binary:
    293293        return compareBinaryKeyData(WTF::get<ThreadSafeDataBuffer>(m_value), WTF::get<ThreadSafeDataBuffer>(other.m_value));
    294     case KeyType::String:
     294    case IndexedDB::KeyType::String:
    295295        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: {
    298298        auto number = WTF::get<double>(m_value);
    299299        auto otherNumber = WTF::get<double>(other.m_value);
    … …  
    303303        return number > otherNumber ? 1 : -1;
    304304    }
    305     case KeyType::Max:
    306     case KeyType::Min:
     305    case IndexedDB::KeyType::Max:
     306    case IndexedDB::KeyType::Min:
    307307        return 0;
    308308    }
    … …  
    321321
    322322    switch (m_type) {
    323     case KeyType::Invalid:
     323    case IndexedDB::KeyType::Invalid:
    324324        return "<invalid>";
    325     case KeyType::Array: {
     325    case IndexedDB::KeyType::Array: {
    326326        StringBuilder builder;
    327327        builder.appendLiteral("<array> - { ");
    … …  
    336336        break;
    337337    }
    338     case KeyType::Binary: {
     338    case IndexedDB::KeyType::Binary: {
    339339        StringBuilder builder;
    340340        builder.append("<binary> - ");
    … …  
    357357        break;
    358358    }
    359     case KeyType::String:
     359    case IndexedDB::KeyType::String:
    360360        result = "<string> - " + WTF::get<String>(m_value);
    361361        break;
    362     case KeyType::Date:
     362    case IndexedDB::KeyType::Date:
    363363        return String::format("<date> - %f", WTF::get<double>(m_value));
    364     case KeyType::Number:
     364    case IndexedDB::KeyType::Number:
    365365        return String::format("<number> - %f", WTF::get<double>(m_value));
    366     case KeyType::Max:
     366    case IndexedDB::KeyType::Max:
    367367        return "<maximum>";
    368     case KeyType::Min:
     368    case IndexedDB::KeyType::Min:
    369369        return "<minimum>";
    370370    }
    … …  
    383383    *this = IDBKeyData();
    384384    m_value = value;
    385     m_type = KeyType::Array;
     385    m_type = IndexedDB::KeyType::Array;
    386386    m_isNull = false;
    387387}
    … …  
    391391    *this = IDBKeyData();
    392392    m_value = value;
    393     m_type = KeyType::Binary;
     393    m_type = IndexedDB::KeyType::Binary;
    394394    m_isNull = false;
    395395}
    … …  
    399399    *this = IDBKeyData();
    400400    m_value = value;
    401     m_type = KeyType::String;
     401    m_type = IndexedDB::KeyType::String;
    402402    m_isNull = false;
    403403}
    … …  
    407407    *this = IDBKeyData();
    408408    m_value = value;
    409     m_type = KeyType::Date;
     409    m_type = IndexedDB::KeyType::Date;
    410410    m_isNull = false;
    411411}
    … …  
    415415    *this = IDBKeyData();
    416416    m_value = value;
    417     m_type = KeyType::Number;
     417    m_type = IndexedDB::KeyType::Number;
    418418    m_isNull = false;
    419419}
    … …  
    429429bool IDBKeyData::isValid() const
    430430{
    431     if (m_type == KeyType::Invalid)
     431    if (m_type == IndexedDB::KeyType::Invalid)
    432432        return false;
    433433   
    434     if (m_type == KeyType::Array) {
     434    if (m_type == IndexedDB::KeyType::Array) {
    435435        for (auto& key : array()) {
    436436            if (!key.isValid())
    … …  
    452452        return false;
    453453    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:
    460460        return WTF::get<double>(m_value) == WTF::get<double>(other.m_value);
    461     case KeyType::String:
     461    case IndexedDB::KeyType::String:
    462462        return WTF::get<String>(m_value) == WTF::get<String>(other.m_value);
    463     case KeyType::Binary:
     463    case IndexedDB::KeyType::Binary:
    464464        return WTF::get<ThreadSafeDataBuffer>(m_value) == WTF::get<ThreadSafeDataBuffer>(other.m_value);
    465     case KeyType::Array:
     465    case IndexedDB::KeyType::Array:
    466466        return WTF::get<Vector<IDBKeyData>>(m_value) == WTF::get<Vector<IDBKeyData>>(other.m_value);
    467467    }
  • trunk/Source/WebCore/Modules/indexeddb/IDBKeyData.h

    r234125 r236007  
    4141public:
    4242    IDBKeyData()
    43         : m_type(KeyType::Invalid)
     43        : m_type(IndexedDB::KeyType::Invalid)
    4444        , m_isNull(true)
    4545    {
    … …  
    5454    {
    5555        IDBKeyData result;
    56         result.m_type = KeyType::Min;
     56        result.m_type = IndexedDB::KeyType::Min;
    5757        result.m_isNull = false;
    5858        return result;
    … …  
    6262    {
    6363        IDBKeyData result;
    64         result.m_type = KeyType::Max;
     64        result.m_type = IndexedDB::KeyType::Max;
    6565        result.m_isNull = false;
    6666        return result;
    … …  
    9595    bool isNull() const { return m_isNull; }
    9696    bool isValid() const;
    97     KeyType type() const { return m_type; }
     97    IndexedDB::KeyType type() const { return m_type; }
    9898
    9999    bool operator<(const IDBKeyData&) const;
    … …  
    126126        hashCodes.append(m_isDeletedValue ? 1 : 0);
    127127        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:
    134134            hashCodes.append(StringHasher::hashMemory<sizeof(double)>(&WTF::get<double>(m_value)));
    135135            break;
    136         case KeyType::String:
     136        case IndexedDB::KeyType::String:
    137137            hashCodes.append(StringHash::hash(WTF::get<String>(m_value)));
    138138            break;
    139         case KeyType::Binary: {
     139        case IndexedDB::KeyType::Binary: {
    140140            auto* data = WTF::get<ThreadSafeDataBuffer>(m_value).data();
    141141            if (!data)
    … …  
    145145            break;
    146146        }
    147         case KeyType::Array:
     147        case IndexedDB::KeyType::Array:
    148148            for (auto& key : WTF::get<Vector<IDBKeyData>>(m_value))
    149149                hashCodes.append(key.hash());
    … …  
    159159    String string() const
    160160    {
    161         ASSERT(m_type == KeyType::String);
     161        ASSERT(m_type == IndexedDB::KeyType::String);
    162162        return WTF::get<String>(m_value);
    163163    }
    … …  
    165165    double date() const
    166166    {
    167         ASSERT(m_type == KeyType::Date);
     167        ASSERT(m_type == IndexedDB::KeyType::Date);
    168168        return WTF::get<double>(m_value);
    169169    }
    … …  
    171171    double number() const
    172172    {
    173         ASSERT(m_type == KeyType::Number);
     173        ASSERT(m_type == IndexedDB::KeyType::Number);
    174174        return WTF::get<double>(m_value);
    175175    }
    … …  
    177177    const ThreadSafeDataBuffer& binary() const
    178178    {
    179         ASSERT(m_type == KeyType::Binary);
     179        ASSERT(m_type == IndexedDB::KeyType::Binary);
    180180        return WTF::get<ThreadSafeDataBuffer>(m_value);
    181181    }
    … …  
    183183    const Vector<IDBKeyData>& array() const
    184184    {
    185         ASSERT(m_type == KeyType::Array);
     185        ASSERT(m_type == IndexedDB::KeyType::Array);
    186186        return WTF::get<Vector<IDBKeyData>>(m_value);
    187187    }
    … …  
    190190    static void isolatedCopy(const IDBKeyData& source, IDBKeyData& destination);
    191191
    192     KeyType m_type;
     192    IndexedDB::KeyType m_type;
    193193    Variant<Vector<IDBKeyData>, String, double, ThreadSafeDataBuffer> m_value;
    194194
    … …  
    239239
    240240    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:
    246246        encoder << WTF::get<Vector<IDBKeyData>>(m_value);
    247247        break;
    248     case KeyType::Binary:
     248    case IndexedDB::KeyType::Binary:
    249249        encoder << WTF::get<ThreadSafeDataBuffer>(m_value);
    250250        break;
    251     case KeyType::String:
     251    case IndexedDB::KeyType::String:
    252252        encoder << WTF::get<String>(m_value);
    253253        break;
    254     case KeyType::Date:
    255     case KeyType::Number:
     254    case IndexedDB::KeyType::Date:
     255    case IndexedDB::KeyType::Number:
    256256        encoder << WTF::get<double>(m_value);
    257257        break;
    … …  
    273273
    274274    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:
    280280        keyData.m_value = Vector<IDBKeyData>();
    281281        if (!decoder.decode(WTF::get<Vector<IDBKeyData>>(keyData.m_value)))
    282282            return std::nullopt;
    283283        break;
    284     case KeyType::Binary:
     284    case IndexedDB::KeyType::Binary:
    285285        keyData.m_value = ThreadSafeDataBuffer();
    286286        if (!decoder.decode(WTF::get<ThreadSafeDataBuffer>(keyData.m_value)))
    287287            return std::nullopt;
    288288        break;
    289     case KeyType::String:
     289    case IndexedDB::KeyType::String:
    290290        keyData.m_value = String();
    291291        if (!decoder.decode(WTF::get<String>(keyData.m_value)))
    292292            return std::nullopt;
    293293        break;
    294     case KeyType::Date:
    295     case KeyType::Number:
     294    case IndexedDB::KeyType::Date:
     295    case IndexedDB::KeyType::Number:
    296296        keyData.m_value = 0.0;
    297297        if (!decoder.decode(WTF::get<double>(keyData.m_value)))
  • trunk/Source/WebCore/Modules/indexeddb/server/SQLiteIDBBackingStore.cpp

    r234501 r236007  
    22202220    LOG(IndexedDB, "SQLiteIDBBackingStore::uncheckedGetIndexRecordForOneKey");
    22212221
    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);
    22232223
    22242224    RefPtr<SharedBuffer> buffer = serializeIDBKeyData(key);
  • trunk/Source/WebCore/bindings/js/IDBBindingUtilities.cpp

    r229410 r236007  
    9797
    9898    switch (key->type()) {
    99     case KeyType::Array: {
     99    case IndexedDB::KeyType::Array: {
    100100        auto& inArray = key->array();
    101101        unsigned size = inArray.size();
    … …  
    108108        return outArray;
    109109    }
    110     case KeyType::Binary: {
     110    case IndexedDB::KeyType::Binary: {
    111111        auto* data = key->binary().data();
    112112        if (!data) {
    … …  
    122122        return JSArrayBuffer::create(state.vm(), structure, WTFMove(arrayBuffer));
    123123    }
    124     case KeyType::String:
     124    case IndexedDB::KeyType::String:
    125125        return jsStringWithCache(&state, key->string());
    126     case KeyType::Date:
     126    case IndexedDB::KeyType::Date:
    127127        // FIXME: This should probably be toJS<IDLDate>(...) as per:
    128128        // http://w3c.github.io/IndexedDB/#request-convert-a-key-to-a-value
    129129        return toJS<IDLNullable<IDLDate>>(state, key->date());
    130     case KeyType::Number:
     130    case IndexedDB::KeyType::Number:
    131131        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:
    135135        ASSERT_NOT_REACHED();
    136136        return jsUndefined();
Note: See TracChangeset for help on using the changeset viewer.