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

Unified Diff: content/browser/indexed_db/indexed_db_database_callbacks.h

Issue 2784003002: [IndexedDB] Mojo testing harness. (Closed)
Patch Set: Working! Created 3 years, 7 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: content/browser/indexed_db/indexed_db_database_callbacks.h
diff --git a/content/browser/indexed_db/indexed_db_database_callbacks.h b/content/browser/indexed_db/indexed_db_database_callbacks.h
index 654195a18ea19d5dd5cc140bda34a3e9a487a986..07c42610465e3a43d6acfb181e842f8485b61f58 100644
--- a/content/browser/indexed_db/indexed_db_database_callbacks.h
+++ b/content/browser/indexed_db/indexed_db_database_callbacks.h
@@ -44,9 +44,28 @@ class CONTENT_EXPORT IndexedDBDatabaseCallbacks
class IOThreadHelper;
+ // Required for unittests so that are scheduled on a taskrunner.
+ struct DeleteOnIOThreadTaskRunner {
+ template <typename T>
+ static void Destruct(const T* x) {
+ if (!BrowserThread::DeleteSoon(BrowserThread::IO, FROM_HERE, x)) {
+#if defined(UNIT_TEST)
+ // Only logged under unit testing because leaks at shutdown
+ // are acceptable under normal circumstances.
+ LOG(ERROR) << "DeleteSoon failed on IO thread";
+#endif // UNIT_TEST
+ }
+ }
+ template <typename T>
+ inline void operator()(T* ptr) const {
+ enum { type_must_be_complete = sizeof(T) };
+ Destruct(ptr);
+ }
+ };
+
bool complete_ = false;
scoped_refptr<IndexedDBContextImpl> indexed_db_context_;
- std::unique_ptr<IOThreadHelper, BrowserThread::DeleteOnIOThread> io_helper_;
+ std::unique_ptr<IOThreadHelper, DeleteOnIOThreadTaskRunner> io_helper_;
base::ThreadChecker thread_checker_;
DISALLOW_COPY_AND_ASSIGN(IndexedDBDatabaseCallbacks);

Powered by Google App Engine
This is Rietveld 408576698