Title: [163317] trunk/Source/WebCore
Revision
163317
Author
zandober...@gmail.com
Date
2014-02-03 11:07:29 -0800 (Mon, 03 Feb 2014)

Log Message

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:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (163316 => 163317)


--- trunk/Source/WebCore/ChangeLog	2014-02-03 18:52:12 UTC (rev 163316)
+++ trunk/Source/WebCore/ChangeLog	2014-02-03 19:07:29 UTC (rev 163317)
@@ -1,3 +1,45 @@
+2014-02-03  Zan Dobersek  <zdober...@igalia.com>
+
+        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:
+
 2014-02-03  Andreas Kling  <akl...@apple.com>
 
         CTTE: Grab bag of SVGRenderTreeAsText cleanups.

Modified: trunk/Source/WebCore/Modules/webdatabase/AbstractSQLTransactionBackend.h (163316 => 163317)


--- trunk/Source/WebCore/Modules/webdatabase/AbstractSQLTransactionBackend.h	2014-02-03 18:52:12 UTC (rev 163316)
+++ trunk/Source/WebCore/Modules/webdatabase/AbstractSQLTransactionBackend.h	2014-02-03 19:07:29 UTC (rev 163317)
@@ -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;
 
 };

Modified: trunk/Source/WebCore/Modules/webdatabase/Database.cpp (163316 => 163317)


--- trunk/Source/WebCore/Modules/webdatabase/Database.cpp	2014-02-03 18:52:12 UTC (rev 163316)
+++ trunk/Source/WebCore/Modules/webdatabase/Database.cpp	2014-02-03 19:07:29 UTC (rev 163317)
@@ -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>

Modified: trunk/Source/WebCore/Modules/webdatabase/DatabaseTask.h (163316 => 163317)


--- trunk/Source/WebCore/Modules/webdatabase/DatabaseTask.h	2014-02-03 18:52:12 UTC (rev 163316)
+++ trunk/Source/WebCore/Modules/webdatabase/DatabaseTask.h	2014-02-03 19:07:29 UTC (rev 163317)
@@ -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>

Modified: trunk/Source/WebCore/Modules/webdatabase/DatabaseThread.cpp (163316 => 163317)


--- trunk/Source/WebCore/Modules/webdatabase/DatabaseThread.cpp	2014-02-03 18:52:12 UTC (rev 163316)
+++ trunk/Source/WebCore/Modules/webdatabase/DatabaseThread.cpp	2014-02-03 19:07:29 UTC (rev 163317)
@@ -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;

Modified: trunk/Source/WebCore/Modules/webdatabase/DatabaseThread.h (163316 => 163317)


--- trunk/Source/WebCore/Modules/webdatabase/DatabaseThread.h	2014-02-03 18:52:12 UTC (rev 163316)
+++ trunk/Source/WebCore/Modules/webdatabase/DatabaseThread.h	2014-02-03 19:07:29 UTC (rev 163317)
@@ -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;
 };
 

Modified: trunk/Source/WebCore/Modules/webdatabase/DatabaseTracker.cpp (163316 => 163317)


--- trunk/Source/WebCore/Modules/webdatabase/DatabaseTracker.cpp	2014-02-03 18:52:12 UTC (rev 163316)
+++ trunk/Source/WebCore/Modules/webdatabase/DatabaseTracker.cpp	2014-02-03 19:07:29 UTC (rev 163317)
@@ -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());

Modified: trunk/Source/WebCore/Modules/webdatabase/DatabaseTracker.h (163316 => 163317)


--- trunk/Source/WebCore/Modules/webdatabase/DatabaseTracker.h	2014-02-03 18:52:12 UTC (rev 163316)
+++ trunk/Source/WebCore/Modules/webdatabase/DatabaseTracker.h	2014-02-03 19:07:29 UTC (rev 163317)
@@ -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;

Modified: trunk/Source/WebCore/Modules/webdatabase/OriginLock.cpp (163316 => 163317)


--- trunk/Source/WebCore/Modules/webdatabase/OriginLock.cpp	2014-02-03 18:52:12 UTC (rev 163316)
+++ trunk/Source/WebCore/Modules/webdatabase/OriginLock.cpp	2014-02-03 19:07:29 UTC (rev 163317)
@@ -29,7 +29,6 @@
 #if ENABLE(SQL_DATABASE)
 
 #include "FileSystem.h"
-#include <wtf/PassOwnPtr.h>
 
 namespace WebCore {
 

Modified: trunk/Source/WebCore/Modules/webdatabase/SQLStatement.cpp (163316 => 163317)


--- trunk/Source/WebCore/Modules/webdatabase/SQLStatement.cpp	2014-02-03 18:52:12 UTC (rev 163316)
+++ trunk/Source/WebCore/Modules/webdatabase/SQLStatement.cpp	2014-02-03 19:07:29 UTC (rev 163317)
@@ -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())

Modified: trunk/Source/WebCore/Modules/webdatabase/SQLStatement.h (163316 => 163317)


--- trunk/Source/WebCore/Modules/webdatabase/SQLStatement.h	2014-02-03 18:52:12 UTC (rev 163316)
+++ trunk/Source/WebCore/Modules/webdatabase/SQLStatement.h	2014-02-03 19:07:29 UTC (rev 163317)
@@ -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.

Modified: trunk/Source/WebCore/Modules/webdatabase/SQLStatementBackend.cpp (163316 => 163317)


--- trunk/Source/WebCore/Modules/webdatabase/SQLStatementBackend.cpp	2014-02-03 18:52:12 UTC (rev 163316)
+++ trunk/Source/WebCore/Modules/webdatabase/SQLStatementBackend.cpp	2014-02-03 19:07:29 UTC (rev 163317)
@@ -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())

Modified: trunk/Source/WebCore/Modules/webdatabase/SQLStatementBackend.h (163316 => 163317)


--- trunk/Source/WebCore/Modules/webdatabase/SQLStatementBackend.h	2014-02-03 18:52:12 UTC (rev 163316)
+++ trunk/Source/WebCore/Modules/webdatabase/SQLStatementBackend.h	2014-02-03 19:07:29 UTC (rev 163317)
@@ -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;

Modified: trunk/Source/WebCore/Modules/webdatabase/SQLTransaction.cpp (163316 => 163317)


--- trunk/Source/WebCore/Modules/webdatabase/SQLTransaction.cpp	2014-02-03 18:52:12 UTC (rev 163316)
+++ trunk/Source/WebCore/Modules/webdatabase/SQLTransaction.cpp	2014-02-03 19:07:29 UTC (rev 163317)
@@ -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()

Modified: trunk/Source/WebCore/Modules/webdatabase/SQLTransactionBackend.cpp (163316 => 163317)


--- trunk/Source/WebCore/Modules/webdatabase/SQLTransactionBackend.cpp	2014-02-03 18:52:12 UTC (rev 163316)
+++ trunk/Source/WebCore/Modules/webdatabase/SQLTransactionBackend.cpp	2014-02-03 19:07:29 UTC (rev 163317)
@@ -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();
 

Modified: trunk/Source/WebCore/Modules/webdatabase/SQLTransactionBackend.h (163316 => 163317)


--- trunk/Source/WebCore/Modules/webdatabase/SQLTransactionBackend.h	2014-02-03 18:52:12 UTC (rev 163316)
+++ trunk/Source/WebCore/Modules/webdatabase/SQLTransactionBackend.h	2014-02-03 19:07:29 UTC (rev 163317)
@@ -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;
 };
 

Modified: trunk/Source/WebCore/Modules/webdatabase/SQLTransactionBackendSync.cpp (163316 => 163317)


--- trunk/Source/WebCore/Modules/webdatabase/SQLTransactionBackendSync.cpp	2014-02-03 18:52:12 UTC (rev 163316)
+++ trunk/Source/WebCore/Modules/webdatabase/SQLTransactionBackendSync.cpp	2014-02-03 19:07:29 UTC (rev 163317)
@@ -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();
 

Modified: trunk/Source/WebCore/Modules/webdatabase/SQLTransactionBackendSync.h (163316 => 163317)


--- trunk/Source/WebCore/Modules/webdatabase/SQLTransactionBackendSync.h	2014-02-03 18:52:12 UTC (rev 163316)
+++ trunk/Source/WebCore/Modules/webdatabase/SQLTransactionBackendSync.h	2014-02-03 19:07:29 UTC (rev 163317)
@@ -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.
 };
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to