Title: [116969] trunk/Source
- Revision
- 116969
- Author
- [email protected]
- Date
- 2012-05-14 11:04:17 -0700 (Mon, 14 May 2012)
Log Message
REGRESSION(r116796): Assertion failure in API tests
<http://webkit.org/b/86378>
<rdar://problem/10777218>
Reviewed by Anders Carlsson.
Invalidate the plugin work queue in ~WebContext to avoid hitting
the !m_isValid assertion in ~WorkQueue later on.
* UIProcess/WebContext.cpp:
(WebKit::WebContext::~WebContext):
Modified Paths
Diff
Modified: trunk/Source/WebCore/loader/icon/IconDatabase.cpp (116968 => 116969)
--- trunk/Source/WebCore/loader/icon/IconDatabase.cpp 2012-05-14 18:02:37 UTC (rev 116968)
+++ trunk/Source/WebCore/loader/icon/IconDatabase.cpp 2012-05-14 18:04:17 UTC (rev 116969)
@@ -222,6 +222,9 @@
return 0;
MutexLocker locker(m_urlAndIconLock);
+
+ if (m_retainOrReleaseIconRequested)
+ performPendingRetainAndReleaseOperations();
String pageURLCopy; // Creates a null string for easy testing
@@ -389,18 +392,20 @@
return m_defaultIconRecord->image(size);
}
+void IconDatabase::retainIconForPageURL(const String& pageURL)
+{
+ ASSERT_NOT_SYNC_THREAD();
-void IconDatabase::retainIconForPageURL(const String& pageURLOriginal)
-{
- ASSERT_NOT_SYNC_THREAD();
-
- // Cannot do anything with pageURLOriginal that would end up storing it without deep copying first
-
- if (!isEnabled() || !documentCanHaveIcon(pageURLOriginal))
+ if (!isEnabled() || !documentCanHaveIcon(pageURL))
return;
- MutexLocker locker(m_urlAndIconLock);
+ MutexLocker locker(m_urlsToRetainOrReleaseLock);
+ m_urlsToRetain.append(pageURL);
+ scheduleOrDeferSyncTimer();
+}
+void IconDatabase::performRetainIconForPageURL(const String& pageURLOriginal)
+{
PageURLRecord* record = m_pageURLToRecordMap.get(pageURLOriginal);
String pageURL;
@@ -434,17 +439,23 @@
}
}
-void IconDatabase::releaseIconForPageURL(const String& pageURLOriginal)
+void IconDatabase::releaseIconForPageURL(const String& pageURL)
{
ASSERT_NOT_SYNC_THREAD();
// Cannot do anything with pageURLOriginal that would end up storing it without deep copying first
- if (!isEnabled() || !documentCanHaveIcon(pageURLOriginal))
+ if (!isEnabled() || !documentCanHaveIcon(pageURL))
return;
-
- MutexLocker locker(m_urlAndIconLock);
+ MutexLocker locker(m_urlsToRetainOrReleaseLock);
+ m_urlsToRelease.append(pageURL);
+ m_retainOrReleaseIconRequested = true;
+ scheduleOrDeferSyncTimer();
+}
+
+void IconDatabase::performReleaseIconForPageURL(const String& pageURLOriginal)
+{
// Check if this pageURL is actually retained
if (!m_retainedPageURLs.contains(pageURLOriginal)) {
LOG_ERROR("Attempting to release icon for URL %s which is not retained", urlForLogging(pageURLOriginal).ascii().data());
@@ -498,9 +509,6 @@
}
delete pageRecord;
-
- if (isOpen())
- scheduleOrDeferSyncTimer();
}
void IconDatabase::setIconDataForIconURL(PassRefPtr<SharedBuffer> dataOriginal, const String& iconURLOriginal)
@@ -736,6 +744,10 @@
size_t IconDatabase::retainedPageURLCount()
{
MutexLocker locker(m_urlAndIconLock);
+
+ if (m_retainOrReleaseIconRequested)
+ performPendingRetainAndReleaseOperations();
+
return m_retainedPageURLs.size();
}
@@ -1306,7 +1318,10 @@
// Keep a set of ones that are retained and pending notification
{
MutexLocker locker(m_urlAndIconLock);
-
+
+ if (m_retainOrReleaseIconRequested)
+ performPendingRetainAndReleaseOperations();
+
for (unsigned i = 0; i < urls.size(); ++i) {
if (!m_retainedPageURLs.contains(urls[i])) {
PageURLRecord* record = m_pageURLToRecordMap.get(urls[i]);
@@ -1387,6 +1402,11 @@
// Then, if the thread should be quitting, quit now!
if (m_threadTerminationRequested)
break;
+
+ if (m_retainOrReleaseIconRequested) {
+ MutexLocker locker(m_urlAndIconLock);
+ performPendingRetainAndReleaseOperations();
+ }
bool didAnyWork = true;
while (didAnyWork) {
@@ -1471,6 +1491,25 @@
}
}
+void IconDatabase::performPendingRetainAndReleaseOperations()
+{
+ ASSERT(m_retainOrReleaseIconRequested);
+
+ // NOTE: The caller is assumed to hold m_urlAndIconLock.
+
+ MutexLocker vectorLocker(m_urlsToRetainOrReleaseLock);
+
+ for (unsigned i = 0; i < m_urlsToRetain.size(); ++i)
+ performRetainIconForPageURL(m_urlsToRetain[i]);
+ for (unsigned i = 0; i < m_urlsToRelease.size(); ++i)
+ performReleaseIconForPageURL(m_urlsToRelease[i]);
+ printf("Retained %lu, released %lu\n", m_urlsToRetain.size(), m_urlsToRelease.size());
+
+ m_urlsToRetain.clear();
+ m_urlsToRelease.clear();
+ m_retainOrReleaseIconRequested = false;
+}
+
bool IconDatabase::readFromDatabase()
{
ASSERT_ICON_SYNC_THREAD();
Modified: trunk/Source/WebCore/loader/icon/IconDatabase.h (116968 => 116969)
--- trunk/Source/WebCore/loader/icon/IconDatabase.h 2012-05-14 18:02:37 UTC (rev 116968)
+++ trunk/Source/WebCore/loader/icon/IconDatabase.h 2012-05-14 18:04:17 UTC (rev 116969)
@@ -159,6 +159,7 @@
bool m_iconURLImportComplete;
bool m_syncThreadHasWorkToDo;
bool m_disabledSuddenTerminationForSyncThread;
+ bool m_retainOrReleaseIconRequested;
Mutex m_urlAndIconLock;
// Holding m_urlAndIconLock is required when accessing any of the following data structures or the objects they contain
@@ -177,6 +178,11 @@
HashSet<String> m_pageURLsInterestedInIcons;
HashSet<IconRecord*> m_iconsPendingReading;
+ Mutex m_urlsToRetainOrReleaseLock;
+ // Holding m_urlsToRetainOrReleaseLock is required when accessing any of the following data structures.
+ Vector<String> m_urlsToRetain;
+ Vector<String> m_urlsToRelease;
+
// *** Sync Thread Only ***
public:
// Should be used only on the sync thread and only by the Safari 2 Icons import procedure
@@ -202,6 +208,8 @@
void removeAllIconsOnThread();
void deleteAllPreparedStatements();
void* cleanupSyncThread();
+ void performRetainIconForPageURL(const String&);
+ void performReleaseIconForPageURL(const String&);
// Record (on disk) whether or not Safari 2-style icons were imported (once per dataabse)
bool imported();
@@ -220,7 +228,9 @@
PassRefPtr<SharedBuffer> getImageDataForIconURLFromSQLDatabase(const String& iconURL);
void removeIconFromSQLDatabase(const String& iconURL);
void writeIconSnapshotToSQLDatabase(const IconSnapshot&);
-
+
+ void performPendingRetainAndReleaseOperations();
+
// Methods to dispatch client callbacks on the main thread
void dispatchDidImportIconURLForPageURLOnMainThread(const String&);
void dispatchDidImportIconDataForPageURLOnMainThread(const String&);
Modified: trunk/Source/WebKit2/ChangeLog (116968 => 116969)
--- trunk/Source/WebKit2/ChangeLog 2012-05-14 18:02:37 UTC (rev 116968)
+++ trunk/Source/WebKit2/ChangeLog 2012-05-14 18:04:17 UTC (rev 116969)
@@ -1,3 +1,17 @@
+2012-05-14 Andreas Kling <[email protected]>
+
+ REGRESSION(r116796): Assertion failure in API tests
+ <http://webkit.org/b/86378>
+ <rdar://problem/10777218>
+
+ Reviewed by Anders Carlsson.
+
+ Invalidate the plugin work queue in ~WebContext to avoid hitting
+ the !m_isValid assertion in ~WorkQueue later on.
+
+ * UIProcess/WebContext.cpp:
+ (WebKit::WebContext::~WebContext):
+
2012-05-14 Csaba Osztrogonác <[email protected]>
[Qt][WK2] Unreviewed trivial buildfix after r116958.
Modified: trunk/Source/WebKit2/UIProcess/WebContext.cpp (116968 => 116969)
--- trunk/Source/WebKit2/UIProcess/WebContext.cpp 2012-05-14 18:02:37 UTC (rev 116968)
+++ trunk/Source/WebKit2/UIProcess/WebContext.cpp 2012-05-14 18:04:17 UTC (rev 116969)
@@ -166,6 +166,8 @@
WebContext::~WebContext()
{
+ m_pluginWorkQueue.invalidate();
+
if (m_process && m_process->isValid())
m_process->connection()->removeQueueClient(this);
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes