- Revision
- 149965
- Author
- [email protected]
- Date
- 2013-05-12 10:50:58 -0700 (Sun, 12 May 2013)
Log Message
Simplify AutodrainedPool
https://bugs.webkit.org/show_bug.cgi?id=115986
Reviewed by Andreas Kling.
Source/WebCore:
Remove calls to AutodrainedPool::cycle as well as the iteration counter passed to the constructor.
Instead, just declare RAII pools where it seems necessary.
* Modules/webdatabase/DatabaseThread.cpp:
(WebCore::DatabaseThread::databaseThread):
* fileapi/FileThread.cpp:
(WebCore::FileThread::runLoop):
* loader/icon/IconDatabase.cpp:
(WebCore::IconDatabase::setIconDataForIconURL):
(WebCore::IconDatabase::performURLImport):
(WebCore::IconDatabase::readFromDatabase):
Source/WTF:
Remove the ability to cycle an AutodrainedPool, as well as the iteration count.
Creating and draining pools is fast enough now that we don't need to try to be clever about it.
* wtf/AutodrainedPool.h:
(AutodrainedPool):
(WTF::AutodrainedPool::AutodrainedPool):
* wtf/AutodrainedPoolMac.mm:
(WTF::AutodrainedPool::AutodrainedPool):
Modified Paths
Diff
Modified: trunk/Source/WTF/ChangeLog (149964 => 149965)
--- trunk/Source/WTF/ChangeLog 2013-05-12 17:47:29 UTC (rev 149964)
+++ trunk/Source/WTF/ChangeLog 2013-05-12 17:50:58 UTC (rev 149965)
@@ -1,5 +1,21 @@
2013-05-12 Anders Carlsson <[email protected]>
+ Simplify AutodrainedPool
+ https://bugs.webkit.org/show_bug.cgi?id=115986
+
+ Reviewed by Andreas Kling.
+
+ Remove the ability to cycle an AutodrainedPool, as well as the iteration count.
+ Creating and draining pools is fast enough now that we don't need to try to be clever about it.
+
+ * wtf/AutodrainedPool.h:
+ (AutodrainedPool):
+ (WTF::AutodrainedPool::AutodrainedPool):
+ * wtf/AutodrainedPoolMac.mm:
+ (WTF::AutodrainedPool::AutodrainedPool):
+
+2013-05-12 Anders Carlsson <[email protected]>
+
Move RemoteMemoryReader into FastMalloc.cpp
https://bugs.webkit.org/show_bug.cgi?id=115985
Modified: trunk/Source/WTF/wtf/AutodrainedPool.h (149964 => 149965)
--- trunk/Source/WTF/wtf/AutodrainedPool.h 2013-05-12 17:47:29 UTC (rev 149964)
+++ trunk/Source/WTF/wtf/AutodrainedPool.h 2013-05-12 17:50:58 UTC (rev 149965)
@@ -39,20 +39,15 @@
WTF_MAKE_NONCOPYABLE(AutodrainedPool);
public:
#if PLATFORM(MAC)
- WTF_EXPORT_PRIVATE explicit AutodrainedPool(int iterationLimit = 1);
+ WTF_EXPORT_PRIVATE AutodrainedPool();
WTF_EXPORT_PRIVATE ~AutodrainedPool();
-
- WTF_EXPORT_PRIVATE void cycle();
#else
- explicit AutodrainedPool(int = 1) { }
+ explicit AutodrainedPool() { }
~AutodrainedPool() { }
- void cycle() { }
#endif
private:
#if PLATFORM(MAC)
- int m_iterationLimit;
- int m_iterationCount;
NSAutoreleasePool* m_pool;
#endif
};
Modified: trunk/Source/WTF/wtf/AutodrainedPoolMac.mm (149964 => 149965)
--- trunk/Source/WTF/wtf/AutodrainedPoolMac.mm 2013-05-12 17:47:29 UTC (rev 149964)
+++ trunk/Source/WTF/wtf/AutodrainedPoolMac.mm 2013-05-12 17:50:58 UTC (rev 149965)
@@ -33,10 +33,8 @@
namespace WTF {
-AutodrainedPool::AutodrainedPool(int iterationLimit)
- : m_iterationLimit(iterationLimit)
- , m_iterationCount(0)
- , m_pool([[NSAutoreleasePool alloc] init])
+AutodrainedPool::AutodrainedPool()
+ : m_pool([[NSAutoreleasePool alloc] init])
{
}
@@ -45,13 +43,4 @@
[m_pool drain];
}
-void AutodrainedPool::cycle()
-{
- if (++m_iterationCount == m_iterationLimit) {
- [m_pool drain];
- m_pool = [[NSAutoreleasePool alloc] init];
- m_iterationCount = 0;
- }
-}
-
} // namespace WTF
Modified: trunk/Source/WebCore/ChangeLog (149964 => 149965)
--- trunk/Source/WebCore/ChangeLog 2013-05-12 17:47:29 UTC (rev 149964)
+++ trunk/Source/WebCore/ChangeLog 2013-05-12 17:50:58 UTC (rev 149965)
@@ -1,3 +1,22 @@
+2013-05-12 Anders Carlsson <[email protected]>
+
+ Simplify AutodrainedPool
+ https://bugs.webkit.org/show_bug.cgi?id=115986
+
+ Reviewed by Andreas Kling.
+
+ Remove calls to AutodrainedPool::cycle as well as the iteration counter passed to the constructor.
+ Instead, just declare RAII pools where it seems necessary.
+
+ * Modules/webdatabase/DatabaseThread.cpp:
+ (WebCore::DatabaseThread::databaseThread):
+ * fileapi/FileThread.cpp:
+ (WebCore::FileThread::runLoop):
+ * loader/icon/IconDatabase.cpp:
+ (WebCore::IconDatabase::setIconDataForIconURL):
+ (WebCore::IconDatabase::performURLImport):
+ (WebCore::IconDatabase::readFromDatabase):
+
2013-05-12 Andreas Kling <[email protected]>
Apply FINAL to the Node hierarchy.
Modified: trunk/Source/WebCore/Modules/webdatabase/DatabaseThread.cpp (149964 => 149965)
--- trunk/Source/WebCore/Modules/webdatabase/DatabaseThread.cpp 2013-05-12 17:47:29 UTC (rev 149964)
+++ trunk/Source/WebCore/Modules/webdatabase/DatabaseThread.cpp 2013-05-12 17:50:58 UTC (rev 149965)
@@ -107,10 +107,10 @@
LOG(StorageAPI, "Started DatabaseThread %p", this);
}
- AutodrainedPool pool;
while (OwnPtr<DatabaseTask> task = m_queue.waitForMessage()) {
+ AutodrainedPool pool;
+
task->performTask();
- pool.cycle();
}
// Clean up the list of all pending transactions on this database thread
Modified: trunk/Source/WebCore/fileapi/FileThread.cpp (149964 => 149965)
--- trunk/Source/WebCore/fileapi/FileThread.cpp 2013-05-12 17:47:29 UTC (rev 149964)
+++ trunk/Source/WebCore/fileapi/FileThread.cpp 2013-05-12 17:50:58 UTC (rev 149965)
@@ -98,10 +98,10 @@
LOG(FileAPI, "Started FileThread %p", this);
}
- AutodrainedPool pool;
while (OwnPtr<Task> task = m_queue.waitForMessage()) {
+ AutodrainedPool pool;
+
task->performTask();
- pool.cycle();
}
LOG(FileAPI, "About to detach thread %i and clear the ref to FileThread %p, which currently has %i ref(s)", m_threadID, this, refCount());
Modified: trunk/Source/WebCore/loader/icon/IconDatabase.cpp (149964 => 149965)
--- trunk/Source/WebCore/loader/icon/IconDatabase.cpp 2013-05-12 17:47:29 UTC (rev 149964)
+++ trunk/Source/WebCore/loader/icon/IconDatabase.cpp 2013-05-12 17:50:58 UTC (rev 149965)
@@ -586,15 +586,11 @@
// Start the timer to commit this change - or further delay the timer if it was already started
scheduleOrDeferSyncTimer();
- // Informal testing shows that draining the autorelease pool every 25 iterations is about as low as we can go
- // before performance starts to drop off, but we don't want to increase this number because then accumulated memory usage will go up
- AutodrainedPool pool(25);
-
for (unsigned i = 0; i < pageURLs.size(); ++i) {
+ AutodrainedPool pool;
+
LOG(IconDatabase, "Dispatching notification that retaining pageURL %s has a new icon", urlForLogging(pageURLs[i]).ascii().data());
m_client->didChangeIconForPageURL(pageURLs[i]);
-
- pool.cycle();
}
}
}
@@ -1231,18 +1227,15 @@
return;
}
- // Informal testing shows that draining the autorelease pool every 25 iterations is about as low as we can go
- // before performance starts to drop off, but we don't want to increase this number because then accumulated memory usage will go up
- AutodrainedPool pool(25);
-
int result = query.step();
while (result == SQLResultRow) {
+ AutodrainedPool pool;
String pageURL = query.getColumnText(0);
String iconURL = query.getColumnText(1);
{
MutexLocker locker(m_urlAndIconLock);
-
+
PageURLRecord* pageRecord = m_pageURLToRecordMap.get(pageURL);
// If the pageRecord doesn't exist in this map, then no one has retained this pageURL
@@ -1278,8 +1271,6 @@
if (m_pageURLsPendingImport.contains(pageURL)) {
dispatchDidImportIconURLForPageURLOnMainThread(pageURL);
m_pageURLsPendingImport.remove(pageURL);
-
- pool.cycle();
}
}
@@ -1350,12 +1341,12 @@
LOG(IconDatabase, "Notifying %lu interested page URLs that their icon URL is known due to the import", static_cast<unsigned long>(urlsToNotify.size()));
// Now that we don't hold any locks, perform the actual notifications
for (unsigned i = 0; i < urlsToNotify.size(); ++i) {
+ AutodrainedPool pool;
+
LOG(IconDatabase, "Notifying icon info known for pageURL %s", urlsToNotify[i].ascii().data());
dispatchDidImportIconURLForPageURLOnMainThread(urlsToNotify[i]);
if (shouldStopThreadActivity())
return;
-
- pool.cycle();
}
// Notify the client that the URL import is complete in case it's managing its own pending notifications.
@@ -1599,20 +1590,14 @@
if (shouldStopThreadActivity())
return didAnyWork;
- // Informal testing shows that draining the autorelease pool every 25 iterations is about as low as we can go
- // before performance starts to drop off, but we don't want to increase this number because then accumulated memory usage will go up
- AutodrainedPool pool(25);
-
// Now that we don't hold any locks, perform the actual notifications
- HashSet<String>::iterator iter = urlsToNotify.begin();
- HashSet<String>::iterator end = urlsToNotify.end();
- for (unsigned iteration = 0; iter != end; ++iter, ++iteration) {
- LOG(IconDatabase, "Notifying icon received for pageURL %s", urlForLogging(*iter).ascii().data());
- dispatchDidImportIconDataForPageURLOnMainThread(*iter);
+ for (HashSet<String>::const_iterator it = urlsToNotify.begin(), end = urlsToNotify.end(); it != end; ++it) {
+ AutodrainedPool pool;
+
+ LOG(IconDatabase, "Notifying icon received for pageURL %s", urlForLogging(*it).ascii().data());
+ dispatchDidImportIconDataForPageURLOnMainThread(*it);
if (shouldStopThreadActivity())
return didAnyWork;
-
- pool.cycle();
}
LOG(IconDatabase, "Done notifying %i pageURLs who just received their icons", urlsToNotify.size());