Move the webdatabase module source code to std::unique_ptr
https://bugs.webkit.org/show_bug.cgi?id=127278

Reviewed by Antti Koivisto.

Replace the majority of OwnPtr uses in the webdatabase module with std::unique_ptr.
The only remaining uses are due to ScriptExecutionContext::Task subclasses.

* Modules/webdatabase/AbstractSQLTransactionBackend.h:
* Modules/webdatabase/Database.cpp:
* Modules/webdatabase/DatabaseTask.h:
* Modules/webdatabase/DatabaseThread.cpp:
(WebCore::DatabaseThread::DatabaseThread):
* Modules/webdatabase/DatabaseThread.h:
* Modules/webdatabase/DatabaseTracker.cpp:
(WebCore::DatabaseTracker::addOpenDatabase):
* Modules/webdatabase/DatabaseTracker.h:
* Modules/webdatabase/OriginLock.cpp:
* Modules/webdatabase/SQLStatement.cpp:
* Modules/webdatabase/SQLStatement.h:
* Modules/webdatabase/SQLStatementBackend.cpp:
(WebCore::SQLStatementBackend::create):
(WebCore::SQLStatementBackend::SQLStatementBackend):
* Modules/webdatabase/SQLStatementBackend.h:
* Modules/webdatabase/SQLTransaction.cpp:
(WebCore::SQLTransaction::executeSQL):
* Modules/webdatabase/SQLTransactionBackend.cpp:
(WebCore::SQLTransactionBackend::doCleanup):
(WebCore::SQLTransactionBackend::computeNextStateAndCleanupIfNeeded):
(WebCore::SQLTransactionBackend::executeSQL):
(WebCore::SQLTransactionBackend::openTransactionAndPreflight):
(WebCore::SQLTransactionBackend::cleanupAfterTransactionErrorCallback):
* Modules/webdatabase/SQLTransactionBackend.h:
* Modules/webdatabase/SQLTransactionBackendSync.cpp:
(WebCore::SQLTransactionBackendSync::SQLTransactionBackendSync):
(WebCore::SQLTransactionBackendSync::begin):
(WebCore::SQLTransactionBackendSync::commit):
(WebCore::SQLTransactionBackendSync::rollback):
* Modules/webdatabase/SQLTransactionBackendSync.h:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@163317 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebCore/Modules/webdatabase/AbstractSQLTransactionBackend.h b/Source/WebCore/Modules/webdatabase/AbstractSQLTransactionBackend.h
index 01d9c95..f248097 100644
--- a/Source/WebCore/Modules/webdatabase/AbstractSQLTransactionBackend.h
+++ b/Source/WebCore/Modules/webdatabase/AbstractSQLTransactionBackend.h
@@ -32,7 +32,7 @@
 #include "SQLError.h"
 #include "SQLTransactionState.h"
 #include "SQLValue.h"
-#include <wtf/PassOwnPtr.h>
+#include <memory>
 #include <wtf/ThreadSafeRefCounted.h>
 #include <wtf/Vector.h>
 #include <wtf/text/WTFString.h>
@@ -49,7 +49,7 @@
     virtual AbstractSQLStatement* currentStatement() = 0;
     virtual void setShouldRetryCurrentStatement(bool) = 0;
 
-    virtual void executeSQL(PassOwnPtr<AbstractSQLStatement>, const String& statement,
+    virtual void executeSQL(std::unique_ptr<AbstractSQLStatement>, const String& statement,
         const Vector<SQLValue>& arguments, int permissions) = 0;
 
 };
diff --git a/Source/WebCore/Modules/webdatabase/Database.cpp b/Source/WebCore/Modules/webdatabase/Database.cpp
index e182795..1885387 100644
--- a/Source/WebCore/Modules/webdatabase/Database.cpp
+++ b/Source/WebCore/Modules/webdatabase/Database.cpp
@@ -53,7 +53,6 @@
 #include "ScriptExecutionContext.h"
 #include "SecurityOrigin.h"
 #include "VoidCallback.h"
