<!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>[204357] trunk/Source/WebCore</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/204357">204357</a></dd>
<dt>Author</dt> <dd>andersca@apple.com</dd>
<dt>Date</dt> <dd>2016-08-10 14:54:29 -0700 (Wed, 10 Aug 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>Move more functions to from SQLTransactionBackend to SQLTransaction
https://bugs.webkit.org/show_bug.cgi?id=160752

Reviewed by Tim Horton.

* Modules/webdatabase/SQLTransaction.cpp:
(WebCore::SQLTransaction::acquireLock):
(WebCore::SQLTransaction::openTransactionAndPreflight):
(WebCore::SQLTransaction::runStatements):
(WebCore::SQLTransaction::cleanupAndTerminate):
(WebCore::SQLTransaction::cleanupAfterTransactionErrorCallback):
* Modules/webdatabase/SQLTransaction.h:
* Modules/webdatabase/SQLTransactionBackend.cpp:
(WebCore::SQLTransactionBackend::acquireLock):
(WebCore::SQLTransactionBackend::openTransactionAndPreflight):
(WebCore::SQLTransactionBackend::runStatements):
(WebCore::SQLTransactionBackend::cleanupAndTerminate):
(WebCore::SQLTransactionBackend::cleanupAfterTransactionErrorCallback):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreModuleswebdatabaseSQLTransactioncpp">trunk/Source/WebCore/Modules/webdatabase/SQLTransaction.cpp</a></li>
<li><a href="#trunkSourceWebCoreModuleswebdatabaseSQLTransactionh">trunk/Source/WebCore/Modules/webdatabase/SQLTransaction.h</a></li>
<li><a href="#trunkSourceWebCoreModuleswebdatabaseSQLTransactionBackendcpp">trunk/Source/WebCore/Modules/webdatabase/SQLTransactionBackend.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (204356 => 204357)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-08-10 21:31:07 UTC (rev 204356)
+++ trunk/Source/WebCore/ChangeLog        2016-08-10 21:54:29 UTC (rev 204357)
</span><span class="lines">@@ -1,5 +1,26 @@
</span><span class="cx"> 2016-08-10  Anders Carlsson  &lt;andersca@apple.com&gt;
</span><span class="cx"> 
</span><ins>+        Move more functions to from SQLTransactionBackend to SQLTransaction
+        https://bugs.webkit.org/show_bug.cgi?id=160752
+
+        Reviewed by Tim Horton.
+
+        * Modules/webdatabase/SQLTransaction.cpp:
+        (WebCore::SQLTransaction::acquireLock):
+        (WebCore::SQLTransaction::openTransactionAndPreflight):
+        (WebCore::SQLTransaction::runStatements):
+        (WebCore::SQLTransaction::cleanupAndTerminate):
+        (WebCore::SQLTransaction::cleanupAfterTransactionErrorCallback):
+        * Modules/webdatabase/SQLTransaction.h:
+        * Modules/webdatabase/SQLTransactionBackend.cpp:
+        (WebCore::SQLTransactionBackend::acquireLock):
+        (WebCore::SQLTransactionBackend::openTransactionAndPreflight):
+        (WebCore::SQLTransactionBackend::runStatements):
+        (WebCore::SQLTransactionBackend::cleanupAndTerminate):
+        (WebCore::SQLTransactionBackend::cleanupAfterTransactionErrorCallback):
+
+2016-08-10  Anders Carlsson  &lt;andersca@apple.com&gt;
+
</ins><span class="cx">         Begin moving member functions from SQLTransactionBackend to SQLTransaction
</span><span class="cx">         https://bugs.webkit.org/show_bug.cgi?id=160747
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreModuleswebdatabaseSQLTransactioncpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/webdatabase/SQLTransaction.cpp (204356 => 204357)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/webdatabase/SQLTransaction.cpp        2016-08-10 21:31:07 UTC (rev 204356)
+++ trunk/Source/WebCore/Modules/webdatabase/SQLTransaction.cpp        2016-08-10 21:54:29 UTC (rev 204357)
</span><span class="lines">@@ -42,7 +42,8 @@
</span><span class="cx"> #include &quot;SQLStatementErrorCallback.h&quot;
</span><span class="cx"> #include &quot;SQLTransactionBackend.h&quot;
</span><span class="cx"> #include &quot;SQLTransactionCallback.h&quot;
</span><del>-#include &quot;SQLTransactionClient.h&quot; // FIXME: Should be used in the backend only.
</del><ins>+#include &quot;SQLTransactionClient.h&quot;
+#include &quot;SQLTransactionCoordinator.h&quot;
</ins><span class="cx"> #include &quot;SQLTransactionErrorCallback.h&quot;
</span><span class="cx"> #include &quot;SQLiteTransaction.h&quot;
</span><span class="cx"> #include &quot;VoidCallback.h&quot;
</span><span class="lines">@@ -162,6 +163,161 @@
</span><span class="cx">     m_database-&gt;scheduleTransactionCallback(this);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void SQLTransaction::acquireLock()
+{
+    m_database-&gt;transactionCoordinator()-&gt;acquireLock(*this);
+}
+
+void SQLTransaction::openTransactionAndPreflight()
+{
+    ASSERT(!m_database-&gt;sqliteDatabase().transactionInProgress());
+    ASSERT(m_lockAcquired);
+
+    LOG(StorageAPI, &quot;Opening and preflighting transaction %p&quot;, this);
+
+    // If the database was deleted, jump to the error callback
+    if (m_database-&gt;deleted()) {
+        m_transactionError = SQLError::create(SQLError::UNKNOWN_ERR, &quot;unable to open a transaction, because the user deleted the database&quot;);
+
+        handleTransactionError();
+        return;
+    }
+
+    // Set the maximum usage for this transaction if this transactions is not read-only
+    if (!m_readOnly) {
+        acquireOriginLock();
+        m_database-&gt;sqliteDatabase().setMaximumSize(m_database-&gt;maximumSize());
+    }
+
+    ASSERT(!m_sqliteTransaction);
+    m_sqliteTransaction = std::make_unique&lt;SQLiteTransaction&gt;(m_database-&gt;sqliteDatabase(), m_readOnly);
+
+    m_database-&gt;resetDeletes();
+    m_database-&gt;disableAuthorizer();
+    m_sqliteTransaction-&gt;begin();
+    m_database-&gt;enableAuthorizer();
+
+    // Spec 4.3.2.1+2: Open a transaction to the database, jumping to the error callback if that fails
+    if (!m_sqliteTransaction-&gt;inProgress()) {
+        ASSERT(!m_database-&gt;sqliteDatabase().transactionInProgress());
+        m_transactionError = SQLError::create(SQLError::DATABASE_ERR, &quot;unable to begin transaction&quot;, m_database-&gt;sqliteDatabase().lastError(), m_database-&gt;sqliteDatabase().lastErrorMsg());
+        m_sqliteTransaction = nullptr;
+
+        handleTransactionError();
+        return;
+    }
+
+    // Note: We intentionally retrieve the actual version even with an empty expected version.
+    // In multi-process browsers, we take this opportinutiy to update the cached value for
+    // the actual version. In single-process browsers, this is just a map lookup.
+    String actualVersion;
+    if (!m_database-&gt;getActualVersionForTransaction(actualVersion)) {
+        m_transactionError = SQLError::create(SQLError::DATABASE_ERR, &quot;unable to read version&quot;, m_database-&gt;sqliteDatabase().lastError(), m_database-&gt;sqliteDatabase().lastErrorMsg());
+        m_database-&gt;disableAuthorizer();
+        m_sqliteTransaction = nullptr;
+        m_database-&gt;enableAuthorizer();
+
+        handleTransactionError();
+        return;
+    }
+
+    m_hasVersionMismatch = !m_database-&gt;expectedVersion().isEmpty() &amp;&amp; (m_database-&gt;expectedVersion() != actualVersion);
+
+    // Spec 4.3.2.3: Perform preflight steps, jumping to the error callback if they fail
+    if (m_wrapper &amp;&amp; !m_wrapper-&gt;performPreflight(*this)) {
+        m_database-&gt;disableAuthorizer();
+        m_sqliteTransaction = nullptr;
+        m_database-&gt;enableAuthorizer();
+        m_transactionError = m_wrapper-&gt;sqlError();
+        if (!m_transactionError)
+            m_transactionError = SQLError::create(SQLError::UNKNOWN_ERR, &quot;unknown error occurred during transaction preflight&quot;);
+
+        handleTransactionError();
+        return;
+    }
+
+    // Spec 4.3.2.4: Invoke the transaction callback with the new SQLTransaction object
+    if (m_callbackWrapper.hasCallback()) {
+        requestTransitToState(SQLTransactionState::DeliverTransactionCallback);
+        return;
+    }
+
+    // If we have no callback to make, skip pass to the state after:
+    runStatements();
+}
+
+void SQLTransaction::runStatements()
+{
+    ASSERT(m_lockAcquired);
+
+    // If there is a series of statements queued up that are all successful and have no associated
+    // SQLStatementCallback objects, then we can burn through the queue
+    do {
+        if (m_shouldRetryCurrentStatement &amp;&amp; !m_sqliteTransaction-&gt;wasRolledBackBySqlite()) {
+            m_shouldRetryCurrentStatement = false;
+            // FIXME - Another place that needs fixing up after &lt;rdar://problem/5628468&gt; is addressed.
+            // See ::openTransactionAndPreflight() for discussion
+
+            // Reset the maximum size here, as it was increased to allow us to retry this statement.
+            // m_shouldRetryCurrentStatement is set to true only when a statement exceeds
+            // the quota, which can happen only in a read-write transaction. Therefore, there
+            // is no need to check here if the transaction is read-write.
+            m_database-&gt;sqliteDatabase().setMaximumSize(m_database-&gt;maximumSize());
+        } else {
+            // If the current statement has already been run, failed due to quota constraints, and we're not retrying it,
+            // that means it ended in an error. Handle it now
+            if (m_currentStatement &amp;&amp; m_currentStatement-&gt;lastExecutionFailedDueToQuota()) {
+                handleCurrentStatementError();
+                break;
+            }
+
+            // Otherwise, advance to the next statement
+            getNextStatement();
+        }
+    } while (runCurrentStatement());
+
+    // If runCurrentStatement() returned false, that means either there was no current statement to run,
+    // or the current statement requires a callback to complete. In the later case, it also scheduled
+    // the callback or performed any other additional work so we can return.
+    if (!m_currentStatement)
+        postflightAndCommit();
+}
+
+void SQLTransaction::cleanupAndTerminate()
+{
+    ASSERT(m_lockAcquired);
+
+    // Spec 4.3.2.9: End transaction steps. There is no next step.
+    LOG(StorageAPI, &quot;Transaction %p is complete\n&quot;, this);
+    ASSERT(!m_database-&gt;sqliteDatabase().transactionInProgress());
+
+    // Phase 5 cleanup. See comment on the SQLTransaction life-cycle above.
+    m_backend.doCleanup();
+    m_database-&gt;inProgressTransactionCompleted();
+}
+
+void SQLTransaction::cleanupAfterTransactionErrorCallback()
+{
+    ASSERT(m_lockAcquired);
+
+    LOG(StorageAPI, &quot;Transaction %p is complete with an error\n&quot;, this);
+    m_database-&gt;disableAuthorizer();
+    if (m_sqliteTransaction) {
+        // Spec 4.3.2.10: Rollback the transaction.
+        m_sqliteTransaction-&gt;rollback();
+
+        ASSERT(!m_database-&gt;sqliteDatabase().transactionInProgress());
+        m_sqliteTransaction = nullptr;
+    }
+    m_database-&gt;enableAuthorizer();
+
+    releaseOriginLockIfNeeded();
+
+    ASSERT(!m_database-&gt;sqliteDatabase().transactionInProgress());
+
+    cleanupAndTerminate();
+}
+
</ins><span class="cx"> void SQLTransaction::deliverTransactionCallback()
</span><span class="cx"> {
</span><span class="cx">     bool shouldDeliverErrorCallback = false;
</span></span></pre></div>
<a id="trunkSourceWebCoreModuleswebdatabaseSQLTransactionh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/webdatabase/SQLTransaction.h (204356 => 204357)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/webdatabase/SQLTransaction.h        2016-08-10 21:31:07 UTC (rev 204356)
+++ trunk/Source/WebCore/Modules/webdatabase/SQLTransaction.h        2016-08-10 21:54:29 UTC (rev 204357)
</span><span class="lines">@@ -89,6 +89,11 @@
</span><span class="cx">     void computeNextStateAndCleanupIfNeeded();
</span><span class="cx"> 
</span><span class="cx">     // State functions:
</span><ins>+    void acquireLock();
+    void openTransactionAndPreflight();
+    void runStatements();
+    void cleanupAndTerminate();
+    void cleanupAfterTransactionErrorCallback();
</ins><span class="cx">     void deliverTransactionCallback();
</span><span class="cx">     void deliverTransactionErrorCallback();
</span><span class="cx">     void deliverStatementCallback();
</span></span></pre></div>
<a id="trunkSourceWebCoreModuleswebdatabaseSQLTransactionBackendcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/webdatabase/SQLTransactionBackend.cpp (204356 => 204357)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/webdatabase/SQLTransactionBackend.cpp        2016-08-10 21:31:07 UTC (rev 204356)
+++ trunk/Source/WebCore/Modules/webdatabase/SQLTransactionBackend.cpp        2016-08-10 21:54:29 UTC (rev 204357)
</span><span class="lines">@@ -480,157 +480,27 @@
</span><span class="cx"> 
</span><span class="cx"> void SQLTransactionBackend::acquireLock()
</span><span class="cx"> {
</span><del>-    m_frontend.m_database-&gt;transactionCoordinator()-&gt;acquireLock(m_frontend);
</del><ins>+    m_frontend.acquireLock();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void SQLTransactionBackend::openTransactionAndPreflight()
</span><span class="cx"> {
</span><del>-    ASSERT(!m_frontend.m_database-&gt;sqliteDatabase().transactionInProgress());
-    ASSERT(m_frontend.m_lockAcquired);
-
-    LOG(StorageAPI, &quot;Opening and preflighting transaction %p&quot;, this);
-
-    // If the database was deleted, jump to the error callback
-    if (m_frontend.m_database-&gt;deleted()) {
-        m_frontend.m_transactionError = SQLError::create(SQLError::UNKNOWN_ERR, &quot;unable to open a transaction, because the user deleted the database&quot;);
-
-        m_frontend.handleTransactionError();
-        return;
-    }
-
-    // Set the maximum usage for this transaction if this transactions is not read-only
-    if (!m_frontend.m_readOnly) {
-        m_frontend.acquireOriginLock();
-        m_frontend.m_database-&gt;sqliteDatabase().setMaximumSize(m_frontend.m_database-&gt;maximumSize());
-    }
-
-    ASSERT(!m_frontend.m_sqliteTransaction);
-    m_frontend.m_sqliteTransaction = std::make_unique&lt;SQLiteTransaction&gt;(m_frontend.m_database-&gt;sqliteDatabase(), m_frontend.m_readOnly);
-
-    m_frontend.m_database-&gt;resetDeletes();
-    m_frontend.m_database-&gt;disableAuthorizer();
-    m_frontend.m_sqliteTransaction-&gt;begin();
-    m_frontend.m_database-&gt;enableAuthorizer();
-
-    // Spec 4.3.2.1+2: Open a transaction to the database, jumping to the error callback if that fails
-    if (!m_frontend.m_sqliteTransaction-&gt;inProgress()) {
-        ASSERT(!m_frontend.m_database-&gt;sqliteDatabase().transactionInProgress());
-        m_frontend.m_transactionError = SQLError::create(SQLError::DATABASE_ERR, &quot;unable to begin transaction&quot;, m_frontend.m_database-&gt;sqliteDatabase().lastError(), m_frontend.m_database-&gt;sqliteDatabase().lastErrorMsg());
-        m_frontend.m_sqliteTransaction = nullptr;
-
-        m_frontend.handleTransactionError();
-        return;
-    }
-
-    // Note: We intentionally retrieve the actual version even with an empty expected version.
-    // In multi-process browsers, we take this opportinutiy to update the cached value for
-    // the actual version. In single-process browsers, this is just a map lookup.
-    String actualVersion;
-    if (!m_frontend.m_database-&gt;getActualVersionForTransaction(actualVersion)) {
-        m_frontend.m_transactionError = SQLError::create(SQLError::DATABASE_ERR, &quot;unable to read version&quot;, m_frontend.m_database-&gt;sqliteDatabase().lastError(), m_frontend.m_database-&gt;sqliteDatabase().lastErrorMsg());
-        m_frontend.m_database-&gt;disableAuthorizer();
-        m_frontend.m_sqliteTransaction = nullptr;
-        m_frontend.m_database-&gt;enableAuthorizer();
-
-        m_frontend.handleTransactionError();
-        return;
-    }
-
-    m_frontend.m_hasVersionMismatch = !m_frontend.m_database-&gt;expectedVersion().isEmpty() &amp;&amp; (m_frontend.m_database-&gt;expectedVersion() != actualVersion);
-
-    // Spec 4.3.2.3: Perform preflight steps, jumping to the error callback if they fail
-    if (m_frontend.m_wrapper &amp;&amp; !m_frontend.m_wrapper-&gt;performPreflight(m_frontend)) {
-        m_frontend.m_database-&gt;disableAuthorizer();
-        m_frontend.m_sqliteTransaction = nullptr;
-        m_frontend.m_database-&gt;enableAuthorizer();
-        m_frontend.m_transactionError = m_frontend.m_wrapper-&gt;sqlError();
-        if (!m_frontend.m_transactionError)
-            m_frontend.m_transactionError = SQLError::create(SQLError::UNKNOWN_ERR, &quot;unknown error occurred during transaction preflight&quot;);
-
-        m_frontend.handleTransactionError();
-        return;
-    }
-
-    // Spec 4.3.2.4: Invoke the transaction callback with the new SQLTransaction object
-    if (m_frontend.m_callbackWrapper.hasCallback()) {
-        m_frontend.requestTransitToState(SQLTransactionState::DeliverTransactionCallback);
-        return;
-    }
-
-    // If we have no callback to make, skip pass to the state after:
-    runStatements();
</del><ins>+    m_frontend.openTransactionAndPreflight();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void SQLTransactionBackend::runStatements()
</span><span class="cx"> {
</span><del>-    ASSERT(m_frontend.m_lockAcquired);
-
-    // If there is a series of statements queued up that are all successful and have no associated
-    // SQLStatementCallback objects, then we can burn through the queue
-    do {
-        if (m_frontend.m_shouldRetryCurrentStatement &amp;&amp; !m_frontend.m_sqliteTransaction-&gt;wasRolledBackBySqlite()) {
-            m_frontend.m_shouldRetryCurrentStatement = false;
-            // FIXME - Another place that needs fixing up after &lt;rdar://problem/5628468&gt; is addressed.
-            // See ::openTransactionAndPreflight() for discussion
-
-            // Reset the maximum size here, as it was increased to allow us to retry this statement.
-            // m_shouldRetryCurrentStatement is set to true only when a statement exceeds
-            // the quota, which can happen only in a read-write transaction. Therefore, there
-            // is no need to check here if the transaction is read-write.
-            m_frontend.m_database-&gt;sqliteDatabase().setMaximumSize(m_frontend.m_database-&gt;maximumSize());
-        } else {
-            // If the current statement has already been run, failed due to quota constraints, and we're not retrying it,
-            // that means it ended in an error. Handle it now
-            if (m_frontend.m_currentStatement &amp;&amp; m_frontend.m_currentStatement-&gt;lastExecutionFailedDueToQuota()) {
-                m_frontend.handleCurrentStatementError();
-                break;
-            }
-
-            // Otherwise, advance to the next statement
-            m_frontend.getNextStatement();
-        }
-    } while (m_frontend.runCurrentStatement());
-
-    // If runCurrentStatement() returned false, that means either there was no current statement to run,
-    // or the current statement requires a callback to complete. In the later case, it also scheduled
-    // the callback or performed any other additional work so we can return.
-    if (!m_frontend.m_currentStatement)
-        m_frontend.postflightAndCommit();
</del><ins>+    m_frontend.runStatements();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void SQLTransactionBackend::cleanupAndTerminate()
</span><span class="cx"> {
</span><del>-    ASSERT(m_frontend.m_lockAcquired);
-
-    // Spec 4.3.2.9: End transaction steps. There is no next step.
-    LOG(StorageAPI, &quot;Transaction %p is complete\n&quot;, this);
-    ASSERT(!m_frontend.m_database-&gt;sqliteDatabase().transactionInProgress());
-
-    // Phase 5 cleanup. See comment on the SQLTransaction life-cycle above.
-    doCleanup();
-    m_frontend.m_database-&gt;inProgressTransactionCompleted();
</del><ins>+    m_frontend.cleanupAndTerminate();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void SQLTransactionBackend::cleanupAfterTransactionErrorCallback()
</span><span class="cx"> {
</span><del>-    ASSERT(m_frontend.m_lockAcquired);
-
-    LOG(StorageAPI, &quot;Transaction %p is complete with an error\n&quot;, this);
-    m_frontend.m_database-&gt;disableAuthorizer();
-    if (m_frontend.m_sqliteTransaction) {
-        // Spec 4.3.2.10: Rollback the transaction.
-        m_frontend.m_sqliteTransaction-&gt;rollback();
-
-        ASSERT(!m_frontend.m_database-&gt;sqliteDatabase().transactionInProgress());
-        m_frontend.m_sqliteTransaction = nullptr;
-    }
-    m_frontend.m_database-&gt;enableAuthorizer();
-
-    m_frontend.releaseOriginLockIfNeeded();
-
-    ASSERT(!m_frontend.m_database-&gt;sqliteDatabase().transactionInProgress());
-
-    cleanupAndTerminate();
</del><ins>+    m_frontend.cleanupAfterTransactionErrorCallback();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> // requestTransitToState() can be called from the frontend. Hence, it should
</span></span></pre>
</div>
</div>

</body>
</html>