Make IDBKeyData from a struct to a class.
authorbeidson@apple.com <beidson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 27 Oct 2015 05:22:55 +0000 (05:22 +0000)
committerbeidson@apple.com <beidson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 27 Oct 2015 05:22:55 +0000 (05:22 +0000)
https://bugs.webkit.org/show_bug.cgi?id=150576

Reviewed by Alex Christensen.

Source/WebCore:

No new tests (No change in behavior).

* Modules/indexeddb/IDBKeyData.cpp:
(WebCore::IDBKeyData::IDBKeyData):
(WebCore::IDBKeyData::maybeCreateIDBKey):
(WebCore::IDBKeyData::isolatedCopy):
(WebCore::IDBKeyData::encode):
(WebCore::IDBKeyData::decode):
(WebCore::IDBKeyData::compare):
(WebCore::IDBKeyData::loggingString):
(WebCore::IDBKeyData::setArrayValue):
(WebCore::IDBKeyData::setStringValue):
(WebCore::IDBKeyData::setDateValue):
(WebCore::IDBKeyData::setNumberValue):
* Modules/indexeddb/IDBKeyData.h:
(WebCore::IDBKeyData::IDBKeyData):
(WebCore::IDBKeyData::minimum):
(WebCore::IDBKeyData::maximum):
(WebCore::IDBKeyData::isNull):
(WebCore::IDBKeyData::type):
(WebCore::IDBKeyData::encode):
(WebCore::IDBKeyData::decode):
* Modules/indexeddb/legacy/IDBTransactionBackendOperations.cpp:
(WebCore::GetOperation::perform):
* bindings/js/IDBBindingUtilities.h:
* platform/CrossThreadCopier.h:

Source/WebKit2:

* DatabaseProcess/IndexedDB/DatabaseProcessIDBConnection.h:
* DatabaseProcess/IndexedDB/DatabaseProcessIDBConnection.messages.in:
* DatabaseProcess/IndexedDB/IDBSerialization.h:
* DatabaseProcess/IndexedDB/UniqueIDBDatabase.cpp:
(WebKit::UniqueIDBDatabase::putRecordInBackingStore):
* DatabaseProcess/IndexedDB/UniqueIDBDatabase.h:
* DatabaseProcess/IndexedDB/UniqueIDBDatabaseBackingStore.h:
* DatabaseProcess/IndexedDB/sqlite/SQLiteIDBCursor.cpp:
(WebKit::buildIndexStatement):
(WebKit::buildObjectStoreStatement):
(WebKit::SQLiteIDBCursor::establishStatement):
(WebKit::SQLiteIDBCursor::createSQLiteStatement):
(WebKit::SQLiteIDBCursor::resetAndRebindStatement):
(WebKit::SQLiteIDBCursor::iterate):
* DatabaseProcess/IndexedDB/sqlite/UniqueIDBDatabaseBackingStoreSQLite.cpp:
(WebKit::UniqueIDBDatabaseBackingStoreSQLite::createIndex):
* WebProcess/Databases/IndexedDB/WebIDBServerConnection.cpp:
(WebKit::WebIDBServerConnection::didPutRecord):
* WebProcess/Databases/IndexedDB/WebIDBServerConnection.h:
* WebProcess/Databases/IndexedDB/WebIDBServerConnection.messages.in:

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

18 files changed:
Source/WebCore/ChangeLog
Source/WebCore/Modules/indexeddb/IDBKeyData.cpp
Source/WebCore/Modules/indexeddb/IDBKeyData.h
Source/WebCore/Modules/indexeddb/legacy/IDBTransactionBackendOperations.cpp
Source/WebCore/bindings/js/IDBBindingUtilities.h
Source/WebCore/platform/CrossThreadCopier.h
Source/WebKit2/ChangeLog
Source/WebKit2/DatabaseProcess/IndexedDB/DatabaseProcessIDBConnection.h
Source/WebKit2/DatabaseProcess/IndexedDB/DatabaseProcessIDBConnection.messages.in
Source/WebKit2/DatabaseProcess/IndexedDB/IDBSerialization.h
Source/WebKit2/DatabaseProcess/IndexedDB/UniqueIDBDatabase.cpp
Source/WebKit2/DatabaseProcess/IndexedDB/UniqueIDBDatabase.h
Source/WebKit2/DatabaseProcess/IndexedDB/UniqueIDBDatabaseBackingStore.h
Source/WebKit2/DatabaseProcess/IndexedDB/sqlite/SQLiteIDBCursor.cpp
Source/WebKit2/DatabaseProcess/IndexedDB/sqlite/UniqueIDBDatabaseBackingStoreSQLite.cpp
Source/WebKit2/WebProcess/Databases/IndexedDB/WebIDBServerConnection.cpp
Source/WebKit2/WebProcess/Databases/IndexedDB/WebIDBServerConnection.h
Source/WebKit2/WebProcess/Databases/IndexedDB/WebIDBServerConnection.messages.in

