Title: [159373] trunk/Source/WebCore
Revision
159373
Author
beid...@apple.com
Date
2013-11-15 17:16:28 -0800 (Fri, 15 Nov 2013)

Log Message

Move IDBCursorBackend operations into their own files
https://bugs.webkit.org/show_bug.cgi?id=124444

Reviewed by Tim Horton.

* CMakeLists.txt:
* GNUmakefile.list.am:
* WebCore.xcodeproj/project.pbxproj:

* Modules/indexeddb/IDBCursorBackend.cpp:
* Modules/indexeddb/IDBCursorBackend.h:
(WebCore::IDBCursorBackend::cursorType):
(WebCore::IDBCursorBackend::deprecatedBackingStoreCursor):
(WebCore::IDBCursorBackend::deprecatedSetBackingStoreCursor):
(WebCore::IDBCursorBackend::deprecatedSetSavedBackingStoreCursor):

* Modules/indexeddb/IDBCursorBackendOperations.cpp: Added.
(WebCore::CallOnDestruct::CallOnDestruct):
(WebCore::CallOnDestruct::~CallOnDestruct):
(WebCore::CursorAdvanceOperation::perform):
(WebCore::CursorIterationOperation::perform):
(WebCore::CursorPrefetchIterationOperation::perform):
* Modules/indexeddb/IDBCursorBackendOperations.h: Added.
(WebCore::CursorIterationOperation::create):
(WebCore::CursorIterationOperation::CursorIterationOperation):
(WebCore::CursorAdvanceOperation::create):
(WebCore::CursorAdvanceOperation::CursorAdvanceOperation):
(WebCore::CursorPrefetchIterationOperation::create):
(WebCore::CursorPrefetchIterationOperation::CursorPrefetchIterationOperation):

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebCore/CMakeLists.txt (159372 => 159373)


--- trunk/Source/WebCore/CMakeLists.txt	2013-11-16 01:10:19 UTC (rev 159372)
+++ trunk/Source/WebCore/CMakeLists.txt	2013-11-16 01:16:28 UTC (rev 159373)
@@ -789,6 +789,7 @@
     Modules/indexeddb/IDBAny.cpp
     Modules/indexeddb/IDBCursor.cpp
     Modules/indexeddb/IDBCursorBackend.cpp
+    Modules/indexeddb/IDBCursorBackendOperations.cpp
     Modules/indexeddb/IDBCursorWithValue.cpp
     Modules/indexeddb/IDBDatabase.cpp
     Modules/indexeddb/IDBDatabaseBackend.cpp

Modified: trunk/Source/WebCore/ChangeLog (159372 => 159373)


--- trunk/Source/WebCore/ChangeLog	2013-11-16 01:10:19 UTC (rev 159372)
+++ trunk/Source/WebCore/ChangeLog	2013-11-16 01:16:28 UTC (rev 159373)
@@ -1,3 +1,35 @@
+2013-11-15  Brady Eidson  <beid...@apple.com>
+
+        Move IDBCursorBackend operations into their own files
+        https://bugs.webkit.org/show_bug.cgi?id=124444
+
+        Reviewed by Tim Horton.
+
+        * CMakeLists.txt:
+        * GNUmakefile.list.am:
+        * WebCore.xcodeproj/project.pbxproj:
+
+        * Modules/indexeddb/IDBCursorBackend.cpp:
+        * Modules/indexeddb/IDBCursorBackend.h:
+        (WebCore::IDBCursorBackend::cursorType):
+        (WebCore::IDBCursorBackend::deprecatedBackingStoreCursor):
+        (WebCore::IDBCursorBackend::deprecatedSetBackingStoreCursor):
+        (WebCore::IDBCursorBackend::deprecatedSetSavedBackingStoreCursor):
+
+        * Modules/indexeddb/IDBCursorBackendOperations.cpp: Added.
+        (WebCore::CallOnDestruct::CallOnDestruct):
+        (WebCore::CallOnDestruct::~CallOnDestruct):
+        (WebCore::CursorAdvanceOperation::perform):
+        (WebCore::CursorIterationOperation::perform):
+        (WebCore::CursorPrefetchIterationOperation::perform):
+        * Modules/indexeddb/IDBCursorBackendOperations.h: Added.
+        (WebCore::CursorIterationOperation::create):
+        (WebCore::CursorIterationOperation::CursorIterationOperation):
+        (WebCore::CursorAdvanceOperation::create):
+        (WebCore::CursorAdvanceOperation::CursorAdvanceOperation):
+        (WebCore::CursorPrefetchIterationOperation::create):
+        (WebCore::CursorPrefetchIterationOperation::CursorPrefetchIterationOperation):
+
 2013-11-14  David Farler  <dfar...@apple.com>
 
         Copy ASAN flag settings to WebCore and _javascript_Core intermediate build tools

