Changeset 202698 in webkit


Ignore:
Timestamp:
Jun 30, 2016 1:44:42 PM (8 years ago)
Author:
Ryan Haddad
Message:

Unreviewed, rolling out r202676.
https://bugs.webkit.org/show_bug.cgi?id=159314

This change caused storage/websql tests to crash on Mac and
iOS WK1 (Requested by ryanhaddad on #webkit).

Reverted changeset:

"Purge PassRefPtr in Modules/webdatabase"
https://bugs.webkit.org/show_bug.cgi?id=159255
http://trac.webkit.org/changeset/202676

Patch by Commit Queue <commit-queue@webkit.org> on 2016-06-30

Location:
trunk/Source/WebCore
Files:
18 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r202694 r202698  
     12016-06-30  Commit Queue  <commit-queue@webkit.org>
     2
     3        Unreviewed, rolling out r202676.
     4        https://bugs.webkit.org/show_bug.cgi?id=159314
     5
     6        This change caused storage/websql tests to crash on Mac and
     7        iOS WK1 (Requested by ryanhaddad on #webkit).
     8
     9        Reverted changeset:
     10
     11        "Purge PassRefPtr in Modules/webdatabase"
     12        https://bugs.webkit.org/show_bug.cgi?id=159255
     13        http://trac.webkit.org/changeset/202676
     14
    1152016-06-30  Antoine Quint  <graouts@apple.com>
    216
  • trunk/Source/WebCore/Modules/webdatabase/ChangeVersionWrapper.cpp

    r202676 r202698  
    3131#include "Database.h"
    3232#include "SQLError.h"
     33#include <wtf/PassRefPtr.h>
    3334#include <wtf/RefPtr.h>
    3435
  • trunk/Source/WebCore/Modules/webdatabase/DOMWindowWebDatabase.h

    r202676 r202698  
    2222 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
    2323 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
    24  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
    2525 */
    2626
     
    2929
    3030#include "ExceptionCode.h"
     31#include <wtf/PassRefPtr.h>
    3132#include <wtf/RefCounted.h>
    3233#include <wtf/RefPtr.h>
  • trunk/Source/WebCore/Modules/webdatabase/Database.cpp

    r202676 r202698  
    5555#include "VoidCallback.h"
    5656#include <wtf/NeverDestroyed.h>
     57#include <wtf/PassRefPtr.h>
    5758#include <wtf/RefPtr.h>
    5859#include <wtf/StdLibExtras.h>
     
    203204}
    204205
    205 Database::Database(RefPtr<DatabaseContext>&& databaseContext, const String& name, const String& expectedVersion, const String& displayName, unsigned long estimatedSize)
     206Database::Database(PassRefPtr<DatabaseContext> databaseContext, const String& name, const String& expectedVersion, const String& displayName, unsigned long estimatedSize)
    206207    : m_scriptExecutionContext(databaseContext->scriptExecutionContext())
    207     , m_databaseContext(WTFMove(databaseContext))
     208    , m_databaseContext(databaseContext)
    208209    , m_deleted(false)
    209210    , m_name(name.isolatedCopy())
     
    242243Database::~Database()
    243244{
    244     // The reference to the ScriptExecutionContext needs to be cleared on the JavaScript thread.
    245     // If we're on that thread already, we can just let the RefPtr's destruction do the dereffing.
     245    // The reference to the ScriptExecutionContext needs to be cleared on the JavaScript thread.  If we're on that thread already, we can just let the RefPtr's destruction do the dereffing.
    246246    if (!m_scriptExecutionContext->isContextThread()) {
    247247        // Grab a pointer to the script execution here because we're releasing it when we pass it to
    248248        // DerefContextTask::create.
    249         RefPtr<ScriptExecutionContext> passedContext;
    250         passedContext->postTask({ScriptExecutionContext::Task::CleanupTask, [passedContext = WTFMove(m_scriptExecutionContext)] (ScriptExecutionContext& context) {
     249        PassRefPtr<ScriptExecutionContext> passedContext = m_scriptExecutionContext.release();
     250        passedContext->postTask({ScriptExecutionContext::Task::CleanupTask, [passedContext] (ScriptExecutionContext& context) {
    251251            ASSERT_UNUSED(context, &context == passedContext);
    252252            RefPtr<ScriptExecutionContext> scriptExecutionContext(passedContext);
     
    572572
    573573    if (transaction && databaseContext()->databaseThread()) {
    574         auto task = std::make_unique<DatabaseTransactionTask>(WTFMove(transaction));
     574        auto task = std::make_unique<DatabaseTransactionTask>(transaction);
    575575        LOG(StorageAPI, "Scheduling DatabaseTransactionTask %p for transaction %p\n", task.get(), task->transaction());
    576576        m_transactionInProgress = true;
     
    590590        wrapper = ChangeVersionWrapper::create(data->oldVersion(), data->newVersion());
    591591
    592     RefPtr<SQLTransactionBackend> transactionBackend = SQLTransactionBackend::create(this, WTFMove(transaction), WTFMove(wrapper), readOnly);
     592    RefPtr<SQLTransactionBackend> transactionBackend = SQLTransactionBackend::create(this, WTFMove(transaction), wrapper, readOnly);
    593593    m_transactionQueue.append(transactionBackend);
    594594    if (!m_transactionInProgress)
  • trunk/Source/WebCore/Modules/webdatabase/Database.h

    r202676 r202698  
    126126
    127127private:
    128     Database(RefPtr<DatabaseContext>&&, const String& name, const String& expectedVersion, const String& displayName, unsigned long estimatedSize);
     128    Database(PassRefPtr<DatabaseContext>, const String& name, const String& expectedVersion, const String& displayName, unsigned long estimatedSize);
    129129
    130130    void closeDatabase();
  • trunk/Source/WebCore/Modules/webdatabase/DatabaseAuthorizer.cpp

    r202676 r202698  
    3030#include "DatabaseAuthorizer.h"
    3131
     32#include <wtf/PassRefPtr.h>
    3233#include <wtf/text/WTFString.h>
    3334
     
    344345    if (m_permissions & NoAccessMask && m_securityEnabled)
    345346        return SQLAuthDeny;
    346 
     347   
    347348    return denyBasedOnTableName(tableName);
    348349}
  • trunk/Source/WebCore/Modules/webdatabase/DatabaseManager.cpp

    r202676 r202698  
    2121 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
    2222 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
    23  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
    2424 */
    2525
     
    273273RefPtr<Database> DatabaseManager::openDatabase(ScriptExecutionContext* context,
    274274    const String& name, const String& expectedVersion, const String& displayName,
    275     unsigned long estimatedSize, RefPtr<DatabaseCallback>&& creationCallback,
     275    unsigned long estimatedSize, PassRefPtr<DatabaseCallback> creationCallback,
    276276    DatabaseError& error)
    277277{
     
    328328        }
    329329    }
    330 
     330   
    331331    return m_server->fullPathForDatabase(origin, name, createIfDoesNotExist);
    332332}
     
    351351    {
    352352        std::lock_guard<Lock> lock(m_mutex);
    353 
     353       
    354354        for (auto* proposedDatabase : m_proposedDatabases) {
    355355            if (proposedDatabase->details().name() == name && proposedDatabase->origin()->equal(origin)) {
    356356                ASSERT(proposedDatabase->details().threadID() == std::this_thread::get_id() || isMainThread());
    357 
     357               
    358358                return proposedDatabase->details();
    359359            }
    360360        }
    361361    }
    362 
     362   
    363363    return m_server->detailsForNameAndOrigin(name, origin);
    364364}
  • trunk/Source/WebCore/Modules/webdatabase/DatabaseManager.h

    r202676 r202698  
    2121 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
    2222 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
    23  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
    2424 */
    2525
     
    3434#include <wtf/HashSet.h>
    3535#include <wtf/Lock.h>
     36#include <wtf/PassRefPtr.h>
    3637#include <wtf/Threading.h>
    3738
     
    8182    static ExceptionCode exceptionCodeForDatabaseError(DatabaseError);
    8283
    83     RefPtr<Database> openDatabase(ScriptExecutionContext*, const String& name, const String& expectedVersion, const String& displayName, unsigned long estimatedSize, RefPtr<DatabaseCallback>&&, DatabaseError&);
     84    RefPtr<Database> openDatabase(ScriptExecutionContext*, const String& name, const String& expectedVersion, const String& displayName, unsigned long estimatedSize, PassRefPtr<DatabaseCallback>, DatabaseError&);
    8485
    8586    WEBCORE_EXPORT bool hasOpenDatabases(ScriptExecutionContext*);
  • trunk/Source/WebCore/Modules/webdatabase/DatabaseServer.cpp

    r202676 r202698  
    2121 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
    2222 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
    23  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
    2424 */
    2525
     
    118118    RefPtr<Database> database;
    119119    bool success = false; // Make some older compilers happy.
    120 
     120   
    121121    switch (attempt) {
    122122    case FirstTryToOpenDatabase:
     
    134134RefPtr<Database> DatabaseServer::createDatabase(RefPtr<DatabaseContext>& backendContext, const String& name, const String& expectedVersion, const String& displayName, unsigned long estimatedSize, bool setVersionInNewDatabase, DatabaseError& error, String& errorMessage)
    135135{
    136     RefPtr<Database> database = adoptRef(new Database(backendContext.copyRef(), name, expectedVersion, displayName, estimatedSize));
     136    RefPtr<Database> database = adoptRef(new Database(backendContext, name, expectedVersion, displayName, estimatedSize));
    137137
    138138    if (!database->openAndVerifyVersion(setVersionInNewDatabase, error, errorMessage))
  • trunk/Source/WebCore/Modules/webdatabase/DatabaseTask.cpp

    r202676 r202698  
    145145// Starts a transaction that will report its results via a callback.
    146146
    147 DatabaseTransactionTask::DatabaseTransactionTask(RefPtr<SQLTransactionBackend>&& transaction)
     147DatabaseTransactionTask::DatabaseTransactionTask(PassRefPtr<SQLTransactionBackend> transaction)
    148148    : DatabaseTask(*transaction->database(), 0)
    149     , m_transaction(WTFMove(transaction))
     149    , m_transaction(transaction)
    150150    , m_didPerformTask(false)
    151151{
  • trunk/Source/WebCore/Modules/webdatabase/DatabaseTask.h

    r202676 r202698  
    3434#include <wtf/Condition.h>
    3535#include <wtf/Lock.h>
     36#include <wtf/PassRefPtr.h>
    3637#include <wtf/Vector.h>
    3738#include <wtf/text/WTFString.h>
     
    123124class DatabaseTransactionTask : public DatabaseTask {
    124125public:
    125     explicit DatabaseTransactionTask(RefPtr<SQLTransactionBackend>&&);
     126    explicit DatabaseTransactionTask(PassRefPtr<SQLTransactionBackend>);
    126127    virtual ~DatabaseTransactionTask();
    127128
  • trunk/Source/WebCore/Modules/webdatabase/SQLCallbackWrapper.h

    r202676 r202698  
    4242template<typename T> class SQLCallbackWrapper {
    4343public:
    44     SQLCallbackWrapper(RefPtr<T>&& callback, ScriptExecutionContext* scriptExecutionContext)
    45         : m_callback(WTFMove(callback))
     44    SQLCallbackWrapper(PassRefPtr<T> callback, ScriptExecutionContext* scriptExecutionContext)
     45        : m_callback(callback)
    4646        , m_scriptExecutionContext(m_callback ? scriptExecutionContext : 0)
    4747    {
  • trunk/Source/WebCore/Modules/webdatabase/SQLResultSetRowList.h

    r202676 r202698  
    3030#define SQLResultSetRowList_h
    3131
     32#include <wtf/PassRefPtr.h>
    3233#include <wtf/RefCounted.h>
    3334#include "SQLValue.h"
  • trunk/Source/WebCore/Modules/webdatabase/SQLStatement.cpp

    r202676 r202698  
    4141
    4242
    43 // The Life-Cycle of a SQLStatement i.e. Who's keeping the SQLStatement alive?
     43// The Life-Cycle of a SQLStatement i.e. Who's keeping the SQLStatement alive? 
    4444// ==========================================================================
    4545// The RefPtr chain goes something like this:
     
    7575namespace WebCore {
    7676
    77 SQLStatement::SQLStatement(Database& database, const String& statement, const Vector<SQLValue>& arguments, RefPtr<SQLStatementCallback>&& callback, RefPtr<SQLStatementErrorCallback>&& errorCallback, int permissions)
     77SQLStatement::SQLStatement(Database& database, const String& statement, const Vector<SQLValue>& arguments, PassRefPtr<SQLStatementCallback> callback, PassRefPtr<SQLStatementErrorCallback> errorCallback, int permissions)
    7878    : m_statement(statement.isolatedCopy())
    7979    , m_arguments(arguments)
    80     , m_statementCallbackWrapper(WTFMove(callback), database.scriptExecutionContext())
    81     , m_statementErrorCallbackWrapper(WTFMove(errorCallback), database.scriptExecutionContext())
     80    , m_statementCallbackWrapper(callback, database.scriptExecutionContext())
     81    , m_statementErrorCallbackWrapper(errorCallback, database.scriptExecutionContext())
    8282    , m_permissions(permissions)
    8383{
     
    8888}
    8989
    90 SQLError* SQLStatement::sqlError() const
    91 {
    92     return m_error.get();
    93 }
    94 
    95 SQLResultSet* SQLStatement::sqlResultSet() const
    96 {
    97     return m_resultSet.get();
     90PassRefPtr<SQLError> SQLStatement::sqlError() const
     91{
     92    return m_error;
     93}
     94
     95PassRefPtr<SQLResultSet> SQLStatement::sqlResultSet() const
     96{
     97    return m_resultSet;
    9898}
    9999
  • trunk/Source/WebCore/Modules/webdatabase/SQLStatement.h

    r202676 r202698  
    4646class SQLStatement {
    4747public:
    48     SQLStatement(Database&, const String&, const Vector<SQLValue>&, RefPtr<SQLStatementCallback>&&, RefPtr<SQLStatementErrorCallback>&&, int permissions);
     48    SQLStatement(Database&, const String&, const Vector<SQLValue>&, PassRefPtr<SQLStatementCallback>, PassRefPtr<SQLStatementErrorCallback>, int permissions);
    4949    ~SQLStatement();
    5050
     
    5959    void setVersionMismatchedError();
    6060
    61     SQLError* sqlError() const;
    62     SQLResultSet* sqlResultSet() const;
     61    PassRefPtr<SQLError> sqlError() const;
     62    PassRefPtr<SQLResultSet> sqlResultSet() const;
    6363
    6464private:
  • trunk/Source/WebCore/Modules/webdatabase/SQLTransaction.h

    r202676 r202698  
    3333#include "SQLCallbackWrapper.h"
    3434#include "SQLTransactionStateMachine.h"
     35#include <wtf/PassRefPtr.h>
    3536#include <wtf/Ref.h>
    3637#include <wtf/RefPtr.h>
  • trunk/Source/WebCore/Modules/webdatabase/SQLTransactionBackend.cpp

    r202676 r202698  
    231231
    232232
    233 // The Life-Cycle of a SQLTransaction i.e. Who's keeping the SQLTransaction alive?
     233// The Life-Cycle of a SQLTransaction i.e. Who's keeping the SQLTransaction alive? 
    234234// ==============================================================================
    235235// The RefPtr chain goes something like this:
     
    308308//       DatabaseBackend::m_transactionQueue and call
    309309//       notifyDatabaseThreadIsShuttingDown() on each transaction there.
    310 //
     310//       
    311311//     Phase 2. After scheduling, before state AcquireLock
    312312//
     
    344344namespace WebCore {
    345345
    346 Ref<SQLTransactionBackend> SQLTransactionBackend::create(Database* db, RefPtr<SQLTransaction>&& frontend, RefPtr<SQLTransactionWrapper>&& wrapper, bool readOnly)
    347 {
    348     return adoptRef(*new SQLTransactionBackend(db, WTFMove(frontend), WTFMove(wrapper), readOnly));
    349 }
    350 
    351 SQLTransactionBackend::SQLTransactionBackend(Database* db, RefPtr<SQLTransaction>&& frontend, RefPtr<SQLTransactionWrapper>&& wrapper, bool readOnly)
    352     : m_frontend(WTFMove(frontend))
     346Ref<SQLTransactionBackend> SQLTransactionBackend::create(Database* db, PassRefPtr<SQLTransaction> frontend, PassRefPtr<SQLTransactionWrapper> wrapper, bool readOnly)
     347{
     348    return adoptRef(*new SQLTransactionBackend(db, frontend, wrapper, readOnly));
     349}
     350
     351SQLTransactionBackend::SQLTransactionBackend(Database* db, PassRefPtr<SQLTransaction> frontend, PassRefPtr<SQLTransactionWrapper> wrapper, bool readOnly)
     352    : m_frontend(frontend)
    353353    , m_database(db)
    354     , m_wrapper(WTFMove(wrapper))
     354    , m_wrapper(wrapper)
    355355    , m_hasCallback(m_frontend->hasCallback())
    356356    , m_hasSuccessCallback(m_frontend->hasSuccessCallback())
     
    429429}
    430430
    431 SQLError* SQLTransactionBackend::transactionError()
    432 {
    433     return m_transactionError.get();
     431PassRefPtr<SQLError> SQLTransactionBackend::transactionError()
     432{
     433    return m_transactionError;
    434434}
    435435
  • trunk/Source/WebCore/Modules/webdatabase/SQLTransactionBackend.h

    r202676 r202698  
    5959class SQLTransactionBackend : public ThreadSafeRefCounted<SQLTransactionBackend>, public SQLTransactionStateMachine<SQLTransactionBackend> {
    6060public:
    61     static Ref<SQLTransactionBackend> create(Database*, RefPtr<SQLTransaction>&&, RefPtr<SQLTransactionWrapper>&&, bool readOnly);
     61    static Ref<SQLTransactionBackend> create(Database*, PassRefPtr<SQLTransaction>, PassRefPtr<SQLTransactionWrapper>, bool readOnly);
    6262
    6363    virtual ~SQLTransactionBackend();
     
    7272    // APIs called from the frontend published via SQLTransactionBackend:
    7373    void requestTransitToState(SQLTransactionState);
    74     SQLError* transactionError();
     74    PassRefPtr<SQLError> transactionError();
    7575    SQLStatement* currentStatement();
    7676    void setShouldRetryCurrentStatement(bool);
    7777    void executeSQL(std::unique_ptr<SQLStatement>);
    78 
     78   
    7979private:
    80     SQLTransactionBackend(Database*, RefPtr<SQLTransaction>&&, RefPtr<SQLTransactionWrapper>&&, bool readOnly);
     80    SQLTransactionBackend(Database*, PassRefPtr<SQLTransaction>, PassRefPtr<SQLTransactionWrapper>, bool readOnly);
    8181
    8282    void doCleanup();
Note: See TracChangeset for help on using the changeset viewer.