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

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

Issue 1909813002: Enable per thread heap for database thread (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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/DatabaseThread.cpp
diff --git a/third_party/WebKit/Source/modules/webdatabase/DatabaseThread.cpp b/third_party/WebKit/Source/modules/webdatabase/DatabaseThread.cpp
index c73e968fc0f5e00a24d28bb06e10480478c3c955..0fe57779d626c97a50d2be7e6cbd5196211625da 100644
--- a/third_party/WebKit/Source/modules/webdatabase/DatabaseThread.cpp
+++ b/third_party/WebKit/Source/modules/webdatabase/DatabaseThread.cpp
@@ -41,10 +41,10 @@ namespace blink {
DatabaseThread::DatabaseThread()
: m_transactionClient(adoptPtr(new SQLTransactionClient()))
- , m_transactionCoordinator(new SQLTransactionCoordinator())
, m_cleanupSync(nullptr)
, m_terminationRequested(false)
{
+ DCHECK(isMainThread());
}
DatabaseThread::~DatabaseThread()
@@ -55,8 +55,6 @@ DatabaseThread::~DatabaseThread()
DEFINE_TRACE(DatabaseThread)
{
- visitor->trace(m_openDatabaseSet);
- visitor->trace(m_transactionCoordinator);
}
void DatabaseThread::start()
@@ -64,13 +62,14 @@ void DatabaseThread::start()
ASSERT(isMainThread());
if (m_thread)
return;
- m_thread = WebThreadSupportingGC::create("WebCore: Database");
+ m_thread = WebThreadSupportingGC::create("WebCore: Database", true);
m_thread->postTask(BLINK_FROM_HERE, threadSafeBind(&DatabaseThread::setupDatabaseThread, wrapCrossThreadPersistent(this)));
}
void DatabaseThread::setupDatabaseThread()
{
m_thread->initialize();
+ m_transactionCoordinator = new SQLTransactionCoordinator();
}
void DatabaseThread::terminate()
@@ -94,6 +93,8 @@ void DatabaseThread::terminate()
void DatabaseThread::cleanupDatabaseThread()
{
+ DCHECK(isDatabaseThread());
+
WTF_LOG(StorageAPI, "Cleaning up DatabaseThread %p", this);
// Clean up the list of all pending transactions on this database thread
@@ -103,10 +104,10 @@ void DatabaseThread::cleanupDatabaseThread()
// inconsistent or locked state.
if (m_openDatabaseSet.size() > 0) {
// As the call to close will modify the original set, we must take a copy to iterate over.
- HeapHashSet<Member<Database>> openSetCopy;
+ HashSet<CrossThreadPersistent<Database>> openSetCopy;
openSetCopy.swap(m_openDatabaseSet);
- HeapHashSet<Member<Database>>::iterator end = openSetCopy.end();
- for (HeapHashSet<Member<Database>>::iterator it = openSetCopy.begin(); it != end; ++it)
+ HashSet<CrossThreadPersistent<Database>>::iterator end = openSetCopy.end();
+ for (HashSet<CrossThreadPersistent<Database>>::iterator it = openSetCopy.begin(); it != end; ++it)
(*it)->close();
}
m_openDatabaseSet.clear();

Powered by Google App Engine
This is Rietveld 408576698