diff options
Diffstat (limited to 'WebCore/loader/icon')
-rw-r--r-- | WebCore/loader/icon/IconDatabase.cpp | 21 | ||||
-rw-r--r-- | WebCore/loader/icon/IconDatabase.h | 5 |
2 files changed, 18 insertions, 8 deletions
diff --git a/WebCore/loader/icon/IconDatabase.cpp b/WebCore/loader/icon/IconDatabase.cpp index 63b9c64..f708622 100644 --- a/WebCore/loader/icon/IconDatabase.cpp +++ b/WebCore/loader/icon/IconDatabase.cpp @@ -768,6 +768,7 @@ IconDatabase::IconDatabase() , m_threadTerminationRequested(false) , m_removeIconsRequested(false) , m_iconURLImportComplete(false) + , m_disabledSuddenTerminationForSyncThread(false) , m_initialPruningComplete(false) , m_client(defaultClient()) , m_imported(false) @@ -806,13 +807,17 @@ void IconDatabase::notifyPendingLoadDecisions() void IconDatabase::wakeSyncThread() { - // The following is balanced by the call to enableSuddenTermination in the - // syncThreadMainLoop function. - // FIXME: It would be better to only disable sudden termination if we have - // something to write, not just if we have something to read. - disableSuddenTermination(); - MutexLocker locker(m_syncLock); + + if (!m_disabledSuddenTerminationForSyncThread) { + m_disabledSuddenTerminationForSyncThread = true; + // The following is balanced by the call to enableSuddenTermination in the + // syncThreadMainLoop function. + // FIXME: It would be better to only disable sudden termination if we have + // something to write, not just if we have something to read. + disableSuddenTermination(); + } + m_syncCondition.signal(); } @@ -1411,7 +1416,9 @@ void* IconDatabase::syncThreadMainLoop() // The following is balanced by the call to disableSuddenTermination in the // wakeSyncThread function. Any time we wait on the condition, we also have // to enableSuddenTermation, after doing the next batch of work. + ASSERT(m_disabledSuddenTerminationForSyncThread); enableSuddenTermination(); + m_disabledSuddenTerminationForSyncThread = false; } m_syncCondition.wait(m_syncLock); @@ -1428,7 +1435,9 @@ void* IconDatabase::syncThreadMainLoop() // The following is balanced by the call to disableSuddenTermination in the // wakeSyncThread function. Any time we wait on the condition, we also have // to enableSuddenTermation, after doing the next batch of work. + ASSERT(m_disabledSuddenTerminationForSyncThread); enableSuddenTermination(); + m_disabledSuddenTerminationForSyncThread = false; } return 0; diff --git a/WebCore/loader/icon/IconDatabase.h b/WebCore/loader/icon/IconDatabase.h index 9793d21..6146aa6 100644 --- a/WebCore/loader/icon/IconDatabase.h +++ b/WebCore/loader/icon/IconDatabase.h @@ -144,11 +144,12 @@ private: String m_databaseDirectory; // Holding m_syncLock is required when accessing m_completeDatabasePath String m_completeDatabasePath; - + bool m_threadTerminationRequested; bool m_removeIconsRequested; bool m_iconURLImportComplete; - + bool m_disabledSuddenTerminationForSyncThread; + Mutex m_urlAndIconLock; // Holding m_urlAndIconLock is required when accessing any of the following data structures or the objects they contain HashMap<String, IconRecord*> m_iconURLToRecordMap; |