Title: [163237] trunk/Source/WebKit2
- Revision
- 163237
- Author
- [email protected]
- Date
- 2014-01-31 23:04:18 -0800 (Fri, 31 Jan 2014)
Log Message
IDB: Handle "nextunique" and "prevunique" cursors, and handle "advance()" correctly
https://bugs.webkit.org/show_bug.cgi?id=128040
Reviewed by Jer Noble.
* DatabaseProcess/IndexedDB/sqlite/SQLiteIDBCursor.cpp:
(WebKit::SQLiteIDBCursor::advance): Entry point for advancing by a number of steps,
calls either advanceUnique or advanceOnce the appropriate number of times.
(WebKit::SQLiteIDBCursor::advanceUnique): Call advanceOnce until the key has changed.
(WebKit::SQLiteIDBCursor::advanceOnce):
* DatabaseProcess/IndexedDB/sqlite/SQLiteIDBCursor.h:
Modified Paths
Diff
Modified: trunk/Source/WebKit2/ChangeLog (163236 => 163237)
--- trunk/Source/WebKit2/ChangeLog 2014-02-01 06:40:21 UTC (rev 163236)
+++ trunk/Source/WebKit2/ChangeLog 2014-02-01 07:04:18 UTC (rev 163237)
@@ -1,5 +1,19 @@
2014-01-31 Brady Eidson <[email protected]>
+ IDB: Handle "nextunique" and "prevunique" cursors, and handle "advance()" correctly
+ https://bugs.webkit.org/show_bug.cgi?id=128040
+
+ Reviewed by Jer Noble.
+
+ * DatabaseProcess/IndexedDB/sqlite/SQLiteIDBCursor.cpp:
+ (WebKit::SQLiteIDBCursor::advance): Entry point for advancing by a number of steps,
+ calls either advanceUnique or advanceOnce the appropriate number of times.
+ (WebKit::SQLiteIDBCursor::advanceUnique): Call advanceOnce until the key has changed.
+ (WebKit::SQLiteIDBCursor::advanceOnce):
+ * DatabaseProcess/IndexedDB/sqlite/SQLiteIDBCursor.h:
+
+2014-01-31 Brady Eidson <[email protected]>
+
IDB: Index cursors use wrong deserialization for the retrieved value
https://bugs.webkit.org/show_bug.cgi?id=128035
Modified: trunk/Source/WebKit2/DatabaseProcess/IndexedDB/sqlite/SQLiteIDBCursor.cpp (163236 => 163237)
--- trunk/Source/WebKit2/DatabaseProcess/IndexedDB/sqlite/SQLiteIDBCursor.cpp 2014-02-01 06:40:21 UTC (rev 163236)
+++ trunk/Source/WebKit2/DatabaseProcess/IndexedDB/sqlite/SQLiteIDBCursor.cpp 2014-02-01 07:04:18 UTC (rev 163237)
@@ -210,6 +210,41 @@
bool SQLiteIDBCursor::advance(uint64_t count)
{
+ bool isUnique = m_cursorDirection == IndexedDB::CursorDirection::NextNoDuplicate || m_cursorDirection == IndexedDB::CursorDirection::PrevNoDuplicate;
+
+ for (uint64_t i = 0; i < count; ++i) {
+ if (!isUnique) {
+ if (!advanceOnce())
+ return false;
+ continue;
+ }
+
+ if (!advanceUnique())
+ return false;
+ }
+
+ return true;
+}
+
+bool SQLiteIDBCursor::advanceUnique()
+{
+ IDBKeyData currentKey = m_currentKey;
+
+ while (!m_completed) {
+ if (!advanceOnce())
+ return false;
+
+ // If the new current key is different from the old current key, we're done.
+ if (currentKey.compare(m_currentKey))
+ return true;
+ }
+
+ return false;
+}
+
+
+bool SQLiteIDBCursor::advanceOnce()
+{
ASSERT(m_transaction->sqliteTransaction());
ASSERT(m_statement);
Modified: trunk/Source/WebKit2/DatabaseProcess/IndexedDB/sqlite/SQLiteIDBCursor.h (163236 => 163237)
--- trunk/Source/WebKit2/DatabaseProcess/IndexedDB/sqlite/SQLiteIDBCursor.h 2014-02-01 06:40:21 UTC (rev 163236)
+++ trunk/Source/WebKit2/DatabaseProcess/IndexedDB/sqlite/SQLiteIDBCursor.h 2014-02-01 07:04:18 UTC (rev 163237)
@@ -70,6 +70,9 @@
bool establishStatement();
bool createSQLiteStatement(const String& sql, int64_t idToBind);
+ bool advanceOnce();
+ bool advanceUnique();
+
SQLiteIDBTransaction* m_transaction;
IDBIdentifier m_cursorIdentifier;
int64_t m_objectStoreID;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes