+2010-12-30 Steve Block <steveblock@google.com>
+
+ Reviewed by Sam Weinig.
+
+ Visiting macnn.com often causes SQL spew via geolocation database
+ https://bugs.webkit.org/show_bug.cgi?id=51557
+
+ If the Geolocation position cache database path has not been set, early-out
+ rather than using an empty path and thus failing to open the database.
+ This avoids SQL log spew.
+
+ Also, avoid starting the database thread until the path has been set, and
+ shorten the thread name to avoid warnings due to exceeding 30 characters.
+
+ No new tests, implementation clean-up only.
+
+ * page/GeolocationPositionCache.cpp:
+ (WebCore::GeolocationPositionCache::addUser):
+ (WebCore::GeolocationPositionCache::removeUser):
+ (WebCore::GeolocationPositionCache::setDatabasePath):
+ (WebCore::GeolocationPositionCache::startBackgroundThread):
+
2010-12-29 Philippe Normand <pnormand@igalia.com>
Reviewed by Martin Robinson.
void GeolocationPositionCache::addUser()
{
ASSERT(numUsers >= 0);
- if (!numUsers && !m_threadId) {
+ MutexLocker databaseLock(m_databaseFileMutex);
+ if (!numUsers && !m_threadId && !m_databaseFile.isNull()) {
startBackgroundThread();
MutexLocker lock(m_cachedPositionMutex);
if (!m_cachedPosition)
MutexLocker lock(m_cachedPositionMutex);
--numUsers;
ASSERT(numUsers >= 0);
- if (!numUsers && m_cachedPosition)
+ if (!numUsers && m_cachedPosition && m_threadId)
triggerWriteToDatabase();
}
MutexLocker lock(m_databaseFileMutex);
if (m_databaseFile != newFile) {
m_databaseFile = newFile;
- if (numUsers && !m_cachedPosition)
- triggerReadFromDatabase();
+ if (numUsers && !m_threadId) {
+ startBackgroundThread();
+ if (!m_cachedPosition)
+ triggerReadFromDatabase();
+ }
}
}
void GeolocationPositionCache::startBackgroundThread()
{
// FIXME: Consider sharing this thread with other background tasks.
- m_threadId = createThread(threadEntryPoint, this, "WebCore: GeolocationPositionCache");
+ m_threadId = createThread(threadEntryPoint, this, "WebCore: Geolocation cache");
}
void* GeolocationPositionCache::threadEntryPoint(void* object)