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

Unified Diff: content/child/indexed_db/indexed_db_database_callbacks_impl.cc

Issue 2506443002: Fix data race in IndexedDBDatabaseCallbacksImpl::Abort (Closed)
Patch Set: Created 4 years, 1 month 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/child/indexed_db/indexed_db_database_callbacks_impl.cc
diff --git a/content/child/indexed_db/indexed_db_database_callbacks_impl.cc b/content/child/indexed_db/indexed_db_database_callbacks_impl.cc
index 4eab2f93bbfe8855a414fe5a63e71ca2258e5a89..1ae0b2d03d64e80d95b4d7f95755185968298873 100644
--- a/content/child/indexed_db/indexed_db_database_callbacks_impl.cc
+++ b/content/child/indexed_db/indexed_db_database_callbacks_impl.cc
@@ -23,6 +23,13 @@ void DeleteDatabaseCallbacks(WebIDBDatabaseCallbacks* callbacks,
delete callbacks;
}
+void BuildErrorAndAbort(WebIDBDatabaseCallbacks* callbacks,
+ int64_t transaction_id,
+ int32_t code,
+ const base::string16& message) {
+ callbacks->onAbort(transaction_id, blink::WebIDBDatabaseError(code, message));
+}
+
} // namespace
IndexedDBDatabaseCallbacksImpl::IndexedDBDatabaseCallbacksImpl(
@@ -59,10 +66,11 @@ void IndexedDBDatabaseCallbacksImpl::VersionChange(int64_t old_version,
void IndexedDBDatabaseCallbacksImpl::Abort(int64_t transaction_id,
int32_t code,
const base::string16& message) {
+ // Indirect through BuildErrorAndAbort because it isn't safe to pass a
+ // WebIDBDatabaseError between threads.
callback_runner_->PostTask(
- FROM_HERE, base::Bind(&WebIDBDatabaseCallbacks::onAbort,
- base::Unretained(callbacks_), transaction_id,
- blink::WebIDBDatabaseError(code, message)));
+ FROM_HERE, base::Bind(&BuildErrorAndAbort, base::Unretained(callbacks_),
+ transaction_id, code, message));
}
void IndexedDBDatabaseCallbacksImpl::Complete(int64_t transaction_id) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698