Modified: trunk/Source/WebCore/GNUmakefile.list.am (159372 => 159373)


--- trunk/Source/WebCore/GNUmakefile.list.am	2013-11-16 01:10:19 UTC (rev 159372)
+++ trunk/Source/WebCore/GNUmakefile.list.am	2013-11-16 01:16:28 UTC (rev 159373)
@@ -1801,10 +1801,12 @@
 	Source/WebCore/Modules/indexeddb/leveldb/IDBServerConnectionLevelDB.cpp \
 	Source/WebCore/Modules/indexeddb/leveldb/IDBServerConnectionLevelDB.h \
 	Source/WebCore/Modules/indexeddb/IDBCallbacks.h \
+	Source/WebCore/Modules/indexeddb/IDBCursor.cpp \
+	Source/WebCore/Modules/indexeddb/IDBCursor.h \
 	Source/WebCore/Modules/indexeddb/IDBCursorBackend.cpp \
 	Source/WebCore/Modules/indexeddb/IDBCursorBackend.h \
-	Source/WebCore/Modules/indexeddb/IDBCursor.cpp \
-	Source/WebCore/Modules/indexeddb/IDBCursor.h \
+	Source/WebCore/Modules/indexeddb/IDBCursorBackendOperations.cpp \
+	Source/WebCore/Modules/indexeddb/IDBCursorBackendOperations.h \
 	Source/WebCore/Modules/indexeddb/IDBCursorWithValue.cpp \
 	Source/WebCore/Modules/indexeddb/IDBCursorWithValue.h \
 	Source/WebCore/Modules/indexeddb/IDBDatabaseBackend.cpp \

Modified: trunk/Source/WebCore/Modules/indexeddb/IDBCursorBackend.cpp (159372 => 159373)


--- trunk/Source/WebCore/Modules/indexeddb/IDBCursorBackend.cpp	2013-11-16 01:10:19 UTC (rev 159372)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBCursorBackend.cpp	2013-11-16 01:16:28 UTC (rev 159373)
@@ -29,6 +29,7 @@
 #if ENABLE(INDEXED_DATABASE)
 
 #include "IDBCallbacks.h"
+#include "IDBCursorBackendOperations.h"
 #include "IDBDatabaseBackend.h"
 #include "IDBDatabaseCallbacks.h"
 #include "IDBDatabaseError.h"
@@ -40,81 +41,6 @@
 
 namespace WebCore {
 
-class CallOnDestruct {
-public:
-    CallOnDestruct(std::function<void()> callback)
-        : m_callback(callback)
-    { }
-
-    ~CallOnDestruct()
-    {
-        m_callback();
-    }
-
-private:
-    std::function<void()> m_callback;
-};
-
-class IDBCursorBackend::CursorIterationOperation : public IDBOperation {
-public:
-    static PassRefPtr<IDBOperation> create(PassRefPtr<IDBCursorBackend> cursor, PassRefPtr<IDBKey> key, PassRefPtr<IDBCallbacks> callbacks)
-    {
-        return adoptRef(new CursorIterationOperation(cursor, key, callbacks));
-    }
-    virtual void perform(std::function<void()> completionCallback) OVERRIDE FINAL;
-private:
-    CursorIterationOperation(PassRefPtr<IDBCursorBackend> cursor, PassRefPtr<IDBKey> key, PassRefPtr<IDBCallbacks> callbacks)
-        : m_cursor(cursor)
-        , m_key(key)
-        , m_callbacks(callbacks)
-    {
-    }
-
-    RefPtr<IDBCursorBackend> m_cursor;
-    RefPtr<IDBKey> m_key;
-    RefPtr<IDBCallbacks> m_callbacks;
-};
-
-class IDBCursorBackend::CursorAdvanceOperation : public IDBOperation {
-public:
-    static PassRefPtr<IDBOperation> create(PassRefPtr<IDBCursorBackend> cursor, unsigned long count, PassRefPtr<IDBCallbacks> callbacks)
-    {
-        return adoptRef(new CursorAdvanceOperation(cursor, count, callbacks));
-    }
-    virtual void perform(std::function<void()> completionCallback) OVERRIDE FINAL;
-private:
-    CursorAdvanceOperation(PassRefPtr<IDBCursorBackend> cursor, unsigned long count, PassRefPtr<IDBCallbacks> callbacks)
-        : m_cursor(cursor)
-        , m_count(count)
-        , m_callbacks(callbacks)
-    {
-    }
-
-    RefPtr<IDBCursorBackend> m_cursor;
-    unsigned long m_count;
-    RefPtr<IDBCallbacks> m_callbacks;
-};
-
-class IDBCursorBackend::CursorPrefetchIterationOperation : public IDBOperation {
-public:
-    static PassRefPtr<IDBOperation> create(PassRefPtr<IDBCursorBackend> cursor, int numberToFetch, PassRefPtr<IDBCallbacks> callbacks)
-    {
-        return adoptRef(new CursorPrefetchIterationOperation(cursor, numberToFetch, callbacks));
-    }
-    virtual void perform(std::function<void()> completionCallback) OVERRIDE FINAL;
-private:
-    CursorPrefetchIterationOperation(PassRefPtr<IDBCursorBackend> cursor, int numberToFetch, PassRefPtr<IDBCallbacks> callbacks)
-        : m_cursor(cursor)
-        , m_numberToFetch(numberToFetch)
-        , m_callbacks(callbacks)
-    {
-    }
-
-    RefPtr<IDBCursorBackend> m_cursor;
-    int m_numberToFetch;
-    RefPtr<IDBCallbacks> m_callbacks;
-};
-
 IDBCursorBackend::IDBCursorBackend(PassRefPtr<IDBBackingStoreCursorInterface> cursor, IndexedDB::CursorType cursorType, IDBDatabaseBackend::TaskType taskType, IDBTransactionBackend* transaction, int64_t objectStoreId)
     : m_taskType(taskType)
     , m_cursorType(cursorType)
@@ -147,34 +73,6 @@
     m_transaction->scheduleTask(CursorAdvanceOperation::create(this, count, callbacks));
 }
 
-void IDBCursorBackend::CursorAdvanceOperation::perform(std::function<void()> completionCallback)
-{
-    CallOnDestruct callOnDestruct(completionCallback);
-
-    LOG(StorageAPI, "CursorAdvanceOperation");
-    if (!m_cursor->m_cursor || !m_cursor->m_cursor->advance(m_count)) {
-        m_cursor->m_cursor = 0;
-        m_callbacks->onSuccess(static_cast<SharedBuffer*>(0));
-        return;
-    }
-
-    m_callbacks->onSuccess(m_cursor->key(), m_cursor->primaryKey(), m_cursor->value());
-}
-
-void IDBCursorBackend::CursorIterationOperation::perform(std::function<void()> completionCallback)
-{
-    CallOnDestruct callOnDestruct(completionCallback);
-
-    LOG(StorageAPI, "CursorIterationOperation");
-    if (!m_cursor->m_cursor || !m_cursor->m_cursor->continueFunction(m_key.get())) {
-        m_cursor->m_cursor = 0;
-        m_callbacks->onSuccess(static_cast<SharedBuffer*>(0));
-        return;
-    }
-
-    m_callbacks->onSuccess(m_cursor->key(), m_cursor->primaryKey(), m_cursor->value());
-}
-
 void IDBCursorBackend::deleteFunction(PassRefPtr<IDBCallbacks> prpCallbacks, ExceptionCode&)
 {
     LOG(StorageAPI, "IDBCursorBackend::delete");
@@ -190,57 +88,6 @@
     m_transaction->scheduleTask(m_taskType, CursorPrefetchIterationOperation::create(this, numberToFetch, callbacks));
 }
 
-void IDBCursorBackend::CursorPrefetchIterationOperation::perform(std::function<void()> completionCallback)
-{
-    CallOnDestruct callOnDestruct(completionCallback);
-
-    LOG(StorageAPI, "CursorPrefetchIterationOperation");
-
-    Vector<RefPtr<IDBKey>> foundKeys;
-    Vector<RefPtr<IDBKey>> foundPrimaryKeys;
-    Vector<RefPtr<SharedBuffer>> foundValues;
-
-    if (m_cursor->m_cursor)
-        m_cursor->m_savedCursor = m_cursor->m_cursor->clone();
-
-    const size_t maxSizeEstimate = 10 * 1024 * 1024;
-    size_t sizeEstimate = 0;
-
-    for (int i = 0; i < m_numberToFetch; ++i) {
-        if (!m_cursor->m_cursor || !m_cursor->m_cursor->continueFunction(0)) {
-            m_cursor->m_cursor = 0;
-            break;
-        }
-
-        foundKeys.append(m_cursor->m_cursor->key());
-        foundPrimaryKeys.append(m_cursor->m_cursor->primaryKey());
-
-        switch (m_cursor->m_cursorType) {
-        case IndexedDB::CursorKeyOnly:
-            foundValues.append(SharedBuffer::create());
-            break;
-        case IndexedDB::CursorKeyAndValue:
-            sizeEstimate += m_cursor->m_cursor->value()->size();
-            foundValues.append(m_cursor->m_cursor->value());
-            break;
-        default:
-            ASSERT_NOT_REACHED();
-        }
-        sizeEstimate += m_cursor->m_cursor->key()->sizeEstimate();
-        sizeEstimate += m_cursor->m_cursor->primaryKey()->sizeEstimate();
-
-        if (sizeEstimate > maxSizeEstimate)
-            break;
-    }
-
-    if (!foundKeys.size()) {
-        m_callbacks->onSuccess(static_cast<SharedBuffer*>(0));
-        return;
-    }
-
-    m_callbacks->onSuccessWithPrefetch(foundKeys, foundPrimaryKeys, foundValues);
-}
-
 void IDBCursorBackend::prefetchReset(int usedPrefetches, int)
 {
     LOG(StorageAPI, "IDBCursorBackend::prefetchReset");

Modified: trunk/Source/WebCore/Modules/indexeddb/IDBCursorBackend.h (159372 => 159373)


--- trunk/Source/WebCore/Modules/indexeddb/IDBCursorBackend.h	2013-11-16 01:10:19 UTC (rev 159372)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBCursorBackend.h	2013-11-16 01:16:28 UTC (rev 159373)
@@ -66,13 +66,15 @@
 
     void close();
 
+    IndexedDB::CursorType cursorType() const { return m_cursorType; }
+
+    IDBBackingStoreCursorInterface* deprecatedBackingStoreCursor() { return m_cursor.get(); }
+    void deprecatedSetBackingStoreCursor(PassRefPtr<IDBBackingStoreCursorInterface> cursor) { m_cursor = cursor; }
+    void deprecatedSetSavedBackingStoreCursor(PassRefPtr<IDBBackingStoreCursorInterface> cursor) { m_savedCursor = cursor; }
+
 private:
     IDBCursorBackend(PassRefPtr<IDBBackingStoreCursorInterface>, IndexedDB::CursorType, IDBDatabaseBackend::TaskType, IDBTransactionBackend*, int64_t objectStoreId);
 
-    class CursorIterationOperation;
-    class CursorAdvanceOperation;
-    class CursorPrefetchIterationOperation;
-
     IDBDatabaseBackend::TaskType m_taskType;
     IndexedDB::CursorType m_cursorType;
     const RefPtr<IDBDatabaseBackend> m_database;

Added: trunk/Source/WebCore/Modules/indexeddb/IDBCursorBackendOperations.cpp (0 => 159373)


--- trunk/Source/WebCore/Modules/indexeddb/IDBCursorBackendOperations.cpp	                        (rev 0)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBCursorBackendOperations.cpp	2013-11-16 01:16:28 UTC (rev 159373)
@@ -0,0 +1,132 @@
+/*
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ * Copyright (C) 2013 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "IDBCursorBackendOperations.h"
+
+#if ENABLE(INDEXED_DATABASE)
+
+#include "Logging.h"
+
+namespace WebCore {
+
+class CallOnDestruct {
+public:
+    CallOnDestruct(std::function<void()> callback)
+        : m_callback(callback)
+    { }
+
+    ~CallOnDestruct()
+    {
+        m_callback();
+    }
+
+private:
+    std::function<void()> m_callback;
+};
+
+void CursorAdvanceOperation::perform(std::function<void()> completionCallback)
+{
+    CallOnDestruct callOnDestruct(completionCallback);
+
+    LOG(StorageAPI, "CursorAdvanceOperation");
+    if (!m_cursor->deprecatedBackingStoreCursor() || !m_cursor->deprecatedBackingStoreCursor()->advance(m_count)) {
+        m_cursor->deprecatedSetBackingStoreCursor(0);
+        m_callbacks->onSuccess(static_cast<SharedBuffer*>(0));
+        return;
+    }
+
+    m_callbacks->onSuccess(m_cursor->key(), m_cursor->primaryKey(), m_cursor->value());
+}
+
+void CursorIterationOperation::perform(std::function<void()> completionCallback)
+{
+    CallOnDestruct callOnDestruct(completionCallback);
+
+    LOG(StorageAPI, "CursorIterationOperation");
+    if (!m_cursor->deprecatedBackingStoreCursor() || !m_cursor->deprecatedBackingStoreCursor()->continueFunction(m_key.get())) {
+        m_cursor->deprecatedSetBackingStoreCursor(0);
+        m_callbacks->onSuccess(static_cast<SharedBuffer*>(0));
+        return;
+    }
+
+    m_callbacks->onSuccess(m_cursor->key(), m_cursor->primaryKey(), m_cursor->value());
+}
+
+void CursorPrefetchIterationOperation::perform(std::function<void()> completionCallback)
+{
+    CallOnDestruct callOnDestruct(completionCallback);
+
+    LOG(StorageAPI, "CursorPrefetchIterationOperation");
+
+    Vector<RefPtr<IDBKey>> foundKeys;
+    Vector<RefPtr<IDBKey>> foundPrimaryKeys;
+    Vector<RefPtr<SharedBuffer>> foundValues;
+
+    if (m_cursor->deprecatedBackingStoreCursor())
+        m_cursor->deprecatedSetSavedBackingStoreCursor(m_cursor->deprecatedBackingStoreCursor()->clone());
+
+    const size_t maxSizeEstimate = 10 * 1024 * 1024;
+    size_t sizeEstimate = 0;
+
+    for (int i = 0; i < m_numberToFetch; ++i) {
+        if (!m_cursor->deprecatedBackingStoreCursor() || !m_cursor->deprecatedBackingStoreCursor()->continueFunction(0)) {
+            m_cursor->deprecatedSetBackingStoreCursor(0);
+            break;
+        }
+
+        foundKeys.append(m_cursor->deprecatedBackingStoreCursor()->key());
+        foundPrimaryKeys.append(m_cursor->deprecatedBackingStoreCursor()->primaryKey());
+
+        switch (m_cursor->cursorType()) {
+        case IndexedDB::CursorKeyOnly:
+            foundValues.append(SharedBuffer::create());
+            break;
+        case IndexedDB::CursorKeyAndValue:
+            sizeEstimate += m_cursor->deprecatedBackingStoreCursor()->value()->size();
+            foundValues.append(m_cursor->deprecatedBackingStoreCursor()->value());
+            break;
+        default:
+            ASSERT_NOT_REACHED();
+        }
+        sizeEstimate += m_cursor->deprecatedBackingStoreCursor()->key()->sizeEstimate();
+        sizeEstimate += m_cursor->deprecatedBackingStoreCursor()->primaryKey()->sizeEstimate();
+
+        if (sizeEstimate > maxSizeEstimate)
+            break;
+    }
+
+    if (!foundKeys.size()) {
+        m_callbacks->onSuccess(static_cast<SharedBuffer*>(0));
+        return;
+    }
+
+    m_callbacks->onSuccessWithPrefetch(foundKeys, foundPrimaryKeys, foundValues);
+}
+
+} // namespace WebCore
+
+#endif // ENABLED(INDEXED_DATABASE)

Added: trunk/Source/WebCore/Modules/indexeddb/IDBCursorBackendOperations.h (0 => 159373)


--- trunk/Source/WebCore/Modules/indexeddb/IDBCursorBackendOperations.h	                        (rev 0)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBCursorBackendOperations.h	2013-11-16 01:16:28 UTC (rev 159373)
@@ -0,0 +1,103 @@
+/*
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ * Copyright (C) 2013 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef IDBCursorBackendOperations_h
+#define IDBCursorBackendOperations_h
+
+#if ENABLE(INDEXED_DATABASE)
+
+#include "IDBCursorBackend.h"
+#include "IDBOperation.h"
+
+namespace WebCore {
+
+class CursorIterationOperation : public IDBOperation {
+public:
+    static PassRefPtr<IDBOperation> create(PassRefPtr<IDBCursorBackend> cursor, PassRefPtr<IDBKey> key, PassRefPtr<IDBCallbacks> callbacks)
+    {
+        return adoptRef(new CursorIterationOperation(cursor, key, callbacks));
+    }
+    virtual void perform(std::function<void()> completionCallback) OVERRIDE FINAL;
+
+private:
+    CursorIterationOperation(PassRefPtr<IDBCursorBackend> cursor, PassRefPtr<IDBKey> key, PassRefPtr<IDBCallbacks> callbacks)
+        : m_cursor(cursor)
+        , m_key(key)
+        , m_callbacks(callbacks)
+    {
+    }
+
+    RefPtr<IDBCursorBackend> m_cursor;
+    RefPtr<IDBKey> m_key;
+    RefPtr<IDBCallbacks> m_callbacks;
+};
+
+class CursorAdvanceOperation : public IDBOperation {
+public:
+    static PassRefPtr<IDBOperation> create(PassRefPtr<IDBCursorBackend> cursor, unsigned long count, PassRefPtr<IDBCallbacks> callbacks)
+    {
+        return adoptRef(new CursorAdvanceOperation(cursor, count, callbacks));
+    }
+    virtual void perform(std::function<void()> completionCallback) OVERRIDE FINAL;
+
+private:
+    CursorAdvanceOperation(PassRefPtr<IDBCursorBackend> cursor, unsigned long count, PassRefPtr<IDBCallbacks> callbacks)
+        : m_cursor(cursor)
+        , m_count(count)
+        , m_callbacks(callbacks)
+    {
+    }
+
+    RefPtr<IDBCursorBackend> m_cursor;
+    unsigned long m_count;
+    RefPtr<IDBCallbacks> m_callbacks;
+};
+
+class CursorPrefetchIterationOperation : public IDBOperation {
+public:
+    static PassRefPtr<IDBOperation> create(PassRefPtr<IDBCursorBackend> cursor, int numberToFetch, PassRefPtr<IDBCallbacks> callbacks)
+    {
+        return adoptRef(new CursorPrefetchIterationOperation(cursor, numberToFetch, callbacks));
+    }
+    virtual void perform(std::function<void()> completionCallback) OVERRIDE FINAL;
+
+private:
+    CursorPrefetchIterationOperation(PassRefPtr<IDBCursorBackend> cursor, int numberToFetch, PassRefPtr<IDBCallbacks> callbacks)
+        : m_cursor(cursor)
+        , m_numberToFetch(numberToFetch)
+        , m_callbacks(callbacks)
+    {
+    }
+
+    RefPtr<IDBCursorBackend> m_cursor;
+    int m_numberToFetch;
+    RefPtr<IDBCallbacks> m_callbacks;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(INDEXED_DATABASE)
+#endif // IDBCursorBackendOperations_h

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (159372 => 159373)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2013-11-16 01:10:19 UTC (rev 159372)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2013-11-16 01:16:28 UTC (rev 159373)
@@ -1649,6 +1649,8 @@
 		5101846A0B08602A004A825F /* CachedPage.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 510184680B08602A004A825F /* CachedPage.cpp */; };
 		510194401836D20800925523 /* IDBIndexWriterLevelDB.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5101943E1836D20800925523 /* IDBIndexWriterLevelDB.cpp */; };
 		510194411836D20800925523 /* IDBIndexWriterLevelDB.h in Headers */ = {isa = PBXBuildFile; fileRef = 5101943F1836D20800925523 /* IDBIndexWriterLevelDB.h */; };
+		510194441836F7E400925523 /* IDBCursorBackendOperations.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 510194421836F7E400925523 /* IDBCursorBackendOperations.cpp */; };
+		510194451836F7E500925523 /* IDBCursorBackendOperations.h in Headers */ = {isa = PBXBuildFile; fileRef = 510194431836F7E400925523 /* IDBCursorBackendOperations.h */; };
 		51059DDD1820B17600DFF9B1 /* IDBTransactionBackendOperations.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51059DD91820B17600DFF9B1 /* IDBTransactionBackendOperations.cpp */; };
 		51059DDE1820B17600DFF9B1 /* IDBTransactionBackendOperations.h in Headers */ = {isa = PBXBuildFile; fileRef = 51059DDA1820B17600DFF9B1 /* IDBTransactionBackendOperations.h */; };
 		510A326F18318431003C5326 /* IDBServerConnection.h in Headers */ = {isa = PBXBuildFile; fileRef = 510A326E18318431003C5326 /* IDBServerConnection.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -8348,6 +8350,8 @@
 		510184680B08602A004A825F /* CachedPage.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CachedPage.cpp; sourceTree = "<group>"; };
 		5101943E1836D20800925523 /* IDBIndexWriterLevelDB.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IDBIndexWriterLevelDB.cpp; sourceTree = "<group>"; };
 		5101943F1836D20800925523 /* IDBIndexWriterLevelDB.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDBIndexWriterLevelDB.h; sourceTree = "<group>"; };
+		510194421836F7E400925523 /* IDBCursorBackendOperations.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IDBCursorBackendOperations.cpp; sourceTree = "<group>"; };
+		510194431836F7E400925523 /* IDBCursorBackendOperations.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDBCursorBackendOperations.h; sourceTree = "<group>"; };
 		51059DD91820B17600DFF9B1 /* IDBTransactionBackendOperations.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IDBTransactionBackendOperations.cpp; sourceTree = "<group>"; };
 		51059DDA1820B17600DFF9B1 /* IDBTransactionBackendOperations.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDBTransactionBackendOperations.h; sourceTree = "<group>"; };
 		510A326E18318431003C5326 /* IDBServerConnection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDBServerConnection.h; sourceTree = "<group>"; };
@@ -17000,6 +17004,8 @@
 				51D71977181106DF0016DC51 /* IDBCursor.idl */,
 				516730A1182D8FBB003FAF5C /* IDBCursorBackend.cpp */,
 				516730A2182D8FBB003FAF5C /* IDBCursorBackend.h */,
+				510194421836F7E400925523 /* IDBCursorBackendOperations.cpp */,
+				510194431836F7E400925523 /* IDBCursorBackendOperations.h */,
 				51D71979181106DF0016DC51 /* IDBCursorWithValue.cpp */,
 				51D7197A181106DF0016DC51 /* IDBCursorWithValue.h */,
 				51D7197B181106DF0016DC51 /* IDBCursorWithValue.idl */,
@@ -24181,6 +24187,7 @@
 				A84D827C11D333ED00972990 /* RawDataDocumentParser.h in Headers */,
 				FD31603C12B0267600C1A359 /* RealtimeAnalyser.h in Headers */,
 				BC4368E80C226E32005EFB5F /* Rect.h in Headers */,
+				510194451836F7E500925523 /* IDBCursorBackendOperations.h in Headers */,
 				FD45A958175D414C00C21EC8 /* RectangleShape.h in Headers */,
 				A72EA3BB1585CF55004FAA26 /* RefCountedSupplement.h in Headers */,
 				9831AE4A154225C900FE2644 /* ReferrerPolicy.h in Headers */,
@@ -27232,6 +27239,7 @@
 				1A8F6BC50DB55CDC001DB794 /* ManifestParser.cpp in Sources */,
 				93309DF7099E64920056E581 /* markup.cpp in Sources */,
 				9728C3131268E4390041E89B /* MarkupAccumulator.cpp in Sources */,
+				510194441836F7E400925523 /* IDBCursorBackendOperations.cpp in Sources */,
 				FABE72F41059C1EB00D999DD /* MathMLElement.cpp in Sources */,
 				FABE72FD1059C21100D999DD /* MathMLElementFactory.cpp in Sources */,
 				FABE72F61059C1EB00D999DD /* MathMLInlineContainerElement.cpp in Sources */,
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to