Title: [139985] trunk/Source
Revision
139985
Author
a...@apple.com
Date
2013-01-17 10:08:56 -0800 (Thu, 17 Jan 2013)

Log Message

        Don't use NSApplication run loop in NetworkProcess
        https://bugs.webkit.org/show_bug.cgi?id=107061

        Reviewed by Anders Carlsson.

        Only WebProcess and PluginProcess should use Cocoa APIs that require the run loop.

        * PluginProcess/mac/PluginProcessMac.mm:
        (WebKit::PluginProcess::platformInitializePluginProcess):
        * WebProcess/mac/WebProcessMac.mm:
        (WebKit::WebProcess::platformInitializeProcess):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (139984 => 139985)


--- trunk/Source/WebCore/ChangeLog	2013-01-17 17:27:34 UTC (rev 139984)
+++ trunk/Source/WebCore/ChangeLog	2013-01-17 18:08:56 UTC (rev 139985)
@@ -1,3 +1,22 @@
+2013-01-16  Alexey Proskuryakov  <a...@apple.com>
+
+        Don't use NSApplication run loop in NetworkProcess
+        https://bugs.webkit.org/show_bug.cgi?id=107061
+
+        Reviewed by Anders Carlsson.
+
+        Added a way to tell RunLoop whether it should use NSApplication run loop
+        (defaulting to not using it, as this should be an exception for child processes).
+
+        * WebCore.exp.in:
+        * platform/RunLoop.cpp:
+        (WebCore::RunLoop::setUseApplicationRunLoopOnMainRunLoop):
+        * platform/RunLoop.h:
+        * platform/mac/RunLoopMac.mm:
+        (WebCore::RunLoop::setUseApplicationRunLoopOnMainRunLoop):
+        (WebCore::RunLoop::run):
+        (WebCore::RunLoop::stop):
+
 2013-01-17  Andrey Lushnikov  <lushni...@chromium.org>
 
         Web Inspector: fix DefaultTextEditor's broken backspace

Modified: trunk/Source/WebCore/WebCore.exp.in (139984 => 139985)


--- trunk/Source/WebCore/WebCore.exp.in	2013-01-17 17:27:34 UTC (rev 139984)
+++ trunk/Source/WebCore/WebCore.exp.in	2013-01-17 18:08:56 UTC (rev 139985)
@@ -904,6 +904,7 @@
 __ZN7WebCore7RunLoop14runForDurationEd
 __ZN7WebCore7RunLoop21initializeMainRunLoopEv
 __ZN7WebCore7RunLoop3runEv
+__ZN7WebCore7RunLoop37setUseApplicationRunLoopOnMainRunLoopEv
 __ZN7WebCore7RunLoop4mainEv
 __ZN7WebCore7RunLoop4stopEv
 __ZN7WebCore7RunLoop6wakeUpEv

Modified: trunk/Source/WebCore/platform/RunLoop.cpp (139984 => 139985)


--- trunk/Source/WebCore/platform/RunLoop.cpp	2013-01-17 17:27:34 UTC (rev 139984)
+++ trunk/Source/WebCore/platform/RunLoop.cpp	2013-01-17 18:08:56 UTC (rev 139985)
@@ -53,6 +53,10 @@
     return s_mainRunLoop;
 }
 
+void RunLoop::setUseApplicationRunLoopOnMainRunLoop()
+{
+}
+
 #endif
 
 void RunLoop::performWork()

Modified: trunk/Source/WebCore/platform/RunLoop.h (139984 => 139985)


--- trunk/Source/WebCore/platform/RunLoop.h	2013-01-17 17:27:34 UTC (rev 139984)
+++ trunk/Source/WebCore/platform/RunLoop.h	2013-01-17 18:08:56 UTC (rev 139985)
@@ -51,6 +51,9 @@
     // can be called from any thread).
     static void initializeMainRunLoop();
 
+    // Must be called before entering main run loop. If called, application style run loop will be used, handling events.
+    static void setUseApplicationRunLoopOnMainRunLoop();
+
     static RunLoop* current();
     static RunLoop* main();
 

Modified: trunk/Source/WebCore/platform/mac/RunLoopMac.mm (139984 => 139985)


--- trunk/Source/WebCore/platform/mac/RunLoopMac.mm	2013-01-17 17:27:34 UTC (rev 139984)
+++ trunk/Source/WebCore/platform/mac/RunLoopMac.mm	2013-01-17 18:08:56 UTC (rev 139985)
@@ -28,10 +28,17 @@
 
 namespace WebCore {
 
+static bool s_useApplicationRunLoopOnMainRunLoop;
+
+void RunLoop::setUseApplicationRunLoopOnMainRunLoop()
+{
+    s_useApplicationRunLoopOnMainRunLoop = true;
+}
+
 void RunLoop::run()
 {
     current()->m_nestingLevel++;
-    if (current() == main() && current()->m_nestingLevel == 1) {
+    if (current() == main() && current()->m_nestingLevel == 1 && s_useApplicationRunLoopOnMainRunLoop) {
         // Use -[NSApplication run] for the main run loop.
         [NSApp run];
     } else {
@@ -46,7 +53,7 @@
 {
     ASSERT(m_runLoop == CFRunLoopGetCurrent());
     
-    if (m_runLoop == main()->m_runLoop && m_nestingLevel == 1) {
+    if (m_runLoop == main()->m_runLoop && m_nestingLevel == 1 && s_useApplicationRunLoopOnMainRunLoop) {
         [[NSApplication sharedApplication] stop:nil];
         NSEvent *event = [NSEvent otherEventWithType:NSApplicationDefined
                                             location:NSMakePoint(0, 0)

Modified: trunk/Source/WebKit2/ChangeLog (139984 => 139985)


--- trunk/Source/WebKit2/ChangeLog	2013-01-17 17:27:34 UTC (rev 139984)
+++ trunk/Source/WebKit2/ChangeLog	2013-01-17 18:08:56 UTC (rev 139985)
@@ -1,5 +1,19 @@
 2013-01-16  Alexey Proskuryakov  <a...@apple.com>
 
+        Don't use NSApplication run loop in NetworkProcess
+        https://bugs.webkit.org/show_bug.cgi?id=107061
+
+        Reviewed by Anders Carlsson.
+
+        Only WebProcess and PluginProcess should use Cocoa APIs that require the run loop.
+
+        * PluginProcess/mac/PluginProcessMac.mm:
+        (WebKit::PluginProcess::platformInitializePluginProcess):
+        * WebProcess/mac/WebProcessMac.mm:
+        (WebKit::WebProcess::platformInitializeProcess):
+
+2013-01-16  Alexey Proskuryakov  <a...@apple.com>
+
         Update sandbox rules after r128003
         https://bugs.webkit.org/show_bug.cgi?id=106840
 

Modified: trunk/Source/WebKit2/PluginProcess/mac/PluginProcessMac.mm (139984 => 139985)


--- trunk/Source/WebKit2/PluginProcess/mac/PluginProcessMac.mm	2013-01-17 17:27:34 UTC (rev 139984)
+++ trunk/Source/WebKit2/PluginProcess/mac/PluginProcessMac.mm	2013-01-17 18:08:56 UTC (rev 139985)
@@ -42,6 +42,8 @@
 
 #import "NetscapeSandboxFunctions.h"
 
+using namespace WebCore;
+
 namespace WebKit {
 
 class FullscreenWindowTracker {
@@ -338,6 +340,8 @@
 
 void PluginProcess::platformInitializePluginProcess(const PluginProcessCreationParameters& parameters)
 {
+    RunLoop::setUseApplicationRunLoopOnMainRunLoop();
+
     m_compositingRenderServerPort = parameters.acceleratedCompositingPort.port();
 
     NSString *applicationName = [NSString stringWithFormat:WEB_UI_STRING("%@ (%@ Internet plug-in)",

Modified: trunk/Source/WebKit2/WebProcess/mac/WebProcessMac.mm (139984 => 139985)


--- trunk/Source/WebKit2/WebProcess/mac/WebProcessMac.mm	2013-01-17 17:27:34 UTC (rev 139984)
+++ trunk/Source/WebKit2/WebProcess/mac/WebProcessMac.mm	2013-01-17 18:08:56 UTC (rev 139985)
@@ -305,6 +305,8 @@
 
 void WebProcess::platformInitializeProcess(const ChildProcessInitializationParameters&)
 {
+    RunLoop::setUseApplicationRunLoopOnMainRunLoop();
+
     WKAXRegisterRemoteApp();
 
 #if USE(SECURITY_FRAMEWORK)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to