-#include <wtf/OwnPtr.h>
 #include <wtf/PassOwnPtr.h>
 #include <wtf/PassRefPtr.h>
 #include <wtf/RefPtr.h>
diff --git a/Source/WebCore/Modules/webdatabase/DatabaseTask.h b/Source/WebCore/Modules/webdatabase/DatabaseTask.h
index 1edaf86..3f8aba5 100644
--- a/Source/WebCore/Modules/webdatabase/DatabaseTask.h
+++ b/Source/WebCore/Modules/webdatabase/DatabaseTask.h
@@ -34,8 +34,6 @@
 #include "DatabaseBasicTypes.h"
 #include "DatabaseError.h"
 #include "SQLTransactionBackend.h"
-#include <wtf/OwnPtr.h>
-#include <wtf/PassOwnPtr.h>
 #include <wtf/PassRefPtr.h>
 #include <wtf/Threading.h>
 #include <wtf/Vector.h>
diff --git a/Source/WebCore/Modules/webdatabase/DatabaseThread.cpp b/Source/WebCore/Modules/webdatabase/DatabaseThread.cpp
index 7ee764c..e440336 100644
--- a/Source/WebCore/Modules/webdatabase/DatabaseThread.cpp
+++ b/Source/WebCore/Modules/webdatabase/DatabaseThread.cpp
@@ -45,8 +45,8 @@
 #if PLATFORM(IOS)
     , m_paused(false)
 #endif
-    , m_transactionClient(adoptPtr(new SQLTransactionClient()))
-    , m_transactionCoordinator(adoptPtr(new SQLTransactionCoordinator()))
+    , m_transactionClient(std::make_unique<SQLTransactionClient>())
+    , m_transactionCoordinator(std::make_unique<SQLTransactionCoordinator>())
     , m_cleanupSync(0)
 {
     m_selfRef = this;
diff --git a/Source/WebCore/Modules/webdatabase/DatabaseThread.h b/Source/WebCore/Modules/webdatabase/DatabaseThread.h
index c05979e..b2617ad 100644
--- a/Source/WebCore/Modules/webdatabase/DatabaseThread.h
+++ b/Source/WebCore/Modules/webdatabase/DatabaseThread.h
@@ -30,12 +30,11 @@
 
 #if ENABLE(SQL_DATABASE)
 
+#include <memory>
 #include <wtf/Deque.h>
 #include <wtf/HashMap.h>
 #include <wtf/HashSet.h>
 #include <wtf/MessageQueue.h>
-#include <wtf/OwnPtr.h>
-#include <wtf/PassOwnPtr.h>
 #include <wtf/PassRefPtr.h>
 #include <wtf/RefPtr.h>
 #include <wtf/Threading.h>
@@ -95,8 +94,8 @@
     typedef HashSet<RefPtr<DatabaseBackend>> DatabaseSet;
     DatabaseSet m_openDatabaseSet;
 
-    OwnPtr<SQLTransactionClient> m_transactionClient;
-    OwnPtr<SQLTransactionCoordinator> m_transactionCoordinator;
+    std::unique_ptr<SQLTransactionClient> m_transactionClient;
+    std::unique_ptr<SQLTransactionCoordinator> m_transactionCoordinator;
     DatabaseTaskSynchronizer* m_cleanupSync;
 };
 
diff --git a/Source/WebCore/Modules/webdatabase/DatabaseTracker.cpp b/Source/WebCore/Modules/webdatabase/DatabaseTracker.cpp
index 8d3fa13..ae91bcc 100644
--- a/Source/WebCore/Modules/webdatabase/DatabaseTracker.cpp
+++ b/Source/WebCore/Modules/webdatabase/DatabaseTracker.cpp
@@ -557,7 +557,7 @@
         MutexLocker openDatabaseMapLock(m_openDatabaseMapGuard);
 
         if (!m_openDatabaseMap)
-            m_openDatabaseMap = adoptPtr(new DatabaseOriginMap);
+            m_openDatabaseMap = std::make_unique<DatabaseOriginMap>();
 
         String name(database->stringIdentifier());
         DatabaseNameMap* nameMap = m_openDatabaseMap->get(database->securityOrigin());
diff --git a/Source/WebCore/Modules/webdatabase/DatabaseTracker.h b/Source/WebCore/Modules/webdatabase/DatabaseTracker.h
index acea698..ffa25f3 100644
--- a/Source/WebCore/Modules/webdatabase/DatabaseTracker.h
+++ b/Source/WebCore/Modules/webdatabase/DatabaseTracker.h
@@ -37,7 +37,6 @@
 #include "SecurityOriginHash.h"
 #include <wtf/HashMap.h>
 #include <wtf/HashSet.h>
-#include <wtf/OwnPtr.h>
 #include <wtf/text/StringHash.h>
 #include <wtf/text/WTFString.h>
 
@@ -152,7 +151,7 @@
     typedef HashMap<RefPtr<SecurityOrigin>, DatabaseNameMap*> DatabaseOriginMap;
 
     Mutex m_openDatabaseMapGuard;
-    mutable OwnPtr<DatabaseOriginMap> m_openDatabaseMap;
+    mutable std::unique_ptr<DatabaseOriginMap> m_openDatabaseMap;
 
     // This lock protects m_database, m_originLockMap, m_databaseDirectoryPath, m_originsBeingDeleted, m_beingCreated, and m_beingDeleted.
     Mutex m_databaseGuard;
diff --git a/Source/WebCore/Modules/webdatabase/OriginLock.cpp b/Source/WebCore/Modules/webdatabase/OriginLock.cpp
index 7361e36..b94393a 100644
--- a/Source/WebCore/Modules/webdatabase/OriginLock.cpp
+++ b/Source/WebCore/Modules/webdatabase/OriginLock.cpp
@@ -29,7 +29,6 @@
 #if ENABLE(SQL_DATABASE)
 
 #include "FileSystem.h"
-#include <wtf/PassOwnPtr.h>
 
 namespace WebCore {
 
diff --git a/Source/WebCore/Modules/webdatabase/SQLStatement.cpp b/Source/WebCore/Modules/webdatabase/SQLStatement.cpp
index 92c7f4f..a29c853 100644
--- a/Source/WebCore/Modules/webdatabase/SQLStatement.cpp
+++ b/Source/WebCore/Modules/webdatabase/SQLStatement.cpp
@@ -45,12 +45,6 @@
 
 namespace WebCore {
 
-PassOwnPtr<SQLStatement> SQLStatement::create(Database* database,
-    PassRefPtr<SQLStatementCallback> callback, PassRefPtr<SQLStatementErrorCallback> errorCallback)
-{
-    return adoptPtr(new SQLStatement(database, callback, errorCallback));
-}
-
 SQLStatement::SQLStatement(Database* database, PassRefPtr<SQLStatementCallback> callback,
     PassRefPtr<SQLStatementErrorCallback> errorCallback)
     : m_statementCallbackWrapper(callback, database->scriptExecutionContext())
diff --git a/Source/WebCore/Modules/webdatabase/SQLStatement.h b/Source/WebCore/Modules/webdatabase/SQLStatement.h
index 4fdb2da..ce7d2fe 100644
--- a/Source/WebCore/Modules/webdatabase/SQLStatement.h
+++ b/Source/WebCore/Modules/webdatabase/SQLStatement.h
@@ -49,8 +49,7 @@
 
 class SQLStatement : public AbstractSQLStatement {
 public:
-    static PassOwnPtr<SQLStatement> create(Database*,
-        PassRefPtr<SQLStatementCallback>, PassRefPtr<SQLStatementErrorCallback>);
+    SQLStatement(Database*, PassRefPtr<SQLStatementCallback>, PassRefPtr<SQLStatementErrorCallback>);
 
     bool performCallback(SQLTransaction*);
 
@@ -60,8 +59,6 @@
     virtual bool hasErrorCallback();
 
 private:
-    SQLStatement(Database*, PassRefPtr<SQLStatementCallback>, PassRefPtr<SQLStatementErrorCallback>);
-
     // The AbstractSQLStatementBackend owns the SQLStatement. Hence, the backend is
     // guaranteed to be outlive the SQLStatement, and it is safe for us to refer
     // to the backend using a raw pointer here.
diff --git a/Source/WebCore/Modules/webdatabase/SQLStatementBackend.cpp b/Source/WebCore/Modules/webdatabase/SQLStatementBackend.cpp
index 3873e22..0c3eb6f 100644
--- a/Source/WebCore/Modules/webdatabase/SQLStatementBackend.cpp
+++ b/Source/WebCore/Modules/webdatabase/SQLStatementBackend.cpp
@@ -47,13 +47,13 @@
 //     At birth (in SQLTransactionBackend::executeSQL()):
 //     =================================================
 //     SQLTransactionBackend           // Deque<RefPtr<SQLStatementBackend>> m_statementQueue points to ...
-//     --> SQLStatementBackend         // OwnPtr<SQLStatement> m_frontend points to ...
+//     --> SQLStatementBackend         // std::unique_ptr<SQLStatement> m_frontend points to ...
 //         --> SQLStatement
 //
 //     After grabbing the statement for execution (in SQLTransactionBackend::getNextStatement()):
 //     =========================================================================================
 //     SQLTransactionBackend           // RefPtr<SQLStatementBackend> m_currentStatementBackend points to ...
-//     --> SQLStatementBackend         // OwnPtr<SQLStatement> m_frontend points to ...
+//     --> SQLStatementBackend         // std::unique_ptr<SQLStatement> m_frontend points to ...
 //         --> SQLStatement
 //
 //     Then we execute the statement in SQLTransactionBackend::runCurrentStatementAndGetNextState().
@@ -74,15 +74,15 @@
 
 namespace WebCore {
 
-PassRefPtr<SQLStatementBackend> SQLStatementBackend::create(PassOwnPtr<AbstractSQLStatement> frontend,
+PassRefPtr<SQLStatementBackend> SQLStatementBackend::create(std::unique_ptr<AbstractSQLStatement> frontend,
     const String& statement, const Vector<SQLValue>& arguments, int permissions)
 {
-    return adoptRef(new SQLStatementBackend(frontend, statement, arguments, permissions));
+    return adoptRef(new SQLStatementBackend(std::move(frontend), statement, arguments, permissions));
 }
 
-SQLStatementBackend::SQLStatementBackend(PassOwnPtr<AbstractSQLStatement> frontend,
+SQLStatementBackend::SQLStatementBackend(std::unique_ptr<AbstractSQLStatement> frontend,
     const String& statement, const Vector<SQLValue>& arguments, int permissions)
-    : m_frontend(frontend)
+    : m_frontend(std::move(frontend))
     , m_statement(statement.isolatedCopy())
     , m_arguments(arguments)
     , m_hasCallback(m_frontend->hasCallback())
diff --git a/Source/WebCore/Modules/webdatabase/SQLStatementBackend.h b/Source/WebCore/Modules/webdatabase/SQLStatementBackend.h
index a2d2690..555611f 100644
--- a/Source/WebCore/Modules/webdatabase/SQLStatementBackend.h
+++ b/Source/WebCore/Modules/webdatabase/SQLStatementBackend.h
@@ -33,7 +33,6 @@
 #include "AbstractSQLStatementBackend.h"
 #include "SQLValue.h"
 #include <wtf/Forward.h>
-#include <wtf/PassOwnPtr.h>
 #include <wtf/Vector.h>
 #include <wtf/text/WTFString.h>
 
@@ -46,7 +45,7 @@
 
 class SQLStatementBackend : public AbstractSQLStatementBackend {
 public:
-    static PassRefPtr<SQLStatementBackend> create(PassOwnPtr<AbstractSQLStatement>,
+    static PassRefPtr<SQLStatementBackend> create(std::unique_ptr<AbstractSQLStatement>,
         const String& sqlStatement, const Vector<SQLValue>& arguments, int permissions);
 
     bool execute(DatabaseBackend*);
@@ -63,13 +62,13 @@
     virtual PassRefPtr<SQLResultSet> sqlResultSet() const;
 
 private:
-    SQLStatementBackend(PassOwnPtr<AbstractSQLStatement>, const String& statement,
+    SQLStatementBackend(std::unique_ptr<AbstractSQLStatement>, const String& statement,
         const Vector<SQLValue>& arguments, int permissions);
 
     void setFailureDueToQuota();
     void clearFailureDueToQuota();
 
-    OwnPtr<AbstractSQLStatement> m_frontend;
+    std::unique_ptr<AbstractSQLStatement> m_frontend;
     String m_statement;
     Vector<SQLValue> m_arguments;
     bool m_hasCallback;
diff --git a/Source/WebCore/Modules/webdatabase/SQLTransaction.cpp b/Source/WebCore/Modules/webdatabase/SQLTransaction.cpp
index 2b4f7bb..a3dfdfe 100644
--- a/Source/WebCore/Modules/webdatabase/SQLTransaction.cpp
+++ b/Source/WebCore/Modules/webdatabase/SQLTransaction.cpp
@@ -261,8 +261,8 @@
     else if (m_readOnly)
         permissions |= DatabaseAuthorizer::ReadOnlyMask;
 
-    OwnPtr<SQLStatement> statement = SQLStatement::create(m_database.get(), callback, callbackError);
-    m_backend->executeSQL(statement.release(), sqlStatement, arguments, permissions);
+    auto statement = std::make_unique<SQLStatement>(m_database.get(), callback, callbackError);
+    m_backend->executeSQL(std::move(statement), sqlStatement, arguments, permissions);
 }
 
 bool SQLTransaction::computeNextStateAndCleanupIfNeeded()
diff --git a/Source/WebCore/Modules/webdatabase/SQLTransactionBackend.cpp b/Source/WebCore/Modules/webdatabase/SQLTransactionBackend.cpp
index 244f2856..fe5f6db 100644
--- a/Source/WebCore/Modules/webdatabase/SQLTransactionBackend.cpp
+++ b/Source/WebCore/Modules/webdatabase/SQLTransactionBackend.cpp
@@ -260,7 +260,7 @@
 //
 //     When executing the transaction (in DatabaseThread::databaseThread()):
 //     ====================================================================
-//     OwnPtr<DatabaseTask> task;             // points to ...
+//     std::unique_ptr<DatabaseTask> task;    // points to ...
 //     --> DatabaseTransactionTask            // RefPtr<SQLTransactionBackend> m_transaction points to ...
 //         --> SQLTransactionBackend          // RefPtr<SQLTransaction> m_frontend;
 //             --> SQLTransaction             // RefPtr<SQLTransactionBackend> m_backend points to ...
@@ -284,7 +284,7 @@
 //     However, there will still be a DatabaseTask pointing to the SQLTransactionBackend (see
 //     the "When executing the transaction" chain above). This will keep the
 //     SQLTransactionBackend alive until DatabaseThread::databaseThread() releases its
-//     task OwnPtr.
+//     task std::unique_ptr.
 //
 //     What happens if a transaction is interrupted?
 //     ============================================
@@ -393,7 +393,7 @@
         // m_sqliteTransaction invokes SQLiteTransaction's destructor which does
         // just that. We might as well do this unconditionally and free up its
         // resources because we're already terminating.
-        m_sqliteTransaction.clear();
+        m_sqliteTransaction = nullptr;
     }
 
     // Release the lock on this database
@@ -500,7 +500,7 @@
     // The current SQLite transaction should be stopped, as well
     if (m_sqliteTransaction) {
         m_sqliteTransaction->stop();
-        m_sqliteTransaction.clear();
+        m_sqliteTransaction = nullptr;
     }
 
     // Terminate the frontend state machine. This also gets the frontend to
@@ -526,11 +526,11 @@
 }
 #endif
 
-void SQLTransactionBackend::executeSQL(PassOwnPtr<AbstractSQLStatement> statement,
+void SQLTransactionBackend::executeSQL(std::unique_ptr<AbstractSQLStatement> statement,
     const String& sqlStatement, const Vector<SQLValue>& arguments, int permissions)
 {
     RefPtr<SQLStatementBackend> statementBackend;
-    statementBackend = SQLStatementBackend::create(statement, sqlStatement, arguments, permissions);
+    statementBackend = SQLStatementBackend::create(std::move(statement), sqlStatement, arguments, permissions);
 
     if (Database::from(m_database.get())->deleted())
         statementBackend->setDatabaseDeletedError();
@@ -582,7 +582,7 @@
     }
 
     ASSERT(!m_sqliteTransaction);
-    m_sqliteTransaction = adoptPtr(new SQLiteTransaction(m_database->sqliteDatabase(), m_readOnly));
+    m_sqliteTransaction = std::make_unique<SQLiteTransaction>(m_database->sqliteDatabase(), m_readOnly);
 
     m_database->resetDeletes();
     m_database->disableAuthorizer();
@@ -594,7 +594,7 @@
         ASSERT(!m_database->sqliteDatabase().transactionInProgress());
         m_transactionError = SQLError::create(SQLError::DATABASE_ERR, "unable to begin transaction",
             m_database->sqliteDatabase().lastError(), m_database->sqliteDatabase().lastErrorMsg());
-        m_sqliteTransaction.clear();
+        m_sqliteTransaction = nullptr;
         return nextStateForTransactionError();
     }
 
@@ -606,7 +606,7 @@
         m_transactionError = SQLError::create(SQLError::DATABASE_ERR, "unable to read version",
             m_database->sqliteDatabase().lastError(), m_database->sqliteDatabase().lastErrorMsg());
         m_database->disableAuthorizer();
-        m_sqliteTransaction.clear();
+        m_sqliteTransaction = nullptr;
         m_database->enableAuthorizer();
         return nextStateForTransactionError();
     }
@@ -615,7 +615,7 @@
     // Spec 4.3.2.3: Perform preflight steps, jumping to the error callback if they fail
     if (m_wrapper && !m_wrapper->performPreflight(this)) {
         m_database->disableAuthorizer();
-        m_sqliteTransaction.clear();
+        m_sqliteTransaction = nullptr;
         m_database->enableAuthorizer();
         m_transactionError = m_wrapper->sqlError();
         if (!m_transactionError)
@@ -799,7 +799,7 @@
         m_sqliteTransaction->rollback();
 
         ASSERT(!m_database->sqliteDatabase().transactionInProgress());
-        m_sqliteTransaction.clear();
+        m_sqliteTransaction = nullptr;
     }
     m_database->enableAuthorizer();
 
diff --git a/Source/WebCore/Modules/webdatabase/SQLTransactionBackend.h b/Source/WebCore/Modules/webdatabase/SQLTransactionBackend.h
index 17a4c65..ce3dfb8 100644
--- a/Source/WebCore/Modules/webdatabase/SQLTransactionBackend.h
+++ b/Source/WebCore/Modules/webdatabase/SQLTransactionBackend.h
@@ -34,6 +34,7 @@
 #include "AbstractSQLTransactionBackend.h"
 #include "DatabaseBasicTypes.h"
 #include "SQLTransactionStateMachine.h"
+#include <memory>
 #include <wtf/Deque.h>
 #include <wtf/Forward.h>
 #include <wtf/text/WTFString.h>
@@ -85,7 +86,7 @@
     virtual PassRefPtr<SQLError> transactionError() override;
     virtual AbstractSQLStatement* currentStatement() override;
     virtual void setShouldRetryCurrentStatement(bool) override;
-    virtual void executeSQL(PassOwnPtr<AbstractSQLStatement>, const String& statement,
+    virtual void executeSQL(std::unique_ptr<AbstractSQLStatement>, const String& statement,
         const Vector<SQLValue>& arguments, int permissions) override;
 
     void doCleanup();
@@ -135,7 +136,7 @@
     Mutex m_statementMutex;
     Deque<RefPtr<SQLStatementBackend>> m_statementQueue;
 
-    OwnPtr<SQLiteTransaction> m_sqliteTransaction;
+    std::unique_ptr<SQLiteTransaction> m_sqliteTransaction;
     RefPtr<OriginLock> m_originLock;
 };
 
diff --git a/Source/WebCore/Modules/webdatabase/SQLTransactionBackendSync.cpp b/Source/WebCore/Modules/webdatabase/SQLTransactionBackendSync.cpp
index 5522264..7c76b8a 100644
--- a/Source/WebCore/Modules/webdatabase/SQLTransactionBackendSync.cpp
+++ b/Source/WebCore/Modules/webdatabase/SQLTransactionBackendSync.cpp
@@ -58,7 +58,7 @@
     , m_readOnly(readOnly)
     , m_hasVersionMismatch(false)
     , m_modifiedDatabase(false)
-    , m_transactionClient(adoptPtr(new SQLTransactionClient()))
+    , m_transactionClient(std::make_unique<SQLTransactionClient>())
 {
     ASSERT(m_database->scriptExecutionContext()->isContextThread());
 }
@@ -142,7 +142,7 @@
         m_database->sqliteDatabase().setMaximumSize(m_database->maximumSize());
 
     ASSERT(!m_sqliteTransaction);
-    m_sqliteTransaction = adoptPtr(new SQLiteTransaction(m_database->sqliteDatabase(), m_readOnly));
+    m_sqliteTransaction = std::make_unique<SQLiteTransaction>(m_database->sqliteDatabase(), m_readOnly);
 
     m_database->resetDeletes();
     m_database->disableAuthorizer();
@@ -154,7 +154,7 @@
         ASSERT(!m_database->sqliteDatabase().transactionInProgress());
         m_database->setLastErrorMessage("unable to begin transaction",
             m_database->sqliteDatabase().lastError(), m_database->sqliteDatabase().lastErrorMsg());
-        m_sqliteTransaction.clear();
+        m_sqliteTransaction = nullptr;
         return SQLException::DATABASE_ERR;
     }
 
@@ -207,7 +207,7 @@
         return SQLException::DATABASE_ERR;
     }
 
-    m_sqliteTransaction.clear();
+    m_sqliteTransaction = nullptr;
 
     // Vacuum the database if anything was deleted.
     if (m_database->hadDeletes())
@@ -225,7 +225,7 @@
     m_database->disableAuthorizer();
     if (m_sqliteTransaction) {
         m_sqliteTransaction->rollback();
-        m_sqliteTransaction.clear();
+        m_sqliteTransaction = nullptr;
     }
     m_database->enableAuthorizer();
 
diff --git a/Source/WebCore/Modules/webdatabase/SQLTransactionBackendSync.h b/Source/WebCore/Modules/webdatabase/SQLTransactionBackendSync.h
index 73ab48d..25a6526 100644
--- a/Source/WebCore/Modules/webdatabase/SQLTransactionBackendSync.h
+++ b/Source/WebCore/Modules/webdatabase/SQLTransactionBackendSync.h
@@ -35,6 +35,7 @@
 #if ENABLE(SQL_DATABASE)
 
 #include "DatabaseBasicTypes.h"
+#include <memory>
 #include <wtf/Forward.h>
 #include <wtf/RefCounted.h>
 #include <wtf/Vector.h>
@@ -73,8 +74,8 @@
     bool m_hasVersionMismatch;
 
     bool m_modifiedDatabase;
-    OwnPtr<SQLTransactionClient> m_transactionClient;
-    OwnPtr<SQLiteTransaction> m_sqliteTransaction;
+    std::unique_ptr<SQLTransactionClient> m_transactionClient;
+    std::unique_ptr<SQLiteTransaction> m_sqliteTransaction;
 
     friend class SQLTransactionSync; // FIXME: Remove this once the front-end has been properly isolated.
 };