From 1bf1084f2b10c3b47fd1a588d85d21ed0eb41d0c Mon Sep 17 00:00:00 2001 From: Lorry Tar Creator Date: Tue, 27 Jun 2017 06:07:23 +0000 Subject: webkitgtk-2.16.5 --- Source/WebCore/Modules/indexeddb/IDBKeyRangeData.h | 69 ++++++++++++++++++++-- 1 file changed, 63 insertions(+), 6 deletions(-) (limited to 'Source/WebCore/Modules/indexeddb/IDBKeyRangeData.h') diff --git a/Source/WebCore/Modules/indexeddb/IDBKeyRangeData.h b/Source/WebCore/Modules/indexeddb/IDBKeyRangeData.h index d35a54393..12ecd4de3 100644 --- a/Source/WebCore/Modules/indexeddb/IDBKeyRangeData.h +++ b/Source/WebCore/Modules/indexeddb/IDBKeyRangeData.h @@ -23,8 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef IDBKeyRangeData_h -#define IDBKeyRangeData_h +#pragma once #if ENABLE(INDEXED_DATABASE) @@ -33,6 +32,8 @@ namespace WebCore { +class IDBKey; + struct IDBKeyRangeData { IDBKeyRangeData() : isNull(true) @@ -41,6 +42,18 @@ struct IDBKeyRangeData { { } + static IDBKeyRangeData allKeys() + { + IDBKeyRangeData result; + result.isNull = false; + result.lowerKey = IDBKeyData::minimum(); + result.upperKey = IDBKeyData::maximum(); + return result; + } + + IDBKeyRangeData(IDBKey*); + IDBKeyRangeData(const IDBKeyData&); + IDBKeyRangeData(IDBKeyRange* keyRange) : isNull(!keyRange) , lowerOpen(false) @@ -49,15 +62,22 @@ struct IDBKeyRangeData { if (isNull) return; - lowerKey = keyRange->lower().get(); - upperKey = keyRange->upper().get(); + lowerKey = keyRange->lower(); + upperKey = keyRange->upper(); lowerOpen = keyRange->lowerOpen(); upperOpen = keyRange->upperOpen(); } IDBKeyRangeData isolatedCopy() const; - PassRefPtr maybeCreateIDBKeyRange() const; + WEBCORE_EXPORT RefPtr maybeCreateIDBKeyRange() const; + + WEBCORE_EXPORT bool isExactlyOneKey() const; + bool containsKey(const IDBKeyData&) const; + bool isValid() const; + + template void encode(Encoder&) const; + template static bool decode(Decoder&, IDBKeyRangeData&); bool isNull; @@ -66,9 +86,46 @@ struct IDBKeyRangeData { bool lowerOpen; bool upperOpen; + +#if !LOG_DISABLED + String loggingString() const; +#endif }; +template +void IDBKeyRangeData::encode(Encoder& encoder) const +{ + encoder << isNull; + if (isNull) + return; + + encoder << upperKey << lowerKey << upperOpen << lowerOpen; +} + +template +bool IDBKeyRangeData::decode(Decoder& decoder, IDBKeyRangeData& keyRange) +{ + if (!decoder.decode(keyRange.isNull)) + return false; + + if (keyRange.isNull) + return true; + + if (!decoder.decode(keyRange.upperKey)) + return false; + + if (!decoder.decode(keyRange.lowerKey)) + return false; + + if (!decoder.decode(keyRange.upperOpen)) + return false; + + if (!decoder.decode(keyRange.lowerOpen)) + return false; + + return true; +} + } // namespace WebCore #endif // ENABLE(INDEXED_DATABASE) -#endif // IDBKeyRangeData_h -- cgit v1.2.1