Modified: trunk/Source/WebKit2/ChangeLog (176035 => 176036)
--- trunk/Source/WebKit2/ChangeLog 2014-11-12 21:13:13 UTC (rev 176035)
+++ trunk/Source/WebKit2/ChangeLog 2014-11-12 21:48:51 UTC (rev 176036)
@@ -1,3 +1,17 @@
+2014-11-12 Commit Queue <[email protected]>
+
+ Unreviewed, rolling out r175806.
+ https://bugs.webkit.org/show_bug.cgi?id=138666
+
+ Capturing CString is not thread safe (Requested by anttik on
+ #webkit).
+
+ Reverted changeset:
+
+ "[WK2] Use C++ lambdas in IPC::Connection"
+ https://bugs.webkit.org/show_bug.cgi?id=138018
+ http://trac.webkit.org/changeset/175806
+
2014-11-12 Tim Horton <[email protected]>
Make action menus much more reliable
Modified: trunk/Source/WebKit2/Platform/IPC/Connection.cpp (176035 => 176036)
--- trunk/Source/WebKit2/Platform/IPC/Connection.cpp 2014-11-12 21:13:13 UTC (rev 176035)
+++ trunk/Source/WebKit2/Platform/IPC/Connection.cpp 2014-11-12 21:48:51 UTC (rev 176036)
@@ -164,13 +164,8 @@
{
MutexLocker locker(m_mutex);
- if (m_didScheduleDispatchMessagesWorkSet.add(connection).isNewEntry) {
- RefPtr<SyncMessageState> protectedThis(this);
- RefPtr<Connection> protectedConnection(connection);
- m_runLoop.dispatch([protectedThis, protectedConnection] {
- protectedThis->dispatchMessageAndResetDidScheduleDispatchMessagesForConnection(protectedConnection.get());
- });
- }
+ if (m_didScheduleDispatchMessagesWorkSet.add(connection).isNewEntry)
+ m_runLoop.dispatch(bind(&SyncMessageState::dispatchMessageAndResetDidScheduleDispatchMessagesForConnection, this, RefPtr<Connection>(connection)));
m_messagesToDispatchWhileWaitingForSyncReply.append(WTF::move(connectionAndIncomingMessage));
}
@@ -301,8 +296,10 @@
});
}
-void Connection::dispatchWorkQueueMessageReceiverMessage(WorkQueueMessageReceiver* workQueueMessageReceiver, MessageDecoder* decoder)
+void Connection::dispatchWorkQueueMessageReceiverMessage(WorkQueueMessageReceiver* workQueueMessageReceiver, MessageDecoder* incomingMessageDecoder)
{
+ std::unique_ptr<MessageDecoder> decoder(incomingMessageDecoder);
+
if (!decoder->isSyncMessage()) {
workQueueMessageReceiver->didReceiveMessage(this, *decoder);
return;
@@ -343,12 +340,9 @@
}
// Reset the client.
- m_client = nullptr;
+ m_client = 0;
- RefPtr<Connection> protectedThis(this);
- m_connectionQueue->dispatch([protectedThis] {
- protectedThis->platformInvalidate();
- });
+ m_connectionQueue->dispatch(WTF::bind(&Connection::platformInvalidate, this));
}
void Connection::markCurrentlyDispatchedMessageAsInvalid()
@@ -387,10 +381,7 @@
}
// FIXME: We should add a boolean flag so we don't call this when work has already been scheduled.
- RefPtr<Connection> protectedThis(this);
- m_connectionQueue->dispatch([protectedThis] {
- protectedThis->sendOutgoingMessages();
- });
+ m_connectionQueue->dispatch(WTF::bind(&Connection::sendOutgoingMessages, this));
return true;
}
@@ -638,27 +629,23 @@
}
if (!m_workQueueMessageReceivers.isValidKey(message->messageReceiverName())) {
- // Something might have gone wrong when decoding the message. In that case, encode the message length
- // so we can figure out if this happens for certain message lengths.
- CString messageReceiverName = message->messageReceiverName().isEmpty() ? "<unknown message>" : message->messageReceiverName().toString();
- CString messageName = message->messageName().isEmpty() ? String::format("<message length: %zu bytes>", message->length()).utf8() : message->messageReceiverName().toString();
+ if (message->messageReceiverName().isEmpty() && message->messageName().isEmpty()) {
+ // Something went wrong when decoding the message. Encode the message length so we can figure out if this
+ // happens for certain message lengths.
+ CString messageReceiverName = "<unknown message>";
+ CString messageName = String::format("<message length: %zu bytes>", message->length()).utf8();
- RefPtr<Connection> protectedThis(this);
- m_clientRunLoop.dispatch([protectedThis, messageReceiverName, messageName] {
- protectedThis->dispatchDidReceiveInvalidMessage(messageReceiverName, messageName);
- });
+ m_clientRunLoop.dispatch(bind(&Connection::dispatchDidReceiveInvalidMessage, this, messageReceiverName, messageName));
+ return;
+ }
+
+ m_clientRunLoop.dispatch(bind(&Connection::dispatchDidReceiveInvalidMessage, this, message->messageReceiverName().toString(), message->messageName().toString()));
return;
}
auto it = m_workQueueMessageReceivers.find(message->messageReceiverName());
if (it != m_workQueueMessageReceivers.end()) {
- RefPtr<Connection> protectedThis(this);
- RefPtr<WorkQueueMessageReceiver>& workQueueMessageReceiver = it->value.second;
- MessageDecoder* decoderPtr = message.release();
- it->value.first->dispatch([protectedThis, workQueueMessageReceiver, decoderPtr] {
- std::unique_ptr<MessageDecoder> decoder(decoderPtr);
- protectedThis->dispatchWorkQueueMessageReceiverMessage(workQueueMessageReceiver.get(), decoder.get());
- });
+ it->value.first->dispatch(bind(&Connection::dispatchWorkQueueMessageReceiverMessage, this, it->value.second, message.release()));
return;
}
@@ -814,10 +801,7 @@
m_incomingMessages.append(WTF::move(incomingMessage));
}
- RefPtr<Connection> protectedThis(this);
- m_clientRunLoop.dispatch([protectedThis] {
- protectedThis->dispatchOneMessage();
- });
+ m_clientRunLoop.dispatch(WTF::bind(&Connection::dispatchOneMessage, this));
}
void Connection::dispatchMessage(MessageDecoder& decoder)
Modified: trunk/Source/WebKit2/Platform/IPC/mac/ConnectionMac.mm (176035 => 176036)
--- trunk/Source/WebKit2/Platform/IPC/mac/ConnectionMac.mm 2014-11-12 21:13:13 UTC (rev 176035)
+++ trunk/Source/WebKit2/Platform/IPC/mac/ConnectionMac.mm 2014-11-12 21:48:51 UTC (rev 176036)
@@ -361,12 +361,8 @@
void Connection::initializeDeadNameSource()
{
m_deadNameSource = dispatch_source_create(DISPATCH_SOURCE_TYPE_MACH_SEND, m_sendPort, 0, m_connectionQueue->dispatchQueue());
+ dispatch_source_set_event_handler(m_deadNameSource, bind(&Connection::connectionDidClose, this));
- RefPtr<Connection> protectedThis(this);
- dispatch_source_set_event_handler(m_deadNameSource, ^{
- protectedThis->connectionDidClose();
- });
-
mach_port_t sendPort = m_sendPort;
dispatch_source_set_cancel_handler(m_deadNameSource, ^{
// Release our send right.
@@ -508,12 +504,7 @@
if (decoder->messageReceiverName() == "IPC" && decoder->messageName() == "SetExceptionPort") {
if (m_isServer) {
// Server connections aren't supposed to have their exception ports overriden. Treat this as an invalid message.
- RefPtr<Connection> protectedThis(this);
- CString messageReceiverNameString = decoder->messageReceiverName().toString();
- CString messageNameString = decoder->messageName().toString();
- m_clientRunLoop.dispatch([protectedThis, messageReceiverNameString, messageNameString] {
- protectedThis->dispatchDidReceiveInvalidMessage(messageReceiverNameString, messageNameString);
- });
+ m_clientRunLoop.dispatch(bind(&Connection::dispatchDidReceiveInvalidMessage, this, decoder->messageReceiverName().toString(), decoder->messageName().toString()));
return;
}
MachPort exceptionPort;
Modified: trunk/Source/WebKit2/Platform/IPC/unix/ConnectionUnix.cpp (176035 => 176036)
--- trunk/Source/WebKit2/Platform/IPC/unix/ConnectionUnix.cpp 2014-11-12 21:13:13 UTC (rev 176035)
+++ trunk/Source/WebKit2/Platform/IPC/unix/ConnectionUnix.cpp 2014-11-12 21:48:51 UTC (rev 176036)
@@ -388,27 +388,27 @@
}
}
- RefPtr<Connection> protectedThis(this);
m_isConnected = true;
#if PLATFORM(GTK)
+ RefPtr<Connection> protector(this);
m_connectionQueue->registerSocketEventHandler(m_socketDescriptor,
- [protectedThis] {
- protectedThis->readyReadHandler();
+ [=] {
+ protector->readyReadHandler();
},
- [protectedThis] {
- protectedThis->connectionDidClose();
+ [=] {
+ protector->connectionDidClose();
});
#elif PLATFORM(EFL)
+ RefPtr<Connection> protector(this);
m_connectionQueue->registerSocketEventHandler(m_socketDescriptor,
- [protectedThis] {
- protectedThis->readyReadHandler();
+ [protector] {
+ protector->readyReadHandler();
});
#endif
- // Schedule a call to readyReadHandler. Data may have arrived before installation of the signal handler.
- m_connectionQueue->dispatch([protectedThis] {
- protectedThis->readyReadHandler();
- });
+ // Schedule a call to readyReadHandler. Data may have arrived before installation of the signal
+ // handler.
+ m_connectionQueue->dispatch(WTF::bind(&Connection::readyReadHandler, this));
return true;
}