Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(924)

Unified Diff: third_party/WebKit/Source/modules/webdatabase/Database.cpp

Issue 2741443003: Replace createCrossThreadTask with crossThreadBind in webdatabase (Closed)
Patch Set: comment Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/modules/webdatabase/Database.cpp
diff --git a/third_party/WebKit/Source/modules/webdatabase/Database.cpp b/third_party/WebKit/Source/modules/webdatabase/Database.cpp
index 8c2b1e40ceb3e0936ca2a24225a6c5709db8c11f..5d5624436b7aa7160994051175aabd35b4e06dae 100644
--- a/third_party/WebKit/Source/modules/webdatabase/Database.cpp
+++ b/third_party/WebKit/Source/modules/webdatabase/Database.cpp
@@ -25,9 +25,9 @@
#include "modules/webdatabase/Database.h"
+#include <memory>
#include "core/dom/ExceptionCode.h"
#include "core/dom/ExecutionContext.h"
-#include "core/dom/ExecutionContextTask.h"
#include "core/dom/TaskRunnerHelper.h"
#include "core/html/VoidCallback.h"
#include "core/inspector/ConsoleMessage.h"
@@ -49,6 +49,7 @@
#include "modules/webdatabase/StorageLog.h"
#include "modules/webdatabase/sqlite/SQLiteStatement.h"
#include "modules/webdatabase/sqlite/SQLiteTransaction.h"
+#include "platform/CrossThreadFunctional.h"
#include "platform/WaitableEvent.h"
#include "platform/heap/SafePoint.h"
#include "public/platform/Platform.h"
@@ -56,7 +57,6 @@
#include "public/platform/WebSecurityOrigin.h"
#include "wtf/Atomics.h"
#include "wtf/CurrentTime.h"
-#include <memory>
// Registering "opened" databases with the DatabaseTracker
// =======================================================
@@ -248,6 +248,8 @@ Database::Database(DatabaseContext* databaseContext,
m_contextThreadSecurityOrigin->isolatedCopy();
ASSERT(m_databaseContext->databaseThread());
ASSERT(m_databaseContext->isContextThread());
+ m_databaseTaskRunner =
+ TaskRunnerHelper::get(TaskType::DatabaseAccess, getExecutionContext());
}
Database::~Database() {
@@ -873,10 +875,10 @@ void Database::runTransaction(SQLTransactionCallback* callback,
if (callback) {
std::unique_ptr<SQLErrorData> error = SQLErrorData::create(
SQLError::kUnknownErr, "database has been closed");
- TaskRunnerHelper::get(TaskType::DatabaseAccess, getExecutionContext())
- ->postTask(BLINK_FROM_HERE, WTF::bind(&callTransactionErrorCallback,
- wrapPersistent(callback),
- WTF::passed(std::move(error))));
+ getDatabaseTaskRunner()->postTask(
+ BLINK_FROM_HERE,
+ WTF::bind(&callTransactionErrorCallback, wrapPersistent(callback),
+ WTF::passed(std::move(error))));
}
}
}
@@ -884,10 +886,9 @@ void Database::runTransaction(SQLTransactionCallback* callback,
void Database::scheduleTransactionCallback(SQLTransaction* transaction) {
// The task is constructed in a database thread, and destructed in the
// context thread.
- getExecutionContext()->postTask(
- TaskType::DatabaseAccess, BLINK_FROM_HERE,
- createCrossThreadTask(&SQLTransaction::performPendingCallback,
- wrapCrossThreadPersistent(transaction)));
+ getDatabaseTaskRunner()->postTask(
+ BLINK_FROM_HERE, crossThreadBind(&SQLTransaction::performPendingCallback,
+ wrapCrossThreadPersistent(transaction)));
}
Vector<String> Database::performGetTableNames() {
@@ -951,4 +952,8 @@ bool Database::opened() {
return static_cast<bool>(acquireLoad(&m_opened));
}
+WebTaskRunner* Database::getDatabaseTaskRunner() const {
+ return m_databaseTaskRunner.get();
+}
+
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698