index e3eaef8..7d9bd9b 100644 (file)
@@ -1,3 +1,37 @@
+2015-10-26  Brady Eidson  <beidson@apple.com>
+
+        Make IDBKeyData from a struct to a class.
+        https://bugs.webkit.org/show_bug.cgi?id=150576
+
+        Reviewed by Alex Christensen.
+
+        No new tests (No change in behavior).
+
+        * Modules/indexeddb/IDBKeyData.cpp:
+        (WebCore::IDBKeyData::IDBKeyData):
+        (WebCore::IDBKeyData::maybeCreateIDBKey):
+        (WebCore::IDBKeyData::isolatedCopy):
+        (WebCore::IDBKeyData::encode):
+        (WebCore::IDBKeyData::decode):
+        (WebCore::IDBKeyData::compare):
+        (WebCore::IDBKeyData::loggingString):
+        (WebCore::IDBKeyData::setArrayValue):
+        (WebCore::IDBKeyData::setStringValue):
+        (WebCore::IDBKeyData::setDateValue):
+        (WebCore::IDBKeyData::setNumberValue):
+        * Modules/indexeddb/IDBKeyData.h:
+        (WebCore::IDBKeyData::IDBKeyData):
+        (WebCore::IDBKeyData::minimum):
+        (WebCore::IDBKeyData::maximum):
+        (WebCore::IDBKeyData::isNull):
+        (WebCore::IDBKeyData::type):
+        (WebCore::IDBKeyData::encode):
+        (WebCore::IDBKeyData::decode):
+        * Modules/indexeddb/legacy/IDBTransactionBackendOperations.cpp:
+        (WebCore::GetOperation::perform):
+        * bindings/js/IDBBindingUtilities.h:
+        * platform/CrossThreadCopier.h:
+
 2015-10-26  Philip Chimento  <philip.chimento@gmail.com>
 
         [GTK] [Stable] Build GL texture mapper only if USE_TEXTURE_MAPPER_GL
index 6230d3f..92c301f 100644 (file)
 namespace WebCore {
 
 IDBKeyData::IDBKeyData(const IDBKey* key)
-    : type(KeyType::Invalid)
-    , numberValue(0)
-    , isNull(false)
+    : m_type(KeyType::Invalid)
 {
     if (!key) {
-        isNull = true;
+        m_isNull = true;
         return;
     }
 
-    type = key->type();
-    numberValue = 0;
+    m_type = key->type();
 
-    switch (type) {
+    switch (m_type) {
     case KeyType::Invalid:
         break;
     case KeyType::Array:
         for (auto& key2 : key->array())
-            arrayValue.append(IDBKeyData(key2.get()));
+            m_arrayValue.append(IDBKeyData(key2.get()));
         break;
     case KeyType::String:
-        stringValue = key->string();
+        m_stringValue = key->string();
         break;
     case KeyType::Date:
-        numberValue = key->date();
+        m_numberValue = key->date();
         break;
     case KeyType::Number:
-        numberValue = key->number();
+        m_numberValue = key->number();
         break;
     case KeyType::Max:
     case KeyType::Min:
@@ -70,27 +67,27 @@ IDBKeyData::IDBKeyData(const IDBKey* key)
 
 PassRefPtr<IDBKey> IDBKeyData::maybeCreateIDBKey() const
 {
-    if (isNull)
+    if (m_isNull)
         return nullptr;
 
-    switch (type) {
+    switch (m_type) {
     case KeyType::Invalid:
         return IDBKey::createInvalid();
     case KeyType::Array:
         {
             Vector<RefPtr<IDBKey>> array;
-            for (auto& keyData : arrayValue) {
+            for (auto& keyData : m_arrayValue) {
                 array.append(keyData.maybeCreateIDBKey());
                 ASSERT(array.last());
             }
             return IDBKey::createArray(array);
         }
     case KeyType::String:
-        return IDBKey::createString(stringValue);
+        return IDBKey::createString(m_stringValue);
     case KeyType::Date:
-        return IDBKey::createDate(numberValue);
+        return IDBKey::createDate(m_numberValue);
     case KeyType::Number:
-        return IDBKey::createNumber(numberValue);
+        return IDBKey::createNumber(m_numberValue);
     case KeyType::Max:
     case KeyType::Min:
         ASSERT_NOT_REACHED();
@@ -104,22 +101,22 @@ PassRefPtr<IDBKey> IDBKeyData::maybeCreateIDBKey() const
 IDBKeyData IDBKeyData::isolatedCopy() const
 {
     IDBKeyData result;
-    result.type = type;
-    result.isNull = isNull;
+    result.m_type = m_type;
+    result.m_isNull = m_isNull;
 
-    switch (type) {
+    switch (m_type) {
     case KeyType::Invalid:
         return result;
     case KeyType::Array:
-        for (auto& key : arrayValue)
-            result.arrayValue.append(key.isolatedCopy());
+        for (auto& key : m_arrayValue)
+            result.m_arrayValue.append(key.isolatedCopy());
         return result;
     case KeyType::String:
-        result.stringValue = stringValue.isolatedCopy();
+        result.m_stringValue = m_stringValue.isolatedCopy();
         return result;
     case KeyType::Date:
     case KeyType::Number:
-        result.numberValue = numberValue;
+        result.m_numberValue = m_numberValue;
         return result;
     case KeyType::Max:
     case KeyType::Min:
@@ -132,26 +129,26 @@ IDBKeyData IDBKeyData::isolatedCopy() const
 
 void IDBKeyData::encode(KeyedEncoder& encoder) const
 {
-    encoder.encodeBool("null", isNull);
-    if (isNull)
+    encoder.encodeBool("null", m_isNull);
+    if (m_isNull)
         return;
 
-    encoder.encodeEnum("type", type);
+    encoder.encodeEnum("m_type", m_type);
 
-    switch (type) {
+    switch (m_type) {
     case KeyType::Invalid:
         return;
     case KeyType::Array:
-        encoder.encodeObjects("array", arrayValue.begin(), arrayValue.end(), [](KeyedEncoder& encoder, const IDBKeyData& key) {
+        encoder.encodeObjects("array", m_arrayValue.begin(), m_arrayValue.end(), [](KeyedEncoder& encoder, const IDBKeyData& key) {
             key.encode(encoder);
         });
         return;
     case KeyType::String:
-        encoder.encodeString("string", stringValue);
+        encoder.encodeString("string", m_stringValue);
         return;
     case KeyType::Date:
     case KeyType::Number:
-        encoder.encodeDouble("number", numberValue);
+        encoder.encodeDouble("number", m_numberValue);
         return;
     case KeyType::Max:
     case KeyType::Min:
@@ -163,10 +160,10 @@ void IDBKeyData::encode(KeyedEncoder& encoder) const
 
 bool IDBKeyData::decode(KeyedDecoder& decoder, IDBKeyData& result)
 {
-    if (!decoder.decodeBool("null", result.isNull))
+    if (!decoder.decodeBool("null", result.m_isNull))
         return false;
 
-    if (result.isNull)
+    if (result.m_isNull)
         return true;
 
     auto enumFunction = [](int64_t value) {
@@ -178,71 +175,71 @@ bool IDBKeyData::decode(KeyedDecoder& decoder, IDBKeyData& result)
             || value == KeyType::Number
             || value == KeyType::Min;
     };
-    if (!decoder.decodeEnum("type", result.type, enumFunction))
+    if (!decoder.decodeEnum("m_type", result.m_type, enumFunction))
         return false;
 
-    if (result.type == KeyType::Invalid)
+    if (result.m_type == KeyType::Invalid)
         return true;
 
-    if (result.type == KeyType::Max)
+    if (result.m_type == KeyType::Max)
         return true;
 
-    if (result.type == KeyType::Min)
+    if (result.m_type == KeyType::Min)
         return true;
 
-    if (result.type == KeyType::String)
-        return decoder.decodeString("string", result.stringValue);
+    if (result.m_type == KeyType::String)
+        return decoder.decodeString("string", result.m_stringValue);
 
-    if (result.type == KeyType::Number || result.type == KeyType::Date)
-        return decoder.decodeDouble("number", result.numberValue);
+    if (result.m_type == KeyType::Number || result.m_type == KeyType::Date)
+        return decoder.decodeDouble("number", result.m_numberValue);
 
-    ASSERT(result.type == KeyType::Array);
+    ASSERT(result.m_type == KeyType::Array);
 
     auto arrayFunction = [](KeyedDecoder& decoder, IDBKeyData& result) {
         return decode(decoder, result);
     };
     
-    result.arrayValue.clear();
-    return decoder.decodeObjects("array", result.arrayValue, arrayFunction);
+    result.m_arrayValue.clear();
+    return decoder.decodeObjects("array", result.m_arrayValue, arrayFunction);
 }
 
 int IDBKeyData::compare(const IDBKeyData& other) const
 {
-    if (type == KeyType::Invalid) {
-        if (other.type != KeyType::Invalid)
+    if (m_type == KeyType::Invalid) {
+        if (other.m_type != KeyType::Invalid)
             return -1;
-        if (other.type == KeyType::Invalid)
+        if (other.m_type == KeyType::Invalid)
             return 0;
-    } else if (other.type == KeyType::Invalid)
+    } else if (other.m_type == KeyType::Invalid)
         return 1;
 
-    // The IDBKey::Type enum is in reverse sort order.
-    if (type != other.type)
-        return type < other.type ? 1 : -1;
+    // The IDBKey::m_type enum is in reverse sort order.
+    if (m_type != other.m_type)
+        return m_type < other.m_type ? 1 : -1;
 
     // The types are the same, so handle actual value comparison.
-    switch (type) {
+    switch (m_type) {
     case KeyType::Invalid:
-        // InvalidType should have been fully handled above
+        // Invalid type should have been fully handled above
         ASSERT_NOT_REACHED();
         return 0;
     case KeyType::Array:
-        for (size_t i = 0; i < arrayValue.size() && i < other.arrayValue.size(); ++i) {
-            if (int result = arrayValue[i].compare(other.arrayValue[i]))
+        for (size_t i = 0; i < m_arrayValue.size() && i < other.m_arrayValue.size(); ++i) {
+            if (int result = m_arrayValue[i].compare(other.m_arrayValue[i]))
                 return result;
         }
-        if (arrayValue.size() < other.arrayValue.size())
+        if (m_arrayValue.size() < other.m_arrayValue.size())
             return -1;
-        if (arrayValue.size() > other.arrayValue.size())
+        if (m_arrayValue.size() > other.m_arrayValue.size())
             return 1;
         return 0;
     case KeyType::String:
-        return codePointCompare(stringValue, other.stringValue);
+        return codePointCompare(m_stringValue, other.m_stringValue);
     case KeyType::Date:
     case KeyType::Number:
-        if (numberValue == other.numberValue)
+        if (m_numberValue == other.m_numberValue)
             return 0;
-        return numberValue > other.numberValue ? 1 : -1;
+        return m_numberValue > other.m_numberValue ? 1 : -1;
     case KeyType::Max:
     case KeyType::Min:
         return 0;
@@ -255,30 +252,30 @@ int IDBKeyData::compare(const IDBKeyData& other) const
 #ifndef NDEBUG
 String IDBKeyData::loggingString() const
 {
-    if (isNull)
+    if (m_isNull)
         return "<null>";
 
-    switch (type) {
+    switch (m_type) {
     case KeyType::Invalid:
         return "<invalid>";
     case KeyType::Array:
         {
             StringBuilder result;
             result.appendLiteral("<array> - { ");
-            for (size_t i = 0; i < arrayValue.size(); ++i) {
-                result.append(arrayValue[i].loggingString());
-                if (i < arrayValue.size() - 1)
+            for (size_t i = 0; i < m_arrayValue.size(); ++i) {
+                result.append(m_arrayValue[i].loggingString());
+                if (i < m_arrayValue.size() - 1)
                     result.appendLiteral(", ");
             }
             result.appendLiteral(" }");
             return result.toString();
         }
     case KeyType::String:
-        return "<string> - " + stringValue;
+        return "<string> - " + m_stringValue;
     case KeyType::Date:
-        return String::format("Date type - %f", numberValue);
+        return String::format("Date m_type - %f", m_numberValue);
     case KeyType::Number:
-        return String::format("<number> - %f", numberValue);
+        return String::format("<number> - %f", m_numberValue);
     case KeyType::Max:
         return "<maximum>";
     case KeyType::Min:
@@ -293,33 +290,33 @@ String IDBKeyData::loggingString() const
 void IDBKeyData::setArrayValue(const Vector<IDBKeyData>& value)
 {
     *this = IDBKeyData();
-    arrayValue = value;
-    type = KeyType::Array;
-    isNull = false;
+    m_arrayValue = value;
+    m_type = KeyType::Array;
+    m_isNull = false;
 }
 
 void IDBKeyData::setStringValue(const String& value)
 {
     *this = IDBKeyData();
-    stringValue = value;
-    type = KeyType::String;
-    isNull = false;
+    m_stringValue = value;
+    m_type = KeyType::String;
+    m_isNull = false;
 }
 
 void IDBKeyData::setDateValue(double value)
 {
     *this = IDBKeyData();
-    numberValue = value;
-    type = KeyType::Date;
-    isNull = false;
+    m_numberValue = value;
+    m_type = KeyType::Date;
+    m_isNull = false;
 }
 
 void IDBKeyData::setNumberValue(double value)
 {
     *this = IDBKeyData();
-    numberValue = value;
-    type = KeyType::Number;
-    isNull = false;
+    m_numberValue = value;
+    m_type = KeyType::Number;
+    m_isNull = false;
 }
 
 }
index 6c84e42..91563b2 100644 (file)
@@ -35,11 +35,11 @@ namespace WebCore {
 class KeyedDecoder;
 class KeyedEncoder;
 
-struct IDBKeyData {
+class IDBKeyData {
+public:
     IDBKeyData()
-        : type(KeyType::Invalid)
-        , numberValue(0)
-        , isNull(true)
+        : m_type(KeyType::Invalid)
+        , m_isNull(true)
     {
     }
 
@@ -48,16 +48,16 @@ struct IDBKeyData {
     static IDBKeyData minimum()
     {
         IDBKeyData result;
-        result.type = KeyType::Min;
-        result.isNull = false;
+        result.m_type = KeyType::Min;
+        result.m_isNull = false;
         return result;
     }
 
     static IDBKeyData maximum()
     {
         IDBKeyData result;
-        result.type = KeyType::Max;
-        result.isNull = false;
+        result.m_type = KeyType::Max;
+        result.m_isNull = false;
         return result;
     }
 
@@ -86,34 +86,38 @@ struct IDBKeyData {
     WEBCORE_EXPORT String loggingString() const;
 #endif
 
-    KeyType type;
-    Vector<IDBKeyData> arrayValue;
-    String stringValue;
-    double numberValue;
-    bool isNull;
+    bool isNull() const { return m_isNull; }
+    KeyType type() const { return m_type; }
+
+private:
+    KeyType m_type;
+    Vector<IDBKeyData> m_arrayValue;
+    String m_stringValue;
+    double m_numberValue { 0 };
+    bool m_isNull { false };
 };
 
 template<class Encoder>
 void IDBKeyData::encode(Encoder& encoder) const
 {
-    encoder << isNull;
-    if (isNull)
+    encoder << m_isNull;
+    if (m_isNull)
         return;
 
-    encoder.encodeEnum(type);
+    encoder.encodeEnum(m_type);
 
-    switch (type) {
+    switch (m_type) {
     case KeyType::Invalid:
         break;
     case KeyType::Array:
-        encoder << arrayValue;
+        encoder << m_arrayValue;
         break;
     case KeyType::String:
-        encoder << stringValue;
+        encoder << m_stringValue;
         break;
     case KeyType::Date:
     case KeyType::Number:
-        encoder << numberValue;
+        encoder << m_numberValue;
         break;
     case KeyType::Max:
     case KeyType::Min:
@@ -127,29 +131,29 @@ void IDBKeyData::encode(Encoder& encoder) const
 template<class Decoder>
 bool IDBKeyData::decode(Decoder& decoder, IDBKeyData& keyData)
 {
-    if (!decoder.decode(keyData.isNull))
+    if (!decoder.decode(keyData.m_isNull))
         return false;
 
-    if (keyData.isNull)
+    if (keyData.m_isNull)
         return true;
 
-    if (!decoder.decodeEnum(keyData.type))
+    if (!decoder.decodeEnum(keyData.m_type))
         return false;
 
-    switch (keyData.type) {
+    switch (keyData.m_type) {
     case KeyType::Invalid:
         break;
     case KeyType::Array:
-        if (!decoder.decode(keyData.arrayValue))
+        if (!decoder.decode(keyData.m_arrayValue))
             return false;
         break;
     case KeyType::String:
-        if (!decoder.decode(keyData.stringValue))
+        if (!decoder.decode(keyData.m_stringValue))
             return false;
         break;
     case KeyType::Date:
     case KeyType::Number:
-        if (!decoder.decode(keyData.numberValue))
+        if (!decoder.decode(keyData.m_numberValue))
             return false;
         break;
     case KeyType::Max:
index d4f687a..b0f6e10 100644 (file)
@@ -101,12 +101,12 @@ void GetOperation::perform(std::function<void()> completionCallback)
             m_callbacks->onError(error);
         else {
             if (!result.valueBuffer) {
-                if (result.keyData.isNull)
+                if (result.keyData.isNull())
                     m_callbacks->onSuccess();
                 else
                     m_callbacks->onSuccess(result.keyData.maybeCreateIDBKey());
             } else {
-                if (!result.keyData.isNull)
+                if (!result.keyData.isNull())
                     m_callbacks->onSuccess(result.valueBuffer, result.keyData.maybeCreateIDBKey(), result.keyPath);
                 else
                     m_callbacks->onSuccess(result.valueBuffer.get());
index aeeac60..bbd1066 100644 (file)
@@ -40,7 +40,7 @@ class IDBKeyPath;
 class SharedBuffer;
 
 struct IDBIndexMetadata;
-struct IDBKeyData;
+class IDBKeyData;
 
 IDBKeyPath idbKeyPathFromValue(JSC::ExecState*, JSC::JSValue);
 
index be0a73a..abf906b 100644 (file)
@@ -173,7 +173,7 @@ namespace WebCore {
         static Type copy(const IDBIndexMetadata&);
     };
 
-    struct IDBKeyData;
+    class IDBKeyData;
     template<> struct WEBCORE_EXPORT CrossThreadCopierBase<false, false, IDBKeyData> {
         typedef IDBKeyData Type;
         static Type copy(const IDBKeyData&);
index f0176bd..bf288ce 100644 (file)
@@ -1,3 +1,31 @@
+2015-10-26  Brady Eidson  <beidson@apple.com>
+
+        Make IDBKeyData from a struct to a class.
+        https://bugs.webkit.org/show_bug.cgi?id=150576
+
+        Reviewed by Alex Christensen.
+
+        * DatabaseProcess/IndexedDB/DatabaseProcessIDBConnection.h:
+        * DatabaseProcess/IndexedDB/DatabaseProcessIDBConnection.messages.in:
+        * DatabaseProcess/IndexedDB/IDBSerialization.h:
+        * DatabaseProcess/IndexedDB/UniqueIDBDatabase.cpp:
+        (WebKit::UniqueIDBDatabase::putRecordInBackingStore):
+        * DatabaseProcess/IndexedDB/UniqueIDBDatabase.h:
+        * DatabaseProcess/IndexedDB/UniqueIDBDatabaseBackingStore.h:
+        * DatabaseProcess/IndexedDB/sqlite/SQLiteIDBCursor.cpp:
+        (WebKit::buildIndexStatement):
+        (WebKit::buildObjectStoreStatement):
+        (WebKit::SQLiteIDBCursor::establishStatement):
+        (WebKit::SQLiteIDBCursor::createSQLiteStatement):
+        (WebKit::SQLiteIDBCursor::resetAndRebindStatement):
+        (WebKit::SQLiteIDBCursor::iterate):
+        * DatabaseProcess/IndexedDB/sqlite/UniqueIDBDatabaseBackingStoreSQLite.cpp:
+        (WebKit::UniqueIDBDatabaseBackingStoreSQLite::createIndex):
+        * WebProcess/Databases/IndexedDB/WebIDBServerConnection.cpp:
+        (WebKit::WebIDBServerConnection::didPutRecord):
+        * WebProcess/Databases/IndexedDB/WebIDBServerConnection.h:
+        * WebProcess/Databases/IndexedDB/WebIDBServerConnection.messages.in:
+
 2015-10-26  Philip Chimento  <philip.chimento@gmail.com>
 
         [GTK] [Stable] InstallMissingMediaPluginsPermissionRequest not defined when building without GStreamer
index 504e7bd..23aa52b 100644 (file)
@@ -43,12 +43,12 @@ messages -> DatabaseProcessIDBConnection LegacyReceiver {
     CreateIndex(uint64_t requestID, int64_t transactionID, int64_t objectStoreID, struct WebCore::IDBIndexMetadata indexMetadata)
     DeleteIndex(uint64_t requestID, int64_t transactionID, int64_t objectStoreID, int64_t indexID)
 
-    PutRecord(uint64_t requestID, int64_t transactionID, int64_t objectStoreID, struct WebCore::IDBKeyData key, IPC::DataReference value, int64_t putMode, Vector<int64_t> indexIDs, Vector<Vector<WebCore::IDBKeyData>> indexKeys)
+    PutRecord(uint64_t requestID, int64_t transactionID, int64_t objectStoreID, WebCore::IDBKeyData key, IPC::DataReference value, int64_t putMode, Vector<int64_t> indexIDs, Vector<Vector<WebCore::IDBKeyData>> indexKeys)
     GetRecord(uint64_t requestID, int64_t transactionID, int64_t objectStoreID, int64_t indexID, struct WebCore::IDBKeyRangeData keyRange, int64_t cursorType)
     
     OpenCursor(uint64_t requestID, int64_t transactionID, int64_t objectStoreID, int64_t indexID, int64_t cursorDirection, int64_t cursorType, int64_t taskType, struct WebCore::IDBKeyRangeData keyRange)
     CursorAdvance(uint64_t requestID, int64_t cursorID, uint64_t count)
-    CursorIterate(uint64_t requestID, int64_t cursorID, struct WebCore::IDBKeyData key)
+    CursorIterate(uint64_t requestID, int64_t cursorID, WebCore::IDBKeyData key)
     
     Count(uint64_t requestID, int64_t transactionID, int64_t objectStoreID, int64_t indexID, struct WebCore::IDBKeyRangeData keyRange)
     DeleteRange(uint64_t requestID, int64_t transactionID, int64_t objectStoreID, struct WebCore::IDBKeyRangeData keyRange)
index 96dc8e3..c286f8d 100644 (file)
@@ -32,9 +32,8 @@
 #include <wtf/Vector.h>
 
 namespace WebCore {
+class IDBKeyData;
 class IDBKeyPath;
-
-struct IDBKeyData;
 }
 
 namespace WebKit {
index ba0a874..f083a76 100644 (file)
@@ -829,7 +829,7 @@ void UniqueIDBDatabase::putRecordInBackingStore(uint64_t requestID, const IDBIde
     IDBKeyData key;
     int64_t keyNumber = 0;
 
-    if (putMode != IDBDatabaseBackend::CursorUpdate && objectStoreMetadata.autoIncrement && inputKeyData.isNull) {
+    if (putMode != IDBDatabaseBackend::CursorUpdate && objectStoreMetadata.autoIncrement && inputKeyData.isNull()) {
         if (!m_backingStore->generateKeyNumber(transaction, objectStoreMetadata.id, keyNumber)) {
             postMainThreadTask(createCrossThreadTask(*this, &UniqueIDBDatabase::didPutRecordInBackingStore, requestID, IDBKeyData(), IDBDatabaseException::UnknownError, ASCIILiteral("Internal backing store error checking for key existence")));
             return;
@@ -875,7 +875,7 @@ void UniqueIDBDatabase::putRecordInBackingStore(uint64_t requestID, const IDBIde
 
     m_backingStore->notifyCursorsOfChanges(transaction, objectStoreMetadata.id);
 
-    if (putMode != IDBDatabaseBackend::CursorUpdate && objectStoreMetadata.autoIncrement && key.type == KeyType::Number) {
+    if (putMode != IDBDatabaseBackend::CursorUpdate && objectStoreMetadata.autoIncrement && key.type() == KeyType::Number) {
         if (!m_backingStore->updateKeyGeneratorNumber(transaction, objectStoreMetadata.id, keyNumber, keyWasGenerated)) {
             postMainThreadTask(createCrossThreadTask(*this, &UniqueIDBDatabase::didPutRecordInBackingStore, requestID, IDBKeyData(), IDBDatabaseException::UnknownError, ASCIILiteral("Internal backing store error updating key generator")));
             return;
index 445e2a8..81d91a3 100644 (file)
@@ -46,11 +46,11 @@ class DataReference;
 
 namespace WebCore {
 class CrossThreadTask;
+class IDBKeyData;
 class SharedBuffer;
 
 struct IDBDatabaseMetadata;
 struct IDBGetResult;
-struct IDBKeyData;
 struct IDBKeyRangeData;
 struct SecurityOriginData;
 }
index 1fb9ab7..c9afd7b 100644 (file)
 
 namespace WebCore {
 class IDBKey;
+class IDBKeyData;
 class IDBKeyRange;
 class SharedBuffer;
 
 struct IDBDatabaseMetadata;
 struct IDBGetResult;
-struct IDBKeyData;
 struct IDBObjectStoreMetadata;
 }
 
index bff4852..2484923 100644 (file)
@@ -72,13 +72,13 @@ static String buildIndexStatement(const IDBKeyRangeData& keyRange, IndexedDB::Cu
     StringBuilder builder;
 
     builder.appendLiteral("SELECT rowid, key, value FROM IndexRecords WHERE indexID = ? AND key ");
-    if (!keyRange.lowerKey.isNull && !keyRange.lowerOpen)
+    if (!keyRange.lowerKey.isNull() && !keyRange.lowerOpen)
         builder.appendLiteral(">=");
     else
         builder.append('>');
 
     builder.appendLiteral(" CAST(? AS TEXT) AND key ");
-    if (!keyRange.upperKey.isNull && !keyRange.upperOpen)
+    if (!keyRange.upperKey.isNull() && !keyRange.upperOpen)
         builder.appendLiteral("<=");
     else
         builder.append('<');
@@ -102,14 +102,14 @@ static String buildObjectStoreStatement(const IDBKeyRangeData& keyRange, Indexed
 
     builder.appendLiteral("SELECT rowid, key, value FROM Records WHERE objectStoreID = ? AND key ");
 
-    if (!keyRange.lowerKey.isNull && !keyRange.lowerOpen)
+    if (!keyRange.lowerKey.isNull() && !keyRange.lowerOpen)
         builder.appendLiteral(">=");
     else
         builder.append('>');
 
     builder.appendLiteral(" CAST(? AS TEXT) AND key ");
 
-    if (!keyRange.upperKey.isNull && !keyRange.upperOpen)
+    if (!keyRange.upperKey.isNull() && !keyRange.upperOpen)
         builder.appendLiteral("<=");
     else
         builder.append('<');
@@ -137,8 +137,8 @@ bool SQLiteIDBCursor::establishStatement()
         m_boundID = m_objectStoreID;
     }
 
-    m_currentLowerKey = m_keyRange.lowerKey.isNull ? IDBKeyData::minimum() : m_keyRange.lowerKey;
-    m_currentUpperKey = m_keyRange.upperKey.isNull ? IDBKeyData::maximum() : m_keyRange.upperKey;
+    m_currentLowerKey = m_keyRange.lowerKey.isNull() ? IDBKeyData::minimum() : m_keyRange.lowerKey;
+    m_currentUpperKey = m_keyRange.upperKey.isNull() ? IDBKeyData::maximum() : m_keyRange.upperKey;
 
     return createSQLiteStatement(sql);
 }
@@ -147,8 +147,8 @@ bool SQLiteIDBCursor::createSQLiteStatement(const String& sql)
 {
     LOG(IDB, "Creating cursor with SQL query: \"%s\"", sql.utf8().data());
 
-    ASSERT(!m_currentLowerKey.isNull);
-    ASSERT(!m_currentUpperKey.isNull);
+    ASSERT(!m_currentLowerKey.isNull());
+    ASSERT(!m_currentUpperKey.isNull());
     ASSERT(m_transaction->sqliteTransaction());
 
     m_statement = std::make_unique<SQLiteStatement>(m_transaction->sqliteTransaction()->database(), sql);
@@ -171,8 +171,8 @@ void SQLiteIDBCursor::objectStoreRecordsChanged()
 
 void SQLiteIDBCursor::resetAndRebindStatement()
 {
-    ASSERT(!m_currentLowerKey.isNull);
-    ASSERT(!m_currentUpperKey.isNull);
+    ASSERT(!m_currentLowerKey.isNull());
+    ASSERT(!m_currentUpperKey.isNull());
     ASSERT(m_transaction->sqliteTransaction());
     ASSERT(m_statement);
     ASSERT(m_statementNeedsReset);
@@ -180,7 +180,7 @@ void SQLiteIDBCursor::resetAndRebindStatement()
     m_statementNeedsReset = false;
 
     // If this cursor never fetched any records, we don't need to reset the statement.
-    if (m_currentKey.isNull)
+    if (m_currentKey.isNull())
         return;
 
     // Otherwise update the lower key or upper key used for the cursor range.
@@ -368,7 +368,7 @@ bool SQLiteIDBCursor::iterate(const WebCore::IDBKeyData& targetKey)
     bool result = advance(1);
 
     // Iterating with no key is equivalent to advancing 1 step.
-    if (targetKey.isNull || !result)
+    if (targetKey.isNull() || !result)
         return result;
 
     while (!m_completed) {
index 8f0bcff..335d5d5 100644 (file)
@@ -762,7 +762,7 @@ bool UniqueIDBDatabaseBackingStoreSQLite::createIndex(const IDBIdentifier& trans
     m_cursors.set(cursor->identifier(), cursor);
 
     std::unique_ptr<JSLockHolder> locker;
-    while (!cursor->currentKey().isNull) {
+    while (!cursor->currentKey().isNull()) {
         const IDBKeyData& key = cursor->currentKey();
         const Vector<uint8_t>& valueBuffer = cursor->currentValueBuffer();
 
index b761eb2..b780ce3 100644 (file)
@@ -454,7 +454,7 @@ void WebIDBServerConnection::didPutRecord(uint64_t requestID, const WebCore::IDB
     if (!serverRequest)
         return;
 
-    serverRequest->completeRequest(resultKey.isNull ? nullptr : resultKey.maybeCreateIDBKey(), errorCode ? IDBDatabaseError::create(errorCode, errorMessage) : nullptr);
+    serverRequest->completeRequest(resultKey.isNull() ? nullptr : resultKey.maybeCreateIDBKey(), errorCode ? IDBDatabaseError::create(errorCode, errorMessage) : nullptr);
 }
 
 void WebIDBServerConnection::didGetRecord(uint64_t requestID, const WebCore::IDBGetResult& getResult, uint32_t errorCode, const String& errorMessage)
index 4402de9..ce33479 100644 (file)
@@ -40,11 +40,11 @@ messages -> WebIDBServerConnection LegacyReceiver {
     DidCreateIndex(uint64_t requestID, bool success)
     DidDeleteIndex(uint64_t requestID, bool success)
 
-    DidPutRecord(uint64_t requestID, struct WebCore::IDBKeyData resultKey, uint32_t errorCode, String errorMessage)
+    DidPutRecord(uint64_t requestID, WebCore::IDBKeyData resultKey, uint32_t errorCode, String errorMessage)
     DidGetRecord(uint64_t requestID, struct WebCore::IDBGetResult getResult, uint32_t errorCode, String errorMessage)
-    DidOpenCursor(uint64_t requestID, int64_t cursorID, struct WebCore::IDBKeyData key, struct WebCore::IDBKeyData primaryKey, IPC::DataReference value, uint32_t errorCode, String errorMessage)
-    DidAdvanceCursor(uint64_t requestID, struct WebCore::IDBKeyData key, struct WebCore::IDBKeyData primaryKey, IPC::DataReference value, uint32_t errorCode, String errorMessage)
-    DidIterateCursor(uint64_t requestID, struct WebCore::IDBKeyData key, struct WebCore::IDBKeyData primaryKey, IPC::DataReference value, uint32_t errorCode, String errorMessage)
+    DidOpenCursor(uint64_t requestID, int64_t cursorID, WebCore::IDBKeyData key, WebCore::IDBKeyData primaryKey, IPC::DataReference value, uint32_t errorCode, String errorMessage)
+    DidAdvanceCursor(uint64_t requestID, WebCore::IDBKeyData key, WebCore::IDBKeyData primaryKey, IPC::DataReference value, uint32_t errorCode, String errorMessage)
+    DidIterateCursor(uint64_t requestID, WebCore::IDBKeyData key, WebCore::IDBKeyData primaryKey, IPC::DataReference value, uint32_t errorCode, String errorMessage)
     DidCount(uint64_t requestID, int64_t count, uint32_t errorCode, String errorMessage)
     DidDeleteRange(uint64_t requestID, uint32_t errorCode, String errorMessage)
 }