Title: [178825] trunk/Source/WebKit2
Revision
178825
Author
[email protected]
Date
2015-01-21 09:00:42 -0800 (Wed, 21 Jan 2015)

Log Message

[WK2] Use C++ lambdas in ProcessLauncher class
https://bugs.webkit.org/show_bug.cgi?id=138186

Reviewed by Darin Adler.

Replace uses of WTF::bind() in the ProcessLauncher class with C++ lambdas.

* UIProcess/Launcher/efl/ProcessLauncherEfl.cpp:
(WebKit::ProcessLauncher::launchProcess):
* UIProcess/Launcher/gtk/ProcessLauncherGtk.cpp:
(WebKit::ProcessLauncher::launchProcess):
* UIProcess/Launcher/mac/ProcessLauncherMac.mm:
(WebKit::connectToService):
(WebKit::tryPreexistingProcess):
(WebKit::createProcess):

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (178824 => 178825)


--- trunk/Source/WebKit2/ChangeLog	2015-01-21 16:55:40 UTC (rev 178824)
+++ trunk/Source/WebKit2/ChangeLog	2015-01-21 17:00:42 UTC (rev 178825)
@@ -1,5 +1,23 @@
 2015-01-21  Zan Dobersek  <[email protected]>
 
+        [WK2] Use C++ lambdas in ProcessLauncher class
+        https://bugs.webkit.org/show_bug.cgi?id=138186
+
+        Reviewed by Darin Adler.
+
+        Replace uses of WTF::bind() in the ProcessLauncher class with C++ lambdas.
+
+        * UIProcess/Launcher/efl/ProcessLauncherEfl.cpp:
+        (WebKit::ProcessLauncher::launchProcess):
+        * UIProcess/Launcher/gtk/ProcessLauncherGtk.cpp:
+        (WebKit::ProcessLauncher::launchProcess):
+        * UIProcess/Launcher/mac/ProcessLauncherMac.mm:
+        (WebKit::connectToService):
+        (WebKit::tryPreexistingProcess):
+        (WebKit::createProcess):
+
+2015-01-21  Zan Dobersek  <[email protected]>
+
         Clean up ViewUpdateDispatcher
         https://bugs.webkit.org/show_bug.cgi?id=140619
 

Modified: trunk/Source/WebKit2/UIProcess/Launcher/efl/ProcessLauncherEfl.cpp (178824 => 178825)


--- trunk/Source/WebKit2/UIProcess/Launcher/efl/ProcessLauncherEfl.cpp	2015-01-21 16:55:40 UTC (rev 178824)
+++ trunk/Source/WebKit2/UIProcess/Launcher/efl/ProcessLauncherEfl.cpp	2015-01-21 17:00:42 UTC (rev 178825)
@@ -111,7 +111,11 @@
         close(sockets[0]);
         m_processIdentifier = pid;
         // We've finished launching the process, message back to the main run loop.
-        RunLoop::main().dispatch(bind(&ProcessLauncher::didFinishLaunchingProcess, this, pid, sockets[1]));
+        RefPtr<ProcessLauncher> protector(this);
+        IPC::Connection::Identifier serverSocket = sockets[1];
+        RunLoop::main().dispatch([protector, pid, serverSocket] {
+            protector->didFinishLaunchingProcess(pid, serverSocket);
+        });
     } else {
         ASSERT_NOT_REACHED();
         return;

Modified: trunk/Source/WebKit2/UIProcess/Launcher/gtk/ProcessLauncherGtk.cpp (178824 => 178825)


--- trunk/Source/WebKit2/UIProcess/Launcher/gtk/ProcessLauncherGtk.cpp	2015-01-21 16:55:40 UTC (rev 178824)
+++ trunk/Source/WebKit2/UIProcess/Launcher/gtk/ProcessLauncherGtk.cpp	2015-01-21 17:00:42 UTC (rev 178825)
@@ -126,7 +126,11 @@
     m_processIdentifier = pid;
 
     // We've finished launching the process, message back to the main run loop.
-    RunLoop::main().dispatch(bind(&ProcessLauncher::didFinishLaunchingProcess, this, m_processIdentifier, socketPair.server));
+    RefPtr<ProcessLauncher> protector(this);
+    IPC::Connection::Identifier serverSocket = socketPair.server;
+    RunLoop::main().dispatch([protector, pid, serverSocket] {
+        protector->didFinishLaunchingProcess(pid, serverSocket);
+    });
 }
 
 void ProcessLauncher::terminateProcess()

