Make IDBKeyData from a struct to a class.
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: http://svn.webkit.org/repository/webkit/trunk@191620 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebCore/Modules/indexeddb/IDBKeyData.h b/Source/WebCore/Modules/indexeddb/IDBKeyData.h
index 6c84e42..91563b2 100644
--- a/Source/WebCore/Modules/indexeddb/IDBKeyData.h
+++ b/Source/WebCore/Modules/indexeddb/IDBKeyData.h
@@ -35,11 +35,11 @@
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 @@
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 @@
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 @@
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: