<!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>[204333] 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/204333">204333</a></dd>
<dt>Author</dt> <dd>andersca@apple.com</dd>
<dt>Date</dt> <dd>2016-08-10 09:47:12 -0700 (Wed, 10 Aug 2016)</dd>
</dl>
<h3>Log Message</h3>
<pre>Move SQLTransactionBackend construction inside SQLTransaction
https://bugs.webkit.org/show_bug.cgi?id=160726
Reviewed by Tim Horton.
This is the first step towards re-merging SQLTransactionBackend and SQLTransaction and clean up the code.
* Modules/webdatabase/ChangeVersionWrapper.cpp:
* Modules/webdatabase/ChangeVersionWrapper.h:
* Modules/webdatabase/Database.cpp:
(WebCore::Database::performClose):
(WebCore::Database::scheduleTransactionStep):
(WebCore::Database::changeVersion):
(WebCore::Database::transaction):
(WebCore::Database::readTransaction):
(WebCore::Database::runTransaction):
* Modules/webdatabase/Database.h:
* Modules/webdatabase/DatabaseTask.cpp:
* Modules/webdatabase/SQLTransaction.cpp:
(WebCore::SQLTransaction::create):
(WebCore::SQLTransaction::SQLTransaction):
* Modules/webdatabase/SQLTransaction.h:
(WebCore::SQLTransactionWrapper::~SQLTransactionWrapper):
(WebCore::SQLTransaction::backend):
* Modules/webdatabase/SQLTransactionBackend.cpp:
(WebCore::SQLTransactionBackend::lockAcquired):
(WebCore::SQLTransactionBackend::requestTransitToState):
* Modules/webdatabase/SQLTransactionBackend.h:
(WebCore::SQLTransactionWrapper::~SQLTransactionWrapper): Deleted.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreModuleswebdatabaseChangeVersionWrappercpp">trunk/Source/WebCore/Modules/webdatabase/ChangeVersionWrapper.cpp</a></li>
<li><a href="#trunkSourceWebCoreModuleswebdatabaseChangeVersionWrapperh">trunk/Source/WebCore/Modules/webdatabase/ChangeVersionWrapper.h</a></li>
<li><a href="#trunkSourceWebCoreModuleswebdatabaseDatabasecpp">trunk/Source/WebCore/Modules/webdatabase/Database.cpp</a></li>
<li><a href="#trunkSourceWebCoreModuleswebdatabaseDatabaseh">trunk/Source/WebCore/Modules/webdatabase/Database.h</a></li>
<li><a href="#trunkSourceWebCoreModuleswebdatabaseDatabaseTaskcpp">trunk/Source/WebCore/Modules/webdatabase/DatabaseTask.cpp</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>
<li><a href="#trunkSourceWebCoreModuleswebdatabaseSQLTransactionBackendh">trunk/Source/WebCore/Modules/webdatabase/SQLTransactionBackend.h</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (204332 => 204333)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-08-10 15:57:10 UTC (rev 204332)
+++ trunk/Source/WebCore/ChangeLog        2016-08-10 16:47:12 UTC (rev 204333)
</span><span class="lines">@@ -1,3 +1,35 @@
</span><ins>+2016-08-09 Anders Carlsson <andersca@apple.com>
+
+ Move SQLTransactionBackend construction inside SQLTransaction
+ https://bugs.webkit.org/show_bug.cgi?id=160726
+
+ Reviewed by Tim Horton.
+
+ This is the first step towards re-merging SQLTransactionBackend and SQLTransaction and clean up the code.
+
+ * Modules/webdatabase/ChangeVersionWrapper.cpp:
+ * Modules/webdatabase/ChangeVersionWrapper.h:
+ * Modules/webdatabase/Database.cpp:
+ (WebCore::Database::performClose):
+ (WebCore::Database::scheduleTransactionStep):
+ (WebCore::Database::changeVersion):
+ (WebCore::Database::transaction):
+ (WebCore::Database::readTransaction):
+ (WebCore::Database::runTransaction):
+ * Modules/webdatabase/Database.h:
+ * Modules/webdatabase/DatabaseTask.cpp:
+ * Modules/webdatabase/SQLTransaction.cpp:
+ (WebCore::SQLTransaction::create):
+ (WebCore::SQLTransaction::SQLTransaction):
+ * Modules/webdatabase/SQLTransaction.h:
+ (WebCore::SQLTransactionWrapper::~SQLTransactionWrapper):
+ (WebCore::SQLTransaction::backend):
+ * Modules/webdatabase/SQLTransactionBackend.cpp:
+ (WebCore::SQLTransactionBackend::lockAcquired):
+ (WebCore::SQLTransactionBackend::requestTransitToState):
+ * Modules/webdatabase/SQLTransactionBackend.h:
+ (WebCore::SQLTransactionWrapper::~SQLTransactionWrapper): Deleted.
+
</ins><span class="cx"> 2016-08-10 Chris Dumez <cdumez@apple.com>
</span><span class="cx">
</span><span class="cx"> It should be possible to re-initialize a MutationEvent after it's been dispatched
</span></span></pre></div>
<a id="trunkSourceWebCoreModuleswebdatabaseChangeVersionWrappercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/webdatabase/ChangeVersionWrapper.cpp (204332 => 204333)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/webdatabase/ChangeVersionWrapper.cpp        2016-08-10 15:57:10 UTC (rev 204332)
+++ trunk/Source/WebCore/Modules/webdatabase/ChangeVersionWrapper.cpp        2016-08-10 16:47:12 UTC (rev 204333)
</span><span class="lines">@@ -30,6 +30,7 @@
</span><span class="cx">
</span><span class="cx"> #include "Database.h"
</span><span class="cx"> #include "SQLError.h"
</span><ins>+#include "SQLTransactionBackend.h"
</ins><span class="cx"> #include <wtf/RefPtr.h>
</span><span class="cx">
</span><span class="cx"> namespace WebCore {
</span></span></pre></div>
<a id="trunkSourceWebCoreModuleswebdatabaseChangeVersionWrapperh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/webdatabase/ChangeVersionWrapper.h (204332 => 204333)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/webdatabase/ChangeVersionWrapper.h        2016-08-10 15:57:10 UTC (rev 204332)
+++ trunk/Source/WebCore/Modules/webdatabase/ChangeVersionWrapper.h        2016-08-10 16:47:12 UTC (rev 204333)
</span><span class="lines">@@ -28,7 +28,7 @@
</span><span class="cx"> #ifndef ChangeVersionWrapper_h
</span><span class="cx"> #define ChangeVersionWrapper_h
</span><span class="cx">
</span><del>-#include "SQLTransactionBackend.h"
</del><ins>+#include "SQLTransaction.h"
</ins><span class="cx"> #include <wtf/Forward.h>
</span><span class="cx">
</span><span class="cx"> namespace WebCore {
</span></span></pre></div>
<a id="trunkSourceWebCoreModuleswebdatabaseDatabasecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/webdatabase/Database.cpp (204332 => 204333)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/webdatabase/Database.cpp        2016-08-10 15:57:10 UTC (rev 204332)
+++ trunk/Source/WebCore/Modules/webdatabase/Database.cpp        2016-08-10 16:47:12 UTC (rev 204333)
</span><span class="lines">@@ -312,9 +312,8 @@
</span><span class="cx"> // Clean up transactions that have not been scheduled yet:
</span><span class="cx"> // Transaction phase 1 cleanup. See comment on "What happens if a
</span><span class="cx"> // transaction is interrupted?" at the top of SQLTransactionBackend.cpp.
</span><del>- RefPtr<SQLTransactionBackend> transaction;
</del><span class="cx"> while (!m_transactionQueue.isEmpty()) {
</span><del>- transaction = m_transactionQueue.takeFirst();
</del><ins>+ auto transaction = m_transactionQueue.takeFirst();
</ins><span class="cx"> transaction->notifyDatabaseThreadIsShuttingDown();
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -576,30 +575,12 @@
</span><span class="cx"> m_transactionInProgress = false;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-RefPtr<SQLTransactionBackend> Database::runTransaction(Ref<SQLTransaction>&& transaction, bool readOnly, const ChangeVersionData* data)
</del><ins>+void Database::scheduleTransactionStep(SQLTransactionBackend& transaction)
</ins><span class="cx"> {
</span><del>- LockHolder locker(m_transactionInProgressMutex);
- if (!m_isTransactionQueueEnabled)
- return nullptr;
-
- RefPtr<SQLTransactionWrapper> wrapper;
- if (data)
- wrapper = ChangeVersionWrapper::create(data->oldVersion(), data->newVersion());
-
- RefPtr<SQLTransactionBackend> transactionBackend = SQLTransactionBackend::create(this, WTFMove(transaction), WTFMove(wrapper), readOnly);
- m_transactionQueue.append(transactionBackend);
- if (!m_transactionInProgress)
- scheduleTransaction();
-
- return transactionBackend;
-}
-
-void Database::scheduleTransactionStep(SQLTransactionBackend* transaction)
-{
</del><span class="cx"> if (!databaseContext()->databaseThread())
</span><span class="cx"> return;
</span><span class="cx">
</span><del>- auto task = std::make_unique<DatabaseTransactionTask>(transaction);
</del><ins>+ auto task = std::make_unique<DatabaseTransactionTask>(&transaction);
</ins><span class="cx"> LOG(StorageAPI, "Scheduling DatabaseTransactionTask %p for the transaction step\n", task.get());
</span><span class="cx"> databaseContext()->databaseThread()->scheduleTask(WTFMove(task));
</span><span class="cx"> }
</span><span class="lines">@@ -651,18 +632,17 @@
</span><span class="cx">
</span><span class="cx"> void Database::changeVersion(const String& oldVersion, const String& newVersion, RefPtr<SQLTransactionCallback>&& callback, RefPtr<SQLTransactionErrorCallback>&& errorCallback, RefPtr<VoidCallback>&& successCallback)
</span><span class="cx"> {
</span><del>- ChangeVersionData data(oldVersion, newVersion);
- runTransaction(WTFMove(callback), WTFMove(errorCallback), WTFMove(successCallback), false, &data);
</del><ins>+ runTransaction(WTFMove(callback), WTFMove(errorCallback), WTFMove(successCallback), ChangeVersionWrapper::create(oldVersion, newVersion), false);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void Database::transaction(RefPtr<SQLTransactionCallback>&& callback, RefPtr<SQLTransactionErrorCallback>&& errorCallback, RefPtr<VoidCallback>&& successCallback)
</span><span class="cx"> {
</span><del>- runTransaction(WTFMove(callback), WTFMove(errorCallback), WTFMove(successCallback), false);
</del><ins>+ runTransaction(WTFMove(callback), WTFMove(errorCallback), WTFMove(successCallback), nullptr, false);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void Database::readTransaction(RefPtr<SQLTransactionCallback>&& callback, RefPtr<SQLTransactionErrorCallback>&& errorCallback, RefPtr<VoidCallback>&& successCallback)
</span><span class="cx"> {
</span><del>- runTransaction(WTFMove(callback), WTFMove(errorCallback), WTFMove(successCallback), true);
</del><ins>+ runTransaction(WTFMove(callback), WTFMove(errorCallback), WTFMove(successCallback), nullptr, true);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> String Database::stringIdentifier() const
</span><span class="lines">@@ -742,17 +722,23 @@
</span><span class="cx"> m_databaseAuthorizer->reset();
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void Database::runTransaction(RefPtr<SQLTransactionCallback>&& callback, RefPtr<SQLTransactionErrorCallback>&& errorCallback, RefPtr<VoidCallback>&& successCallback, bool readOnly, const ChangeVersionData* changeVersionData)
</del><ins>+void Database::runTransaction(RefPtr<SQLTransactionCallback>&& callback, RefPtr<SQLTransactionErrorCallback>&& errorCallback, RefPtr<VoidCallback>&& successCallback, RefPtr<SQLTransactionWrapper>&& wrapper, bool readOnly)
</ins><span class="cx"> {
</span><del>- Ref<SQLTransaction> transaction = SQLTransaction::create(*this, WTFMove(callback), WTFMove(successCallback), errorCallback.copyRef(), readOnly);
</del><ins>+ LockHolder locker(m_transactionInProgressMutex);
+ if (!m_isTransactionQueueEnabled) {
+ if (errorCallback) {
+ RefPtr<SQLTransactionErrorCallback> errorCallbackProtector = WTFMove(errorCallback);
+ m_scriptExecutionContext->postTask([errorCallbackProtector](ScriptExecutionContext&) {
+ errorCallbackProtector->handleEvent(SQLError::create(SQLError::UNKNOWN_ERR, "database has been closed").ptr());
+ });
+ }
+ return;
+ }
</ins><span class="cx">
</span><del>- RefPtr<SQLTransactionBackend> transactionBackend = runTransaction(WTFMove(transaction), readOnly, changeVersionData);
- if (!transactionBackend && errorCallback) {
- RefPtr<SQLTransactionErrorCallback> errorCallbackProtector = WTFMove(errorCallback);
- m_scriptExecutionContext->postTask([errorCallbackProtector](ScriptExecutionContext&) {
- errorCallbackProtector->handleEvent(SQLError::create(SQLError::UNKNOWN_ERR, "database has been closed").ptr());
- });
- }
</del><ins>+ auto transaction = SQLTransaction::create(*this, WTFMove(callback), WTFMove(successCallback), errorCallback.copyRef(), WTFMove(wrapper), readOnly);
+ m_transactionQueue.append(&transaction->backend());
+ if (!m_transactionInProgress)
+ scheduleTransaction();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void Database::scheduleTransactionCallback(SQLTransaction* transaction)
</span></span></pre></div>
<a id="trunkSourceWebCoreModuleswebdatabaseDatabaseh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/webdatabase/Database.h (204332 => 204333)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/webdatabase/Database.h        2016-08-10 15:57:10 UTC (rev 204332)
+++ trunk/Source/WebCore/Modules/webdatabase/Database.h        2016-08-10 16:47:12 UTC (rev 204333)
</span><span class="lines">@@ -38,7 +38,6 @@
</span><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><del>-class ChangeVersionData;
</del><span class="cx"> class DatabaseCallback;
</span><span class="cx"> class DatabaseDetails;
</span><span class="cx"> class DatabaseContext;
</span><span class="lines">@@ -50,6 +49,7 @@
</span><span class="cx"> class SQLTransactionClient;
</span><span class="cx"> class SQLTransactionCoordinator;
</span><span class="cx"> class SQLTransactionErrorCallback;
</span><ins>+class SQLTransactionWrapper;
</ins><span class="cx"> class VoidCallback;
</span><span class="cx">
</span><span class="cx"> class Database final : public ThreadSafeRefCounted<Database> {
</span><span class="lines">@@ -66,8 +66,7 @@
</span><span class="cx">
</span><span class="cx"> unsigned long long maximumSize() const;
</span><span class="cx">
</span><del>- RefPtr<SQLTransactionBackend> runTransaction(Ref<SQLTransaction>&&, bool readOnly, const ChangeVersionData*);
- void scheduleTransactionStep(SQLTransactionBackend*);
</del><ins>+ void scheduleTransactionStep(SQLTransactionBackend&);
</ins><span class="cx"> void inProgressTransactionCompleted();
</span><span class="cx">
</span><span class="cx"> bool hasPendingTransaction();
</span><span class="lines">@@ -139,7 +138,7 @@
</span><span class="cx">
</span><span class="cx"> void scheduleTransaction();
</span><span class="cx">
</span><del>- void runTransaction(RefPtr<SQLTransactionCallback>&&, RefPtr<SQLTransactionErrorCallback>&&, RefPtr<VoidCallback>&& successCallback, bool readOnly, const ChangeVersionData* = nullptr);
</del><ins>+ void runTransaction(RefPtr<SQLTransactionCallback>&&, RefPtr<SQLTransactionErrorCallback>&&, RefPtr<VoidCallback>&& successCallback, RefPtr<SQLTransactionWrapper>&&, bool readOnly);
</ins><span class="cx">
</span><span class="cx"> #if !LOG_DISABLED || !ERROR_DISABLED
</span><span class="cx"> String databaseDebugName() const;
</span></span></pre></div>
<a id="trunkSourceWebCoreModuleswebdatabaseDatabaseTaskcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/webdatabase/DatabaseTask.cpp (204332 => 204333)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/webdatabase/DatabaseTask.cpp        2016-08-10 15:57:10 UTC (rev 204332)
+++ trunk/Source/WebCore/Modules/webdatabase/DatabaseTask.cpp        2016-08-10 16:47:12 UTC (rev 204333)
</span><span class="lines">@@ -30,6 +30,7 @@
</span><span class="cx">
</span><span class="cx"> #include "Database.h"
</span><span class="cx"> #include "Logging.h"
</span><ins>+#include "SQLTransaction.h"
</ins><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoreModuleswebdatabaseSQLTransactioncpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/webdatabase/SQLTransaction.cpp (204332 => 204333)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/webdatabase/SQLTransaction.cpp        2016-08-10 15:57:10 UTC (rev 204332)
+++ trunk/Source/WebCore/Modules/webdatabase/SQLTransaction.cpp        2016-08-10 16:47:12 UTC (rev 204333)
</span><span class="lines">@@ -48,12 +48,12 @@
</span><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><del>-Ref<SQLTransaction> SQLTransaction::create(Ref<Database>&& database, RefPtr<SQLTransactionCallback>&& callback, RefPtr<VoidCallback>&& successCallback, RefPtr<SQLTransactionErrorCallback>&& errorCallback, bool readOnly)
</del><ins>+Ref<SQLTransaction> SQLTransaction::create(Ref<Database>&& database, RefPtr<SQLTransactionCallback>&& callback, RefPtr<VoidCallback>&& successCallback, RefPtr<SQLTransactionErrorCallback>&& errorCallback, RefPtr<SQLTransactionWrapper>&& wrapper, bool readOnly)
</ins><span class="cx"> {
</span><del>- return adoptRef(*new SQLTransaction(WTFMove(database), WTFMove(callback), WTFMove(successCallback), WTFMove(errorCallback), readOnly));
</del><ins>+ return adoptRef(*new SQLTransaction(WTFMove(database), WTFMove(callback), WTFMove(successCallback), WTFMove(errorCallback), WTFMove(wrapper), readOnly));
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-SQLTransaction::SQLTransaction(Ref<Database>&& database, RefPtr<SQLTransactionCallback>&& callback, RefPtr<VoidCallback>&& successCallback, RefPtr<SQLTransactionErrorCallback>&& errorCallback, bool readOnly)
</del><ins>+SQLTransaction::SQLTransaction(Ref<Database>&& database, RefPtr<SQLTransactionCallback>&& callback, RefPtr<VoidCallback>&& successCallback, RefPtr<SQLTransactionErrorCallback>&& errorCallback, RefPtr<SQLTransactionWrapper>&& wrapper, bool readOnly)
</ins><span class="cx"> : m_database(WTFMove(database))
</span><span class="cx"> , m_callbackWrapper(WTFMove(callback), m_database->scriptExecutionContext())
</span><span class="cx"> , m_successCallbackWrapper(WTFMove(successCallback), m_database->scriptExecutionContext())
</span><span class="lines">@@ -61,6 +61,8 @@
</span><span class="cx"> , m_executeSqlAllowed(false)
</span><span class="cx"> , m_readOnly(readOnly)
</span><span class="cx"> {
</span><ins>+ // This will end up assigning to m_frontend.
+ SQLTransactionBackend::create(m_database.ptr(), this, WTFMove(wrapper), readOnly);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> SQLTransaction::~SQLTransaction()
</span></span></pre></div>
<a id="trunkSourceWebCoreModuleswebdatabaseSQLTransactionh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/webdatabase/SQLTransaction.h (204332 => 204333)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/webdatabase/SQLTransaction.h        2016-08-10 15:57:10 UTC (rev 204332)
+++ trunk/Source/WebCore/Modules/webdatabase/SQLTransaction.h        2016-08-10 16:47:12 UTC (rev 204333)
</span><span class="lines">@@ -47,16 +47,26 @@
</span><span class="cx"> class SQLValue;
</span><span class="cx"> class VoidCallback;
</span><span class="cx">
</span><ins>+class SQLTransactionWrapper : public ThreadSafeRefCounted<SQLTransactionWrapper> {
+public:
+ virtual ~SQLTransactionWrapper() { }
+ virtual bool performPreflight(SQLTransactionBackend*) = 0;
+ virtual bool performPostflight(SQLTransactionBackend*) = 0;
+ virtual SQLError* sqlError() const = 0;
+ virtual void handleCommitFailedAfterPostflight(SQLTransactionBackend*) = 0;
+};
+
</ins><span class="cx"> class SQLTransaction : public ThreadSafeRefCounted<SQLTransaction>, public SQLTransactionStateMachine<SQLTransaction> {
</span><span class="cx"> public:
</span><del>- static Ref<SQLTransaction> create(Ref<Database>&&, RefPtr<SQLTransactionCallback>&&, RefPtr<VoidCallback>&& successCallback, RefPtr<SQLTransactionErrorCallback>&&, bool readOnly);
</del><ins>+ static Ref<SQLTransaction> create(Ref<Database>&&, RefPtr<SQLTransactionCallback>&&, RefPtr<VoidCallback>&& successCallback, RefPtr<SQLTransactionErrorCallback>&&, RefPtr<SQLTransactionWrapper>&&, bool readOnly);
</ins><span class="cx"> ~SQLTransaction();
</span><span class="cx">
</span><ins>+ void executeSQL(const String& sqlStatement, const Vector<SQLValue>& arguments, RefPtr<SQLStatementCallback>&&, RefPtr<SQLStatementErrorCallback>&&, ExceptionCode&);
+
</ins><span class="cx"> void performPendingCallback();
</span><span class="cx">
</span><del>- void executeSQL(const String& sqlStatement, const Vector<SQLValue>& arguments, RefPtr<SQLStatementCallback>&&, RefPtr<SQLStatementErrorCallback>&&, ExceptionCode&);
-
</del><span class="cx"> Database& database() { return m_database; }
</span><ins>+ SQLTransactionBackend& backend() { return *m_backend; }
</ins><span class="cx">
</span><span class="cx"> // APIs called from the backend published via SQLTransaction:
</span><span class="cx"> void requestTransitToState(SQLTransactionState);
</span><span class="lines">@@ -66,7 +76,7 @@
</span><span class="cx"> void setBackend(SQLTransactionBackend*);
</span><span class="cx">
</span><span class="cx"> private:
</span><del>- SQLTransaction(Ref<Database>&&, RefPtr<SQLTransactionCallback>&&, RefPtr<VoidCallback>&& successCallback, RefPtr<SQLTransactionErrorCallback>&&, bool readOnly);
</del><ins>+ SQLTransaction(Ref<Database>&&, RefPtr<SQLTransactionCallback>&&, RefPtr<VoidCallback>&& successCallback, RefPtr<SQLTransactionErrorCallback>&&, RefPtr<SQLTransactionWrapper>&&, bool readOnly);
</ins><span class="cx">
</span><span class="cx"> void clearCallbackWrappers();
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoreModuleswebdatabaseSQLTransactionBackendcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/webdatabase/SQLTransactionBackend.cpp (204332 => 204333)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/webdatabase/SQLTransactionBackend.cpp        2016-08-10 15:57:10 UTC (rev 204332)
+++ trunk/Source/WebCore/Modules/webdatabase/SQLTransactionBackend.cpp        2016-08-10 16:47:12 UTC (rev 204333)
</span><span class="lines">@@ -546,7 +546,7 @@
</span><span class="cx">
</span><span class="cx"> m_requestedState = SQLTransactionState::OpenTransactionAndPreflight;
</span><span class="cx"> ASSERT(m_requestedState != SQLTransactionState::End);
</span><del>- m_database->scheduleTransactionStep(this);
</del><ins>+ m_database->scheduleTransactionStep(*this);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void SQLTransactionBackend::openTransactionAndPreflight()
</span><span class="lines">@@ -830,7 +830,7 @@
</span><span class="cx"> LOG(StorageAPI, "Scheduling %s for transaction %p\n", nameForSQLTransactionState(nextState), this);
</span><span class="cx"> m_requestedState = nextState;
</span><span class="cx"> ASSERT(m_requestedState != SQLTransactionState::End);
</span><del>- m_database->scheduleTransactionStep(this);
</del><ins>+ m_database->scheduleTransactionStep(*this);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> // This state function is used as a stub function to plug unimplemented states
</span></span></pre></div>
<a id="trunkSourceWebCoreModuleswebdatabaseSQLTransactionBackendh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/webdatabase/SQLTransactionBackend.h (204332 => 204333)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/webdatabase/SQLTransactionBackend.h        2016-08-10 15:57:10 UTC (rev 204332)
+++ trunk/Source/WebCore/Modules/webdatabase/SQLTransactionBackend.h        2016-08-10 16:47:12 UTC (rev 204333)
</span><span class="lines">@@ -44,18 +44,9 @@
</span><span class="cx"> class SQLiteTransaction;
</span><span class="cx"> class SQLStatement;
</span><span class="cx"> class SQLTransaction;
</span><del>-class SQLTransactionBackend;
</del><ins>+class SQLTransactionWrapper;
</ins><span class="cx"> class SQLValue;
</span><span class="cx">
</span><del>-class SQLTransactionWrapper : public ThreadSafeRefCounted<SQLTransactionWrapper> {
-public:
- virtual ~SQLTransactionWrapper() { }
- virtual bool performPreflight(SQLTransactionBackend*) = 0;
- virtual bool performPostflight(SQLTransactionBackend*) = 0;
- virtual SQLError* sqlError() const = 0;
- virtual void handleCommitFailedAfterPostflight(SQLTransactionBackend*) = 0;
-};
-
</del><span class="cx"> class SQLTransactionBackend : public ThreadSafeRefCounted<SQLTransactionBackend>, public SQLTransactionStateMachine<SQLTransactionBackend> {
</span><span class="cx"> public:
</span><span class="cx"> static Ref<SQLTransactionBackend> create(Database*, RefPtr<SQLTransaction>&&, RefPtr<SQLTransactionWrapper>&&, bool readOnly);
</span></span></pre>
</div>
</div>
</body>
</html>