Changeset 202698 in webkit
- Timestamp:
- Jun 30, 2016 1:44:42 PM (8 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 18 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r202694 r202698 1 2016-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 1 15 2016-06-30 Antoine Quint <graouts@apple.com> 2 16 -
trunk/Source/WebCore/Modules/webdatabase/ChangeVersionWrapper.cpp
r202676 r202698 31 31 #include "Database.h" 32 32 #include "SQLError.h" 33 #include <wtf/PassRefPtr.h> 33 34 #include <wtf/RefPtr.h> 34 35 -
trunk/Source/WebCore/Modules/webdatabase/DOMWindowWebDatabase.h
r202676 r202698 22 22 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 23 * (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. 25 25 */ 26 26 … … 29 29 30 30 #include "ExceptionCode.h" 31 #include <wtf/PassRefPtr.h> 31 32 #include <wtf/RefCounted.h> 32 33 #include <wtf/RefPtr.h> -
trunk/Source/WebCore/Modules/webdatabase/Database.cpp
r202676 r202698 55 55 #include "VoidCallback.h" 56 56 #include <wtf/NeverDestroyed.h> 57 #include <wtf/PassRefPtr.h> 57 58 #include <wtf/RefPtr.h> 58 59 #include <wtf/StdLibExtras.h> … … 203 204 } 204 205 205 Database::Database( RefPtr<DatabaseContext>&&databaseContext, const String& name, const String& expectedVersion, const String& displayName, unsigned long estimatedSize)206 Database::Database(PassRefPtr<DatabaseContext> databaseContext, const String& name, const String& expectedVersion, const String& displayName, unsigned long estimatedSize) 206 207 : m_scriptExecutionContext(databaseContext->scriptExecutionContext()) 207 , m_databaseContext( WTFMove(databaseContext))208 , m_databaseContext(databaseContext) 208 209 , m_deleted(false) 209 210 , m_name(name.isolatedCopy()) … … 242 243 Database::~Database() 243 244 { 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. 246 246 if (!m_scriptExecutionContext->isContextThread()) { 247 247 // Grab a pointer to the script execution here because we're releasing it when we pass it to 248 248 // 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) { 251 251 ASSERT_UNUSED(context, &context == passedContext); 252 252 RefPtr<ScriptExecutionContext> scriptExecutionContext(passedContext); … … 572 572 573 573 if (transaction && databaseContext()->databaseThread()) { 574 auto task = std::make_unique<DatabaseTransactionTask>( WTFMove(transaction));574 auto task = std::make_unique<DatabaseTransactionTask>(transaction); 575 575 LOG(StorageAPI, "Scheduling DatabaseTransactionTask %p for transaction %p\n", task.get(), task->transaction()); 576 576 m_transactionInProgress = true; … … 590 590 wrapper = ChangeVersionWrapper::create(data->oldVersion(), data->newVersion()); 591 591 592 RefPtr<SQLTransactionBackend> transactionBackend = SQLTransactionBackend::create(this, WTFMove(transaction), WTFMove(wrapper), readOnly);592 RefPtr<SQLTransactionBackend> transactionBackend = SQLTransactionBackend::create(this, WTFMove(transaction), wrapper, readOnly); 593 593 m_transactionQueue.append(transactionBackend); 594 594 if (!m_transactionInProgress) -
trunk/Source/WebCore/Modules/webdatabase/Database.h
r202676 r202698 126 126 127 127 private: 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); 129 129 130 130 void closeDatabase(); -
trunk/Source/WebCore/Modules/webdatabase/DatabaseAuthorizer.cpp
r202676 r202698 30 30 #include "DatabaseAuthorizer.h" 31 31 32 #include <wtf/PassRefPtr.h> 32 33 #include <wtf/text/WTFString.h> 33 34 … … 344 345 if (m_permissions & NoAccessMask && m_securityEnabled) 345 346 return SQLAuthDeny; 346 347 347 348 return denyBasedOnTableName(tableName); 348 349 } -
trunk/Source/WebCore/Modules/webdatabase/DatabaseManager.cpp
r202676 r202698 21 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 22 * (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. 24 24 */ 25 25 … … 273 273 RefPtr<Database> DatabaseManager::openDatabase(ScriptExecutionContext* context, 274 274 const String& name, const String& expectedVersion, const String& displayName, 275 unsigned long estimatedSize, RefPtr<DatabaseCallback>&&creationCallback,275 unsigned long estimatedSize, PassRefPtr<DatabaseCallback> creationCallback, 276 276 DatabaseError& error) 277 277 { … … 328 328 } 329 329 } 330 330 331 331 return m_server->fullPathForDatabase(origin, name, createIfDoesNotExist); 332 332 } … … 351 351 { 352 352 std::lock_guard<Lock> lock(m_mutex); 353 353 354 354 for (auto* proposedDatabase : m_proposedDatabases) { 355 355 if (proposedDatabase->details().name() == name && proposedDatabase->origin()->equal(origin)) { 356 356 ASSERT(proposedDatabase->details().threadID() == std::this_thread::get_id() || isMainThread()); 357 357 358 358 return proposedDatabase->details(); 359 359 } 360 360 } 361 361 } 362 362 363 363 return m_server->detailsForNameAndOrigin(name, origin); 364 364 } -
trunk/Source/WebCore/Modules/webdatabase/DatabaseManager.h
r202676 r202698 21 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 22 * (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. 24 24 */ 25 25 … … 34 34 #include <wtf/HashSet.h> 35 35 #include <wtf/Lock.h> 36 #include <wtf/PassRefPtr.h> 36 37 #include <wtf/Threading.h> 37 38 … … 81 82 static ExceptionCode exceptionCodeForDatabaseError(DatabaseError); 82 83 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&); 84 85 85 86 WEBCORE_EXPORT bool hasOpenDatabases(ScriptExecutionContext*); -
trunk/Source/WebCore/Modules/webdatabase/DatabaseServer.cpp
r202676 r202698 21 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 22 * (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. 24 24 */ 25 25 … … 118 118 RefPtr<Database> database; 119 119 bool success = false; // Make some older compilers happy. 120 120 121 121 switch (attempt) { 122 122 case FirstTryToOpenDatabase: … … 134 134 RefPtr<Database> DatabaseServer::createDatabase(RefPtr<DatabaseContext>& backendContext, const String& name, const String& expectedVersion, const String& displayName, unsigned long estimatedSize, bool setVersionInNewDatabase, DatabaseError& error, String& errorMessage) 135 135 { 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)); 137 137 138 138 if (!database->openAndVerifyVersion(setVersionInNewDatabase, error, errorMessage)) -
trunk/Source/WebCore/Modules/webdatabase/DatabaseTask.cpp
r202676 r202698 145 145 // Starts a transaction that will report its results via a callback. 146 146 147 DatabaseTransactionTask::DatabaseTransactionTask( RefPtr<SQLTransactionBackend>&&transaction)147 DatabaseTransactionTask::DatabaseTransactionTask(PassRefPtr<SQLTransactionBackend> transaction) 148 148 : DatabaseTask(*transaction->database(), 0) 149 , m_transaction( WTFMove(transaction))149 , m_transaction(transaction) 150 150 , m_didPerformTask(false) 151 151 { -
trunk/Source/WebCore/Modules/webdatabase/DatabaseTask.h
r202676 r202698 34 34 #include <wtf/Condition.h> 35 35 #include <wtf/Lock.h> 36 #include <wtf/PassRefPtr.h> 36 37 #include <wtf/Vector.h> 37 38 #include <wtf/text/WTFString.h> … … 123 124 class DatabaseTransactionTask : public DatabaseTask { 124 125 public: 125 explicit DatabaseTransactionTask( RefPtr<SQLTransactionBackend>&&);126 explicit DatabaseTransactionTask(PassRefPtr<SQLTransactionBackend>); 126 127 virtual ~DatabaseTransactionTask(); 127 128 -
trunk/Source/WebCore/Modules/webdatabase/SQLCallbackWrapper.h
r202676 r202698 42 42 template<typename T> class SQLCallbackWrapper { 43 43 public: 44 SQLCallbackWrapper( RefPtr<T>&&callback, ScriptExecutionContext* scriptExecutionContext)45 : m_callback( WTFMove(callback))44 SQLCallbackWrapper(PassRefPtr<T> callback, ScriptExecutionContext* scriptExecutionContext) 45 : m_callback(callback) 46 46 , m_scriptExecutionContext(m_callback ? scriptExecutionContext : 0) 47 47 { -
trunk/Source/WebCore/Modules/webdatabase/SQLResultSetRowList.h
r202676 r202698 30 30 #define SQLResultSetRowList_h 31 31 32 #include <wtf/PassRefPtr.h> 32 33 #include <wtf/RefCounted.h> 33 34 #include "SQLValue.h" -
trunk/Source/WebCore/Modules/webdatabase/SQLStatement.cpp
r202676 r202698 41 41 42 42 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? 44 44 // ========================================================================== 45 45 // The RefPtr chain goes something like this: … … 75 75 namespace WebCore { 76 76 77 SQLStatement::SQLStatement(Database& database, const String& statement, const Vector<SQLValue>& arguments, RefPtr<SQLStatementCallback>&& callback, RefPtr<SQLStatementErrorCallback>&&errorCallback, int permissions)77 SQLStatement::SQLStatement(Database& database, const String& statement, const Vector<SQLValue>& arguments, PassRefPtr<SQLStatementCallback> callback, PassRefPtr<SQLStatementErrorCallback> errorCallback, int permissions) 78 78 : m_statement(statement.isolatedCopy()) 79 79 , 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()) 82 82 , m_permissions(permissions) 83 83 { … … 88 88 } 89 89 90 SQLError*SQLStatement::sqlError() const91 { 92 return m_error .get();93 } 94 95 SQLResultSet*SQLStatement::sqlResultSet() const96 { 97 return m_resultSet .get();90 PassRefPtr<SQLError> SQLStatement::sqlError() const 91 { 92 return m_error; 93 } 94 95 PassRefPtr<SQLResultSet> SQLStatement::sqlResultSet() const 96 { 97 return m_resultSet; 98 98 } 99 99 -
trunk/Source/WebCore/Modules/webdatabase/SQLStatement.h
r202676 r202698 46 46 class SQLStatement { 47 47 public: 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); 49 49 ~SQLStatement(); 50 50 … … 59 59 void setVersionMismatchedError(); 60 60 61 SQLError*sqlError() const;62 SQLResultSet*sqlResultSet() const;61 PassRefPtr<SQLError> sqlError() const; 62 PassRefPtr<SQLResultSet> sqlResultSet() const; 63 63 64 64 private: -
trunk/Source/WebCore/Modules/webdatabase/SQLTransaction.h
r202676 r202698 33 33 #include "SQLCallbackWrapper.h" 34 34 #include "SQLTransactionStateMachine.h" 35 #include <wtf/PassRefPtr.h> 35 36 #include <wtf/Ref.h> 36 37 #include <wtf/RefPtr.h> -
trunk/Source/WebCore/Modules/webdatabase/SQLTransactionBackend.cpp
r202676 r202698 231 231 232 232 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? 234 234 // ============================================================================== 235 235 // The RefPtr chain goes something like this: … … 308 308 // DatabaseBackend::m_transactionQueue and call 309 309 // notifyDatabaseThreadIsShuttingDown() on each transaction there. 310 // 310 // 311 311 // Phase 2. After scheduling, before state AcquireLock 312 312 // … … 344 344 namespace WebCore { 345 345 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))346 Ref<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 351 SQLTransactionBackend::SQLTransactionBackend(Database* db, PassRefPtr<SQLTransaction> frontend, PassRefPtr<SQLTransactionWrapper> wrapper, bool readOnly) 352 : m_frontend(frontend) 353 353 , m_database(db) 354 , m_wrapper( WTFMove(wrapper))354 , m_wrapper(wrapper) 355 355 , m_hasCallback(m_frontend->hasCallback()) 356 356 , m_hasSuccessCallback(m_frontend->hasSuccessCallback()) … … 429 429 } 430 430 431 SQLError*SQLTransactionBackend::transactionError()432 { 433 return m_transactionError .get();431 PassRefPtr<SQLError> SQLTransactionBackend::transactionError() 432 { 433 return m_transactionError; 434 434 } 435 435 -
trunk/Source/WebCore/Modules/webdatabase/SQLTransactionBackend.h
r202676 r202698 59 59 class SQLTransactionBackend : public ThreadSafeRefCounted<SQLTransactionBackend>, public SQLTransactionStateMachine<SQLTransactionBackend> { 60 60 public: 61 static Ref<SQLTransactionBackend> create(Database*, RefPtr<SQLTransaction>&&, RefPtr<SQLTransactionWrapper>&&, bool readOnly);61 static Ref<SQLTransactionBackend> create(Database*, PassRefPtr<SQLTransaction>, PassRefPtr<SQLTransactionWrapper>, bool readOnly); 62 62 63 63 virtual ~SQLTransactionBackend(); … … 72 72 // APIs called from the frontend published via SQLTransactionBackend: 73 73 void requestTransitToState(SQLTransactionState); 74 SQLError*transactionError();74 PassRefPtr<SQLError> transactionError(); 75 75 SQLStatement* currentStatement(); 76 76 void setShouldRetryCurrentStatement(bool); 77 77 void executeSQL(std::unique_ptr<SQLStatement>); 78 78 79 79 private: 80 SQLTransactionBackend(Database*, RefPtr<SQLTransaction>&&, RefPtr<SQLTransactionWrapper>&&, bool readOnly);80 SQLTransactionBackend(Database*, PassRefPtr<SQLTransaction>, PassRefPtr<SQLTransactionWrapper>, bool readOnly); 81 81 82 82 void doCleanup();
Note: See TracChangeset
for help on using the changeset viewer.