<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[162856] trunk/Source</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/162856">162856</a></dd>
<dt>Author</dt> <dd>beidson@apple.com</dd>
<dt>Date</dt> <dd>2014-01-27 12:34:55 -0800 (Mon, 27 Jan 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>IDB: Refactor out the last of the operation callbacks that are called by the LevelDB backing store
https://bugs.webkit.org/show_bug.cgi?id=127592

Reviewed by Tim Horton.

Source/WebCore:

For each of the 3 remaining operations where the backing store calls callbacks directly,
factor out the callbacks to the operation itself.

* Modules/indexeddb/IDBTransactionBackendOperations.cpp:
(WebCore::OpenCursorOperation::perform):
(WebCore::CountOperation::perform):
(WebCore::DeleteRangeOperation::perform):
* Modules/indexeddb/IDBTransactionBackendOperations.h:

* Modules/indexeddb/IDBServerConnection.h:
* Modules/indexeddb/leveldb/IDBServerConnectionLevelDB.cpp:
(WebCore::IDBServerConnectionLevelDB::openCursor):
(WebCore::IDBServerConnectionLevelDB::count):
(WebCore::IDBServerConnectionLevelDB::deleteRange):
* Modules/indexeddb/leveldb/IDBServerConnectionLevelDB.h:

Source/WebKit2:

Update the WebIDBServerConnection to the new callback signatures:
* WebProcess/Databases/IndexedDB/WebIDBServerConnection.cpp:
(WebKit::WebIDBServerConnection::openCursor):
(WebKit::WebIDBServerConnection::count):
* WebProcess/Databases/IndexedDB/WebIDBServerConnection.h:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbIDBServerConnectionh">trunk/Source/WebCore/Modules/indexeddb/IDBServerConnection.h</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbIDBTransactionBackendOperationscpp">trunk/Source/WebCore/Modules/indexeddb/IDBTransactionBackendOperations.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbIDBTransactionBackendOperationsh">trunk/Source/WebCore/Modules/indexeddb/IDBTransactionBackendOperations.h</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbleveldbIDBServerConnectionLevelDBcpp">trunk/Source/WebCore/Modules/indexeddb/leveldb/IDBServerConnectionLevelDB.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbleveldbIDBServerConnectionLevelDBh">trunk/Source/WebCore/Modules/indexeddb/leveldb/IDBServerConnectionLevelDB.h</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2WebProcessDatabasesIndexedDBWebIDBServerConnectioncpp">trunk/Source/WebKit2/WebProcess/Databases/IndexedDB/WebIDBServerConnection.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebProcessDatabasesIndexedDBWebIDBServerConnectionh">trunk/Source/WebKit2/WebProcess/Databases/IndexedDB/WebIDBServerConnection.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (162855 => 162856)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-01-27 20:31:09 UTC (rev 162855)
+++ trunk/Source/WebCore/ChangeLog        2014-01-27 20:34:55 UTC (rev 162856)
</span><span class="lines">@@ -1,3 +1,27 @@
</span><ins>+2014-01-27  Brady Eidson  &lt;beidson@apple.com&gt;
+
+        IDB: Refactor out the last of the operation callbacks that are called by the LevelDB backing store
+        https://bugs.webkit.org/show_bug.cgi?id=127592
+
+        Reviewed by Tim Horton.
+
+        For each of the 3 remaining operations where the backing store calls callbacks directly,
+        factor out the callbacks to the operation itself.
+
+
+        * Modules/indexeddb/IDBTransactionBackendOperations.cpp:
+        (WebCore::OpenCursorOperation::perform):
+        (WebCore::CountOperation::perform):
+        (WebCore::DeleteRangeOperation::perform):
+        * Modules/indexeddb/IDBTransactionBackendOperations.h:
+
+        * Modules/indexeddb/IDBServerConnection.h:
+        * Modules/indexeddb/leveldb/IDBServerConnectionLevelDB.cpp:
+        (WebCore::IDBServerConnectionLevelDB::openCursor):
+        (WebCore::IDBServerConnectionLevelDB::count):
+        (WebCore::IDBServerConnectionLevelDB::deleteRange):
+        * Modules/indexeddb/leveldb/IDBServerConnectionLevelDB.h:
+
</ins><span class="cx"> 2014-01-27  Commit Queue  &lt;commit-queue@webkit.org&gt;
</span><span class="cx"> 
</span><span class="cx">         Unreviewed, rolling out r162755.
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbIDBServerConnectionh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/IDBServerConnection.h (162855 => 162856)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/IDBServerConnection.h        2014-01-27 20:31:09 UTC (rev 162855)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBServerConnection.h        2014-01-27 20:34:55 UTC (rev 162856)
</span><span class="lines">@@ -44,6 +44,7 @@
</span><span class="cx"> class IDBKey;
</span><span class="cx"> class IDBTransactionBackend;
</span><span class="cx"> 
</span><ins>+struct IDBOpenCursorResult;
</ins><span class="cx"> struct IDBIndexMetadata;
</span><span class="cx"> struct IDBObjectStoreMetadata;
</span><span class="cx"> 
</span><span class="lines">@@ -80,8 +81,8 @@
</span><span class="cx">     virtual void deleteIndex(IDBTransactionBackend&amp;, const DeleteIndexOperation&amp;, std::function&lt;void(PassRefPtr&lt;IDBDatabaseError&gt;)&gt; completionCallback) = 0;
</span><span class="cx">     virtual void get(IDBTransactionBackend&amp;, const GetOperation&amp;, std::function&lt;void(const IDBGetResult&amp;, PassRefPtr&lt;IDBDatabaseError&gt;)&gt; completionCallback) = 0;
</span><span class="cx">     virtual void put(IDBTransactionBackend&amp;, const PutOperation&amp;, std::function&lt;void(PassRefPtr&lt;IDBKey&gt;, PassRefPtr&lt;IDBDatabaseError&gt;)&gt; completionCallback) = 0;
</span><del>-    virtual void openCursor(IDBTransactionBackend&amp;, const OpenCursorOperation&amp;, std::function&lt;void(PassRefPtr&lt;IDBDatabaseError&gt;)&gt; completionCallback) = 0;
-    virtual void count(IDBTransactionBackend&amp;, const CountOperation&amp;, std::function&lt;void(PassRefPtr&lt;IDBDatabaseError&gt;)&gt; completionCallback) = 0;
</del><ins>+    virtual void openCursor(IDBTransactionBackend&amp;, const OpenCursorOperation&amp;, std::function&lt;void(int64_t, PassRefPtr&lt;IDBDatabaseError&gt;)&gt; completionCallback) = 0;
+    virtual void count(IDBTransactionBackend&amp;, const CountOperation&amp;, std::function&lt;void(int64_t, PassRefPtr&lt;IDBDatabaseError&gt;)&gt; completionCallback) = 0;
</ins><span class="cx">     virtual void deleteRange(IDBTransactionBackend&amp;, const DeleteRangeOperation&amp;, std::function&lt;void(PassRefPtr&lt;IDBDatabaseError&gt;)&gt; completionCallback) = 0;
</span><span class="cx">     virtual void clearObjectStore(IDBTransactionBackend&amp;, const ClearObjectStoreOperation&amp;, std::function&lt;void(PassRefPtr&lt;IDBDatabaseError&gt;)&gt; completionCallback) = 0;
</span><span class="cx">     virtual void deleteObjectStore(IDBTransactionBackend&amp;, const DeleteObjectStoreOperation&amp;, std::function&lt;void(PassRefPtr&lt;IDBDatabaseError&gt;)&gt; completionCallback) = 0;
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbIDBTransactionBackendOperationscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/IDBTransactionBackendOperations.cpp (162855 => 162856)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/IDBTransactionBackendOperations.cpp        2014-01-27 20:31:09 UTC (rev 162855)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBTransactionBackendOperations.cpp        2014-01-27 20:34:55 UTC (rev 162856)
</span><span class="lines">@@ -154,9 +154,20 @@
</span><span class="cx">     LOG(StorageAPI, &quot;OpenCursorOperation&quot;);
</span><span class="cx"> 
</span><span class="cx">     RefPtr&lt;OpenCursorOperation&gt; operation(this);
</span><del>-    STANDARD_DATABASE_ERROR_CALLBACK;
</del><ins>+    auto callback = [this, operation, completionCallback](int64_t cursorID, PassRefPtr&lt;IDBDatabaseError&gt;) {
+        // FIXME: When the LevelDB port fails to open a backing store cursor it calls onSuccess(nullptr);
+        // This seems nonsensical and might have to change soon, breaking them.
+        if (!cursorID)
+            m_callbacks-&gt;onSuccess(static_cast&lt;SharedBuffer*&gt;(0));
+        else {
+            RefPtr&lt;IDBCursorBackend&gt; cursor = IDBCursorBackend::create(cursorID, m_cursorType, m_taskType, *m_transaction, m_objectStoreID);
+            m_callbacks-&gt;onSuccess(cursor, cursor-&gt;key(), cursor-&gt;primaryKey(), cursor-&gt;value());
+        }
</ins><span class="cx"> 
</span><del>-    m_transaction-&gt;database().serverConnection().openCursor(*m_transaction, *this, operationCallback);
</del><ins>+        completionCallback();
+    };
+
+    m_transaction-&gt;database().serverConnection().openCursor(*m_transaction, *this, callback);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void CountOperation::perform(std::function&lt;void()&gt; completionCallback)
</span><span class="lines">@@ -164,9 +175,15 @@
</span><span class="cx">     LOG(StorageAPI, &quot;CountOperation&quot;);
</span><span class="cx"> 
</span><span class="cx">     RefPtr&lt;CountOperation&gt; operation(this);
</span><del>-    STANDARD_DATABASE_ERROR_CALLBACK;
</del><ins>+    auto callback = [this, operation, completionCallback](int64_t count, PassRefPtr&lt;IDBDatabaseError&gt;) {
+        // FIXME: The LevelDB port never had an error condition for the count operation.
+        // We probably need to support an error for the count operation, breaking the LevelDB port.
+        m_callbacks-&gt;onSuccess(count);
</ins><span class="cx"> 
</span><del>-    m_transaction-&gt;database().serverConnection().count(*m_transaction, *this, operationCallback);
</del><ins>+        completionCallback();
+    };
+
+    m_transaction-&gt;database().serverConnection().count(*m_transaction, *this, callback);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void DeleteRangeOperation::perform(std::function&lt;void()&gt; completionCallback)
</span><span class="lines">@@ -174,9 +191,16 @@
</span><span class="cx">     LOG(StorageAPI, &quot;DeleteRangeOperation&quot;);
</span><span class="cx"> 
</span><span class="cx">     RefPtr&lt;DeleteRangeOperation&gt; operation(this);
</span><del>-    STANDARD_DATABASE_ERROR_CALLBACK;
</del><ins>+    auto callback = [this, operation, completionCallback](PassRefPtr&lt;IDBDatabaseError&gt; error) {
+        if (error)
+            m_callbacks-&gt;onError(error);
+        else
+            m_callbacks-&gt;onSuccess();
</ins><span class="cx"> 
</span><del>-    m_transaction-&gt;database().serverConnection().deleteRange(*m_transaction, *this, operationCallback);
</del><ins>+        completionCallback();
+    };
+
+    m_transaction-&gt;database().serverConnection().deleteRange(*m_transaction, *this, callback);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void ClearObjectStoreOperation::perform(std::function&lt;void()&gt; completionCallback)
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbIDBTransactionBackendOperationsh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/IDBTransactionBackendOperations.h (162855 => 162856)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/IDBTransactionBackendOperations.h        2014-01-27 20:31:09 UTC (rev 162855)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBTransactionBackendOperations.h        2014-01-27 20:34:55 UTC (rev 162856)
</span><span class="lines">@@ -89,7 +89,6 @@
</span><span class="cx"> 
</span><span class="cx">     IDBTransactionBackend* transaction() const { return m_transaction.get(); }
</span><span class="cx">     int64_t version() const { return m_version; }
</span><del>-    IDBCallbacks* callbacks() const { return m_callbacks.get(); }
</del><span class="cx">     IDBDatabaseCallbacks* databaseCallbacks() const { return m_databaseCallbacks.get(); }
</span><span class="cx"> 
</span><span class="cx"> private:
</span><span class="lines">@@ -362,7 +361,6 @@
</span><span class="cx">     IDBDatabaseBackend::TaskType taskType() const { return m_taskType; }
</span><span class="cx">     IDBKeyRange* keyRange() const { return m_keyRange.get(); }
</span><span class="cx">     IndexedDB::CursorDirection cursorDirection() const { return m_direction; }
</span><del>-    IDBCallbacks* callbacks() const { return m_callbacks.get(); }
</del><span class="cx"> 
</span><span class="cx"> private:
</span><span class="cx">     OpenCursorOperation(IDBTransactionBackend* transaction, int64_t objectStoreId, int64_t indexId, PassRefPtr&lt;IDBKeyRange&gt; keyRange, IndexedDB::CursorDirection direction, IndexedDB::CursorType cursorType, IDBDatabaseBackend::TaskType taskType, PassRefPtr&lt;IDBCallbacks&gt; callbacks)
</span><span class="lines">@@ -398,7 +396,7 @@
</span><span class="cx">     int64_t objectStoreID() const { return m_objectStoreID; }
</span><span class="cx">     int64_t indexID() const { return m_indexID; }
</span><span class="cx">     IDBKeyRange* keyRange() const { return m_keyRange.get(); }
</span><del>-    IDBCallbacks* callbacks() const { return m_callbacks.get(); }
</del><ins>+
</ins><span class="cx"> private:
</span><span class="cx">     CountOperation(IDBTransactionBackend* transaction, int64_t objectStoreId, int64_t indexId, PassRefPtr&lt;IDBKeyRange&gt; keyRange, PassRefPtr&lt;IDBCallbacks&gt; callbacks)
</span><span class="cx">         : m_transaction(transaction)
</span><span class="lines">@@ -425,7 +423,6 @@
</span><span class="cx">     virtual void perform(std::function&lt;void()&gt; successCallback) override final;
</span><span class="cx"> 
</span><span class="cx">     int64_t objectStoreID() const { return m_objectStoreID; }
</span><del>-    IDBCallbacks* callbacks() const { return m_callbacks.get(); }
</del><span class="cx">     IDBKeyRange* keyRange() const { return m_keyRange.get(); }
</span><span class="cx"> 
</span><span class="cx"> private:
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbleveldbIDBServerConnectionLevelDBcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/leveldb/IDBServerConnectionLevelDB.cpp (162855 => 162856)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/leveldb/IDBServerConnectionLevelDB.cpp        2014-01-27 20:31:09 UTC (rev 162855)
+++ trunk/Source/WebCore/Modules/indexeddb/leveldb/IDBServerConnectionLevelDB.cpp        2014-01-27 20:34:55 UTC (rev 162856)
</span><span class="lines">@@ -429,7 +429,7 @@
</span><span class="cx">     });
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void IDBServerConnectionLevelDB::openCursor(IDBTransactionBackend&amp; transaction, const OpenCursorOperation&amp; operation, std::function&lt;void(PassRefPtr&lt;IDBDatabaseError&gt;)&gt; completionCallback)
</del><ins>+void IDBServerConnectionLevelDB::openCursor(IDBTransactionBackend&amp; transaction, const OpenCursorOperation&amp; operation, std::function&lt;void(int64_t, PassRefPtr&lt;IDBDatabaseError&gt;)&gt; completionCallback)
</ins><span class="cx"> {
</span><span class="cx">     IDBBackingStoreTransactionLevelDB* backingStoreTransaction = m_backingStoreTransactions.get(transaction.id());
</span><span class="cx">     ASSERT(backingStoreTransaction);
</span><span class="lines">@@ -456,23 +456,16 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     if (!backingStoreCursor) {
</span><del>-        operation.callbacks()-&gt;onSuccess(static_cast&lt;SharedBuffer*&gt;(0));
-        callOnMainThread([completionCallback]() {
-            completionCallback(0);
-        });
-        return;
</del><ins>+        // FIXME: Should it be an error to not have a backing store cursor?
+        cursorID = 0;
</ins><span class="cx">     }
</span><span class="cx"> 
</span><del>-    IDBDatabaseBackend::TaskType taskType(static_cast&lt;IDBDatabaseBackend::TaskType&gt;(operation.taskType()));
-
-    RefPtr&lt;IDBCursorBackend&gt; cursor = IDBCursorBackend::create(cursorID, operation.cursorType(), taskType, transaction, operation.objectStoreID());
-
-    operation.callbacks()-&gt;onSuccess(cursor, cursor-&gt;key(), cursor-&gt;primaryKey(), cursor-&gt;value());
-
-    ASYNC_COMPLETION_CALLBACK_WITH_NULL_ARG(completionCallback);
</del><ins>+    callOnMainThread([completionCallback, cursorID]() {
+        completionCallback(cursorID, nullptr);
+    });
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void IDBServerConnectionLevelDB::count(IDBTransactionBackend&amp; transaction, const CountOperation&amp; operation, std::function&lt;void(PassRefPtr&lt;IDBDatabaseError&gt;)&gt; completionCallback)
</del><ins>+void IDBServerConnectionLevelDB::count(IDBTransactionBackend&amp; transaction, const CountOperation&amp; operation, std::function&lt;void(int64_t, PassRefPtr&lt;IDBDatabaseError&gt;)&gt; completionCallback)
</ins><span class="cx"> {
</span><span class="cx">     IDBBackingStoreTransactionLevelDB* backingStoreTransaction = m_backingStoreTransactions.get(transaction.id());
</span><span class="cx">     ASSERT(backingStoreTransaction);
</span><span class="lines">@@ -487,9 +480,9 @@
</span><span class="cx">     else
</span><span class="cx">         backingStoreCursor = m_backingStore-&gt;openIndexKeyCursor(cursorID, *backingStoreTransaction, transaction.database().id(), operation.objectStoreID(), operation.indexID(), operation.keyRange(), IndexedDB::CursorDirection::Next);
</span><span class="cx">     if (!backingStoreCursor) {
</span><del>-        operation.callbacks()-&gt;onSuccess(count);
-        callOnMainThread([completionCallback]() {
-            completionCallback(0);
</del><ins>+        // FIXME: Is this an error case?
+        callOnMainThread([completionCallback, count]() {
+            completionCallback(count, nullptr);
</ins><span class="cx">         });
</span><span class="cx">         return;
</span><span class="cx">     }
</span><span class="lines">@@ -498,8 +491,9 @@
</span><span class="cx">         ++count;
</span><span class="cx">     } while (backingStoreCursor-&gt;continueFunction(0));
</span><span class="cx"> 
</span><del>-    operation.callbacks()-&gt;onSuccess(count);
-    ASYNC_COMPLETION_CALLBACK_WITH_NULL_ARG(completionCallback);
</del><ins>+    callOnMainThread([completionCallback, count]() {
+        completionCallback(count, nullptr);
+    });
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void IDBServerConnectionLevelDB::deleteRange(IDBTransactionBackend&amp; transaction, const DeleteRangeOperation&amp; operation, std::function&lt;void(PassRefPtr&lt;IDBDatabaseError&gt;)&gt; completionCallback)
</span><span class="lines">@@ -513,17 +507,17 @@
</span><span class="cx">     if (backingStoreCursor) {
</span><span class="cx">         do {
</span><span class="cx">             if (!m_backingStore-&gt;deleteRecord(*backingStoreTransaction, transaction.database().id(), operation.objectStoreID(), backingStoreCursor-&gt;recordIdentifier())) {
</span><del>-                operation.callbacks()-&gt;onError(IDBDatabaseError::create(IDBDatabaseException::UnknownError, &quot;Error deleting data in range&quot;));
</del><span class="cx">                 callOnMainThread([completionCallback]() {
</span><del>-                    completionCallback(0);
</del><ins>+                    completionCallback(IDBDatabaseError::create(IDBDatabaseException::UnknownError, &quot;Error deleting data in range&quot;));
</ins><span class="cx">                 });
</span><span class="cx">                 return;
</span><span class="cx">             }
</span><span class="cx">         } while (backingStoreCursor-&gt;continueFunction(0));
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    operation.callbacks()-&gt;onSuccess();
-    ASYNC_COMPLETION_CALLBACK_WITH_NULL_ARG(completionCallback);
</del><ins>+    callOnMainThread([completionCallback]() {
+        completionCallback(nullptr);
+    });
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void IDBServerConnectionLevelDB::clearObjectStore(IDBTransactionBackend&amp; transaction, const ClearObjectStoreOperation&amp; operation, std::function&lt;void(PassRefPtr&lt;IDBDatabaseError&gt;)&gt; completionCallback)
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbleveldbIDBServerConnectionLevelDBh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/leveldb/IDBServerConnectionLevelDB.h (162855 => 162856)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/leveldb/IDBServerConnectionLevelDB.h        2014-01-27 20:31:09 UTC (rev 162855)
+++ trunk/Source/WebCore/Modules/indexeddb/leveldb/IDBServerConnectionLevelDB.h        2014-01-27 20:34:55 UTC (rev 162856)
</span><span class="lines">@@ -68,8 +68,8 @@
</span><span class="cx">     virtual void deleteIndex(IDBTransactionBackend&amp;, const DeleteIndexOperation&amp;, std::function&lt;void(PassRefPtr&lt;IDBDatabaseError&gt;)&gt; completionCallback) override;
</span><span class="cx">     virtual void get(IDBTransactionBackend&amp;, const GetOperation&amp;, std::function&lt;void(const IDBGetResult&amp;, PassRefPtr&lt;IDBDatabaseError&gt;)&gt; completionCallback) override;
</span><span class="cx">     virtual void put(IDBTransactionBackend&amp;, const PutOperation&amp;, std::function&lt;void(PassRefPtr&lt;IDBKey&gt;, PassRefPtr&lt;IDBDatabaseError&gt;)&gt; completionCallback)  override;
</span><del>-    virtual void openCursor(IDBTransactionBackend&amp;, const OpenCursorOperation&amp;, std::function&lt;void(PassRefPtr&lt;IDBDatabaseError&gt;)&gt; completionCallback) override;
-    virtual void count(IDBTransactionBackend&amp;, const CountOperation&amp;, std::function&lt;void(PassRefPtr&lt;IDBDatabaseError&gt;)&gt; completionCallback) override;
</del><ins>+    virtual void openCursor(IDBTransactionBackend&amp;, const OpenCursorOperation&amp;, std::function&lt;void(int64_t, PassRefPtr&lt;IDBDatabaseError&gt;)&gt; completionCallback) override;
+    virtual void count(IDBTransactionBackend&amp;, const CountOperation&amp;, std::function&lt;void(int64_t, PassRefPtr&lt;IDBDatabaseError&gt;)&gt; completionCallback) override;
</ins><span class="cx">     virtual void deleteRange(IDBTransactionBackend&amp;, const DeleteRangeOperation&amp;, std::function&lt;void(PassRefPtr&lt;IDBDatabaseError&gt;)&gt; completionCallback) override;
</span><span class="cx">     virtual void clearObjectStore(IDBTransactionBackend&amp;, const ClearObjectStoreOperation&amp;, std::function&lt;void(PassRefPtr&lt;IDBDatabaseError&gt;)&gt; completionCallback) override;
</span><span class="cx">     virtual void deleteObjectStore(IDBTransactionBackend&amp;, const DeleteObjectStoreOperation&amp;, std::function&lt;void(PassRefPtr&lt;IDBDatabaseError&gt;)&gt; completionCallback) override;
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (162855 => 162856)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2014-01-27 20:31:09 UTC (rev 162855)
+++ trunk/Source/WebKit2/ChangeLog        2014-01-27 20:34:55 UTC (rev 162856)
</span><span class="lines">@@ -1,3 +1,16 @@
</span><ins>+2014-01-27  Brady Eidson  &lt;beidson@apple.com&gt;
+
+        IDB: Refactor out the last of the operation callbacks that are called by the LevelDB backing store
+        https://bugs.webkit.org/show_bug.cgi?id=127592
+
+        Reviewed by Tim Horton.
+
+        Update the WebIDBServerConnection to the new callback signatures:
+        * WebProcess/Databases/IndexedDB/WebIDBServerConnection.cpp:
+        (WebKit::WebIDBServerConnection::openCursor):
+        (WebKit::WebIDBServerConnection::count):
+        * WebProcess/Databases/IndexedDB/WebIDBServerConnection.h:
+
</ins><span class="cx"> 2014-01-27  Tim Horton  &lt;timothy_horton@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         WebKit2 View Gestures: Fluid back-forward swipe
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessDatabasesIndexedDBWebIDBServerConnectioncpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/Databases/IndexedDB/WebIDBServerConnection.cpp (162855 => 162856)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/Databases/IndexedDB/WebIDBServerConnection.cpp        2014-01-27 20:31:09 UTC (rev 162855)
+++ trunk/Source/WebKit2/WebProcess/Databases/IndexedDB/WebIDBServerConnection.cpp        2014-01-27 20:34:55 UTC (rev 162856)
</span><span class="lines">@@ -420,11 +420,11 @@
</span><span class="cx">     serverRequest-&gt;completeRequest(getResult, errorCode ? IDBDatabaseError::create(errorCode, errorMessage) : nullptr);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void WebIDBServerConnection::openCursor(IDBTransactionBackend&amp;, const OpenCursorOperation&amp;, std::function&lt;void(PassRefPtr&lt;IDBDatabaseError&gt;)&gt; completionCallback)
</del><ins>+void WebIDBServerConnection::openCursor(IDBTransactionBackend&amp;, const OpenCursorOperation&amp;, std::function&lt;void(int64_t, PassRefPtr&lt;IDBDatabaseError&gt;)&gt; completionCallback)
</ins><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void WebIDBServerConnection::count(IDBTransactionBackend&amp;, const CountOperation&amp;, std::function&lt;void(PassRefPtr&lt;IDBDatabaseError&gt;)&gt; completionCallback)
</del><ins>+void WebIDBServerConnection::count(IDBTransactionBackend&amp;, const CountOperation&amp;, std::function&lt;void(int64_t, PassRefPtr&lt;IDBDatabaseError&gt;)&gt; completionCallback)
</ins><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessDatabasesIndexedDBWebIDBServerConnectionh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/Databases/IndexedDB/WebIDBServerConnection.h (162855 => 162856)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/Databases/IndexedDB/WebIDBServerConnection.h        2014-01-27 20:31:09 UTC (rev 162855)
+++ trunk/Source/WebKit2/WebProcess/Databases/IndexedDB/WebIDBServerConnection.h        2014-01-27 20:34:55 UTC (rev 162856)
</span><span class="lines">@@ -72,8 +72,8 @@
</span><span class="cx">     virtual void deleteIndex(WebCore::IDBTransactionBackend&amp;, const WebCore::DeleteIndexOperation&amp;, std::function&lt;void(PassRefPtr&lt;WebCore::IDBDatabaseError&gt;)&gt; completionCallback) override;
</span><span class="cx">     virtual void get(WebCore::IDBTransactionBackend&amp;, const WebCore::GetOperation&amp;, std::function&lt;void(const WebCore::IDBGetResult&amp;, PassRefPtr&lt;WebCore::IDBDatabaseError&gt;)&gt; completionCallback) override;
</span><span class="cx">     virtual void put(WebCore::IDBTransactionBackend&amp;, const WebCore::PutOperation&amp;, std::function&lt;void(PassRefPtr&lt;WebCore::IDBKey&gt;, PassRefPtr&lt;WebCore::IDBDatabaseError&gt;)&gt; completionCallback) override;
</span><del>-    virtual void openCursor(WebCore::IDBTransactionBackend&amp;, const WebCore::OpenCursorOperation&amp;, std::function&lt;void(PassRefPtr&lt;WebCore::IDBDatabaseError&gt;)&gt; completionCallback) override;
-    virtual void count(WebCore::IDBTransactionBackend&amp;, const WebCore::CountOperation&amp;, std::function&lt;void(PassRefPtr&lt;WebCore::IDBDatabaseError&gt;)&gt; completionCallback) override;
</del><ins>+    virtual void openCursor(WebCore::IDBTransactionBackend&amp;, const WebCore::OpenCursorOperation&amp;, std::function&lt;void(int64_t, PassRefPtr&lt;WebCore::IDBDatabaseError&gt;)&gt; completionCallback) override;
+    virtual void count(WebCore::IDBTransactionBackend&amp;, const WebCore::CountOperation&amp;, std::function&lt;void(int64_t, PassRefPtr&lt;WebCore::IDBDatabaseError&gt;)&gt; completionCallback) override;
</ins><span class="cx">     virtual void deleteRange(WebCore::IDBTransactionBackend&amp;, const WebCore::DeleteRangeOperation&amp;, std::function&lt;void(PassRefPtr&lt;WebCore::IDBDatabaseError&gt;)&gt; completionCallback) override;
</span><span class="cx">     virtual void clearObjectStore(WebCore::IDBTransactionBackend&amp;, const WebCore::ClearObjectStoreOperation&amp;, std::function&lt;void(PassRefPtr&lt;WebCore::IDBDatabaseError&gt;)&gt; completionCallback) override;
</span><span class="cx">     virtual void deleteObjectStore(WebCore::IDBTransactionBackend&amp;, const WebCore::DeleteObjectStoreOperation&amp;, std::function&lt;void(PassRefPtr&lt;WebCore::IDBDatabaseError&gt;)&gt; completionCallback) override;
</span></span></pre>
</div>
</div>

</body>
</html>