Diff
Modified: trunk/Source/WebKit2/ChangeLog (170268 => 170269)
--- trunk/Source/WebKit2/ChangeLog 2014-06-22 18:09:36 UTC (rev 170268)
+++ trunk/Source/WebKit2/ChangeLog 2014-06-22 18:21:49 UTC (rev 170269)
@@ -1,3 +1,28 @@
+2014-06-22 Anders Carlsson <[email protected]>
+
+ Replace a couple of uses of bind with lambdas
+ https://bugs.webkit.org/show_bug.cgi?id=134172
+
+ Reviewed by Sam Weinig.
+
+ * Platform/IPC/Connection.cpp:
+ (IPC::Connection::postConnectionDidCloseOnConnectionWorkQueue):
+ (IPC::Connection::connectionDidClose):
+ (IPC::Connection::dispatchMessage):
+ (IPC::Connection::dispatchConnectionDidClose): Deleted.
+ * Platform/IPC/Connection.h:
+ * Shared/Plugins/NPObjectProxy.cpp:
+ (WebKit::NPObjectProxy::NP_Deallocate):
+ * UIProcess/Storage/LocalStorageDatabase.cpp:
+ (WebKit::LocalStorageDatabase::scheduleDatabaseUpdate):
+ * WebProcess/Plugins/Netscape/NetscapePlugin.cpp:
+ (WebKit::NetscapePlugin::pluginThreadAsyncCall):
+ (WebKit::NetscapePlugin::handlePluginThreadAsyncCall): Deleted.
+ * WebProcess/Plugins/Netscape/NetscapePlugin.h:
+ * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
+ (WebKit::TiledCoreAnimationDrawingArea::forceRepaintAsync):
+ (WebKit::TiledCoreAnimationDrawingArea::dispatchAfterEnsuringUpdatedScrollPosition):
+
2014-06-20 Simon Fraser <[email protected]>
Have scrollingTreeAsText() dump the non-fast-scrollable region
Modified: trunk/Source/WebKit2/Platform/IPC/Connection.cpp (170268 => 170269)
--- trunk/Source/WebKit2/Platform/IPC/Connection.cpp 2014-06-22 18:09:36 UTC (rev 170268)
+++ trunk/Source/WebKit2/Platform/IPC/Connection.cpp 2014-06-22 18:21:49 UTC (rev 170269)
@@ -677,7 +677,10 @@
void Connection::postConnectionDidCloseOnConnectionWorkQueue()
{
- m_connectionQueue->dispatch(WTF::bind(&Connection::connectionDidClose, this));
+ RefPtr<Connection> connection(this);
+ m_connectionQueue->dispatch([connection] {
+ connection->connectionDidClose();
+ });
}
void Connection::connectionDidClose()
@@ -708,23 +711,21 @@
if (m_didCloseOnConnectionWorkQueueCallback)
m_didCloseOnConnectionWorkQueueCallback(this);
- m_clientRunLoop.dispatch(WTF::bind(&Connection::dispatchConnectionDidClose, this));
-}
+ RefPtr<Connection> connection(this);
+ m_clientRunLoop.dispatch([connection] {
+ // If the connection has been explicitly invalidated before dispatchConnectionDidClose was called,
+ // then the client will be null here.
+ if (!connection->m_client)
+ return;
-void Connection::dispatchConnectionDidClose()
-{
- // If the connection has been explicitly invalidated before dispatchConnectionDidClose was called,
- // then the client will be null here.
- if (!m_client)
- return;
+ // Because we define a connection as being "valid" based on wheter it has a null client, we null out
+ // the client before calling didClose here. Otherwise, sendSync will try to send a message to the connection and
+ // will then wait indefinitely for a reply.
+ Client* client = connection->m_client;
+ connection->m_client = nullptr;
- // Because we define a connection as being "valid" based on wheter it has a null client, we null out
- // the client before calling didClose here. Otherwise, sendSync will try to send a message to the connection and
- // will then wait indefinitely for a reply.
- Client* client = m_client;
- m_client = 0;
-
- client->didClose(this);
+ client->didClose(connection.get());
+ });
}
bool Connection::canSendOutgoingMessages() const
@@ -810,8 +811,6 @@
void Connection::dispatchMessage(std::unique_ptr<MessageDecoder> message)
{
- // If there's no client, return. We do this after calling releaseArguments so that
- // the ArgumentDecoder message will be freed.
if (!m_client)
return;
Modified: trunk/Source/WebKit2/Platform/IPC/Connection.h (170268 => 170269)
--- trunk/Source/WebKit2/Platform/IPC/Connection.h 2014-06-22 18:09:36 UTC (rev 170268)
+++ trunk/Source/WebKit2/Platform/IPC/Connection.h 2014-06-22 18:21:49 UTC (rev 170269)
@@ -217,7 +217,6 @@
void connectionDidClose();
// Called on the listener thread.
- void dispatchConnectionDidClose();
void dispatchOneMessage();
void dispatchMessage(std::unique_ptr<MessageDecoder>);
void dispatchMessage(MessageDecoder&);
Modified: trunk/Source/WebKit2/Shared/Plugins/NPObjectProxy.cpp (170268 => 170269)
--- trunk/Source/WebKit2/Shared/Plugins/NPObjectProxy.cpp 2014-06-22 18:09:36 UTC (rev 170268)
+++ trunk/Source/WebKit2/Shared/Plugins/NPObjectProxy.cpp 2014-06-22 18:21:49 UTC (rev 170269)
@@ -303,7 +303,9 @@
// that is known to be misused during plugin teardown, and to not be concerned about change in behavior if this
// occured at any other time.
if (!isMainThread()) {
- RunLoop::main().dispatch(bind(&NPObjectProxy::NP_Deallocate, npObject));
+ RunLoop::main().dispatch([npObject] {
+ NP_Deallocate(npObject);
+ });
return;
}
Modified: trunk/Source/WebKit2/UIProcess/Storage/LocalStorageDatabase.cpp (170268 => 170269)
--- trunk/Source/WebKit2/UIProcess/Storage/LocalStorageDatabase.cpp 2014-06-22 18:09:36 UTC (rev 170268)
+++ trunk/Source/WebKit2/UIProcess/Storage/LocalStorageDatabase.cpp 2014-06-22 18:21:49 UTC (rev 170269)
@@ -241,7 +241,11 @@
return;
m_didScheduleDatabaseUpdate = true;
- m_queue->dispatchAfter(databaseUpdateInterval, bind(&LocalStorageDatabase::updateDatabase, this));
+
+ RefPtr<LocalStorageDatabase> localStorageDatabase(this);
+ m_queue->dispatchAfter(databaseUpdateInterval, [localStorageDatabase] {
+ localStorageDatabase->updateDatabase();
+ });
}
void LocalStorageDatabase::updateDatabase()
Modified: trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp (170268 => 170269)
--- trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp 2014-06-22 18:09:36 UTC (rev 170268)
+++ trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp 2014-06-22 18:21:49 UTC (rev 170269)
@@ -304,15 +304,13 @@
void NetscapePlugin::pluginThreadAsyncCall(void (*function)(void*), void* userData)
{
- RunLoop::main().dispatch(WTF::bind(&NetscapePlugin::handlePluginThreadAsyncCall, this, function, userData));
-}
-
-void NetscapePlugin::handlePluginThreadAsyncCall(void (*function)(void*), void* userData)
-{
- if (!m_isStarted)
- return;
+ RefPtr<NetscapePlugin> plugin(this);
+ RunLoop::main().dispatch([plugin, function, userData] {
+ if (!plugin->m_isStarted)
+ return;
- function(userData);
+ function(userData);
+ });
}
NetscapePlugin::Timer::Timer(NetscapePlugin* netscapePlugin, unsigned timerID, unsigned interval, bool repeat, TimerFunc timerFunc)
Modified: trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h (170268 => 170269)
--- trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h 2014-06-22 18:09:36 UTC (rev 170268)
+++ trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h 2014-06-22 18:21:49 UTC (rev 170269)
@@ -120,9 +120,6 @@
void pluginThreadAsyncCall(void (*function)(void*), void* userData);
- // Called on the plug-in run loop (which is currently the main thread run loop).
- void handlePluginThreadAsyncCall(void (*function)(void*), void* userData);
-
unsigned scheduleTimer(unsigned interval, bool repeat, void (*timerFunc)(NPP, unsigned timerID));
void unscheduleTimer(unsigned timerID);
Modified: trunk/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm (170268 => 170269)
--- trunk/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm 2014-06-22 18:09:36 UTC (rev 170268)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm 2014-06-22 18:21:49 UTC (rev 170269)
@@ -144,10 +144,10 @@
if (m_layerTreeStateIsFrozen)
return false;
- dispatchAfterEnsuringUpdatedScrollPosition(bind(^{
+ dispatchAfterEnsuringUpdatedScrollPosition([this, callbackID] {
m_webPage->drawingArea()->forceRepaint();
m_webPage->send(Messages::WebPageProxy::VoidCallback(callbackID));
- }));
+ });
return true;
}
@@ -242,7 +242,7 @@
// (The web page is already kept alive by dispatchAfterEnsuringUpdatedScrollPosition).
WebPage* webPage = m_webPage;
- ScrollingThread::dispatchBarrier(bind(^{
+ ScrollingThread::dispatchBarrier([this, webPage, function] {
DrawingArea* drawingArea = webPage->drawingArea();
if (!drawingArea)
return;
@@ -253,7 +253,7 @@
m_layerFlushScheduler.resume();
webPage->deref();
- }));
+ });
#else
function();
#endif