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

Unified Diff: Source/platform/audio/HRTFDatabaseLoader.cpp

Issue 685153005: Oilpan: HRTF dababase loader thread should be attached to Oilpan (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 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 | « Source/platform/audio/HRTFDatabaseLoader.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/audio/HRTFDatabaseLoader.cpp
diff --git a/Source/platform/audio/HRTFDatabaseLoader.cpp b/Source/platform/audio/HRTFDatabaseLoader.cpp
index 4731ec45d3d6a8be06b0b257329d7dbbc731b987..79f1fc2c544c4e36485c7b5474a81d107b42b4e6 100644
--- a/Source/platform/audio/HRTFDatabaseLoader.cpp
+++ b/Source/platform/audio/HRTFDatabaseLoader.cpp
@@ -71,20 +71,23 @@ HRTFDatabaseLoader::HRTFDatabaseLoader(float sampleRate)
HRTFDatabaseLoader::~HRTFDatabaseLoader()
{
ASSERT(isMainThread());
-
- MutexLocker locker(m_lock);
tkent 2014/11/10 06:27:54 Please mention this change in the CL description.
haraken 2014/11/10 06:37:10 Done.
waitForLoaderThreadCompletion();
- m_hrtfDatabase.clear();
}
void HRTFDatabaseLoader::load()
{
ASSERT(!isMainThread());
- MutexLocker locker(m_lock);
- if (!m_hrtfDatabase) {
- // Load the default HRTF database.
- m_hrtfDatabase = HRTFDatabase::create(m_databaseSampleRate);
+ m_thread->attachGC();
+
+ {
+ MutexLocker locker(m_lock);
+ if (!m_hrtfDatabase) {
+ // Load the default HRTF database.
+ m_hrtfDatabase = HRTFDatabase::create(m_databaseSampleRate);
+ }
}
+
+ m_thread->detachGC();
}
void HRTFDatabaseLoader::loadAsynchronously()
@@ -92,10 +95,10 @@ void HRTFDatabaseLoader::loadAsynchronously()
ASSERT(isMainThread());
MutexLocker locker(m_lock);
- if (!m_hrtfDatabase && !m_databaseLoaderThread) {
+ if (!m_hrtfDatabase && !m_thread) {
// Start the asynchronous database loading process.
- m_databaseLoaderThread = adoptPtr(Platform::current()->createThread("HRTF database loader"));
- m_databaseLoaderThread->postTask(new Task(WTF::bind(&HRTFDatabaseLoader::load, this)));
+ m_thread = WebThreadSupportingGC::create("HRTF database loader");
+ m_thread->postTask(new Task(WTF::bind(&HRTFDatabaseLoader::load, this)));
}
}
@@ -107,7 +110,7 @@ bool HRTFDatabaseLoader::isLoaded()
void HRTFDatabaseLoader::waitForLoaderThreadCompletion()
{
- m_databaseLoaderThread.clear();
+ m_thread.clear();
}
} // namespace blink
« no previous file with comments | « Source/platform/audio/HRTFDatabaseLoader.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698