Modified: trunk/Source/WebKit2/UIProcess/Launcher/mac/ProcessLauncherMac.mm (178824 => 178825)


--- trunk/Source/WebKit2/UIProcess/Launcher/mac/ProcessLauncherMac.mm	2015-01-21 16:55:40 UTC (rev 178824)
+++ trunk/Source/WebKit2/UIProcess/Launcher/mac/ProcessLauncherMac.mm	2015-01-21 17:00:42 UTC (rev 178825)
@@ -276,7 +276,10 @@
             // And the receive right.
             mach_port_mod_refs(mach_task_self(), listeningPort, MACH_PORT_RIGHT_RECEIVE, -1);
 
-            RunLoop::main().dispatch(bind(didFinishLaunchingProcessFunction, that, 0, IPC::Connection::Identifier()));
+            RefPtr<ProcessLauncher> protector(that);
+            RunLoop::main().dispatch([protector, didFinishLaunchingProcessFunction] {
+                (*protector.*didFinishLaunchingProcessFunction)(0, IPC::Connection::Identifier());
+            });
         } else {
             ASSERT(type == XPC_TYPE_DICTIONARY);
             ASSERT(!strcmp(xpc_dictionary_get_string(reply, "message-name"), "process-finished-launching"));
@@ -285,7 +288,10 @@
             pid_t processIdentifier = xpc_connection_get_pid(connection.get());
 
             // We've finished launching the process, message back to the main run loop. This takes ownership of the connection.
-            RunLoop::main().dispatch(bind(didFinishLaunchingProcessFunction, that, processIdentifier, IPC::Connection::Identifier(listeningPort, connection)));
+            RefPtr<ProcessLauncher> protector(that);
+            RunLoop::main().dispatch([protector, didFinishLaunchingProcessFunction, processIdentifier, listeningPort, connection] {
+                (*protector.*didFinishLaunchingProcessFunction)(processIdentifier, IPC::Connection::Identifier(listeningPort, connection));
+            });
         }
 
         that->deref();
@@ -411,7 +417,10 @@
     }
     
     // We've finished launching the process, message back to the main run loop.
-    RunLoop::main().dispatch(bind(didFinishLaunchingProcessFunction, that, processIdentifier, IPC::Connection::Identifier(listeningPort)));
+    RefPtr<ProcessLauncher> protector(that);
+    RunLoop::main().dispatch([protector, didFinishLaunchingProcessFunction, processIdentifier, listeningPort] {
+        (*protector.*didFinishLaunchingProcessFunction)(processIdentifier, IPC::Connection::Identifier(listeningPort));
+    });
     return true;
 }
 
@@ -554,7 +563,10 @@
     }
 
     // We've finished launching the process, message back to the main run loop.
-    RunLoop::main().dispatch(bind(didFinishLaunchingProcessFunction, that, processIdentifier, IPC::Connection::Identifier(listeningPort)));
+    RefPtr<ProcessLauncher> protector(that);
+    RunLoop::main().dispatch([protector, didFinishLaunchingProcessFunction, processIdentifier, listeningPort] {
+        (*protector.*didFinishLaunchingProcessFunction)(processIdentifier, IPC::Connection::Identifier(listeningPort));
+    });
 }
 
 static NSString *systemDirectoryPath()
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to