Chromium Code Reviews| 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 |