Changeset 94893 in webkit
- Timestamp:
- Sep 9, 2011 5:59:43 PM (13 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r94892 r94893 1 2011-09-09 Chris Rogers <crogers@google.com> 2 3 HRTFDatabaseLoader should not call WTF::waitForThreadCompletion() more than once 4 https://bugs.webkit.org/show_bug.cgi?id=67866 5 6 Reviewed by David Levin. 7 8 No new tests since this is difficult to test. 9 This is designed to fix existing webaudio layout test failures. 10 11 * platform/audio/HRTFDatabaseLoader.cpp: 12 (WebCore::HRTFDatabaseLoader::HRTFDatabaseLoader): 13 (WebCore::HRTFDatabaseLoader::~HRTFDatabaseLoader): 14 (WebCore::HRTFDatabaseLoader::loadAsynchronously): 15 (WebCore::HRTFDatabaseLoader::waitForLoaderThreadCompletion): 16 * platform/audio/HRTFDatabaseLoader.h: 17 1 18 2011-09-09 Jessie Berlin <jberlin@apple.com> 2 19 -
trunk/Source/WebCore/platform/audio/HRTFDatabaseLoader.cpp
r92068 r94893 62 62 HRTFDatabaseLoader::HRTFDatabaseLoader(double sampleRate) 63 63 : m_databaseLoaderThread(0) 64 , m_startedLoadingDatabase(false)65 64 , m_databaseSampleRate(sampleRate) 66 65 { … … 72 71 ASSERT(isMainThread()); 73 72 74 if (m_startedLoadingDatabase) 75 waitForThreadCompletion(m_databaseLoaderThread, 0); 76 77 m_startedLoadingDatabase = false; 78 m_databaseLoaderThread = 0; 79 73 waitForLoaderThreadCompletion(); 80 74 m_hrtfDatabase.clear(); 81 75 … … 108 102 { 109 103 ASSERT(isMainThread()); 104 105 MutexLocker locker(m_threadLock); 110 106 111 if (!m_hrtfDatabase.get() && !m_ startedLoadingDatabase) {107 if (!m_hrtfDatabase.get() && !m_databaseLoaderThread) { 112 108 // Start the asynchronous database loading process. 113 m_startedLoadingDatabase = true;114 109 m_databaseLoaderThread = createThread(databaseLoaderEntry, this, "HRTF database loader"); 115 110 } … … 121 116 } 122 117 123 124 118 void HRTFDatabaseLoader::waitForLoaderThreadCompletion() 125 119 { 126 ASSERT(!isMainThread()); 127 ASSERT(m_databaseLoaderThread); 128 waitForThreadCompletion(m_databaseLoaderThread, 0); 120 MutexLocker locker(m_threadLock); 121 122 // waitForThreadCompletion() should not be called twice for the same thread. 123 if (m_databaseLoaderThread) 124 waitForThreadCompletion(m_databaseLoaderThread, 0); 125 m_databaseLoaderThread = 0; 129 126 } 130 127 -
trunk/Source/WebCore/platform/audio/HRTFDatabaseLoader.h
r90839 r94893 56 56 bool isLoaded() const; 57 57 58 // May not be called on the main thread. 59 // This is so a different background thread may synchronize with the loader thread. 58 // waitForLoaderThreadCompletion() may be called more than once and is thread-safe. 60 59 void waitForLoaderThreadCompletion(); 61 60 … … 82 81 static HRTFDatabaseLoader* s_loader; // singleton 83 82 OwnPtr<HRTFDatabase> m_hrtfDatabase; 83 84 // Holding a m_threadLock is required when accessing m_databaseLoaderThread. 85 Mutex m_threadLock; 84 86 ThreadIdentifier m_databaseLoaderThread; 85 bool m_startedLoadingDatabase; 87 86 88 double m_databaseSampleRate; 87 89 }; 88 89 90 90 91 } // namespace WebCore
Note: See TracChangeset
for help on using the changeset viewer.