Changeset 236988 in webkit
- Timestamp:
- Oct 9, 2018, 4:25:46 PM (8 years ago)
- Location:
- trunk/Source/WebKit
- Files:
-
- 8 edited
-
ChangeLog (modified) (1 diff)
-
NetworkProcess/NetworkProcess.cpp (modified) (2 diffs)
-
NetworkProcess/NetworkProcess.h (modified) (1 diff)
-
PluginProcess/PluginProcess.cpp (modified) (2 diffs)
-
PluginProcess/PluginProcess.h (modified) (1 diff)
-
Shared/ChildProcess.cpp (modified) (2 diffs)
-
Shared/ChildProcess.h (modified) (1 diff)
-
WebProcess/WebProcess.cpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r236984 r236988 1 2018-10-09 Chris Dumez <cdumez@apple.com> 2 3 Allow behavior when the parent process IPC::Connection closes to be overridden by ChildProcess subclasses 4 https://bugs.webkit.org/show_bug.cgi?id=190294 5 6 Reviewed by Geoffrey Garen. 7 8 Allow behavior when the parent process IPC::Connection closes to be overridden by ChildProcess subclasses. 9 This will be useful to allow the NetworkProcess to not exit if it still has pending downloads. 10 11 * NetworkProcess/NetworkProcess.cpp: 12 (WebKit::callExitSoon): 13 (WebKit::NetworkProcess::initializeConnection): 14 * NetworkProcess/NetworkProcess.h: 15 * PluginProcess/PluginProcess.cpp: 16 (WebKit::callExit): 17 (WebKit::PluginProcess::initializeConnection): 18 * PluginProcess/PluginProcess.h: 19 * Shared/ChildProcess.cpp: 20 (WebKit::ChildProcess::didClose): 21 (WebKit::ChildProcess::initialize): 22 (WebKit::callExitNow): Deleted. 23 (WebKit::callExitSoon): Deleted. 24 * Shared/ChildProcess.h: 25 (WebKit::ChildProcess::shouldCallExitWhenConnectionIsClosed const): Deleted. 26 * WebProcess/WebProcess.cpp: 27 (WebKit::callExit): 28 (WebKit::WebProcess::initializeConnection): 29 1 30 2018-10-09 Jer Noble <jer.noble@apple.com> 2 31 -
trunk/Source/WebKit/NetworkProcess/NetworkProcess.cpp
r236772 r236988 109 109 using namespace WebCore; 110 110 111 static void callExitSoon(IPC::Connection*) 112 { 113 // If the connection has been closed and we haven't responded in the main thread for 10 seconds 114 // the process will exit forcibly. 115 auto watchdogDelay = 10_s; 116 117 WorkQueue::create("com.apple.WebKit.ChildProcess.WatchDogQueue")->dispatchAfter(watchdogDelay, [] { 118 // We use _exit here since the watchdog callback is called from another thread and we don't want 119 // global destructors or atexit handlers to be called from this thread while the main thread is busy 120 // doing its thing. 121 RELEASE_LOG_ERROR(IPC, "Exiting process early due to unacknowledged closed-connection"); 122 _exit(EXIT_FAILURE); 123 }); 124 } 125 111 126 NetworkProcess& NetworkProcess::singleton() 112 127 { … … 359 374 { 360 375 ChildProcess::initializeConnection(connection); 376 377 // We give a chance for didClose() to get called on the main thread but forcefully call _exit() after a delay 378 // in case the main thread is unresponsive or didClose() takes too long. 379 connection->setDidCloseOnConnectionWorkQueueCallback(callExitSoon); 361 380 362 381 for (auto& supplement : m_supplements.values()) -
trunk/Source/WebKit/NetworkProcess/NetworkProcess.h
r236485 r236988 247 247 void initializeConnection(IPC::Connection*) override; 248 248 bool shouldTerminate() override; 249 bool shouldCallExitWhenConnectionIsClosed() const final { return false; } // We override didClose() and want it to be called.250 249 251 250 // IPC::Connection::Client -
trunk/Source/WebKit/PluginProcess/PluginProcess.cpp
r232176 r236988 53 53 namespace WebKit { 54 54 55 NO_RETURN static void callExit(IPC::Connection*) 56 { 57 _exit(EXIT_SUCCESS); 58 } 59 55 60 PluginProcess& PluginProcess::singleton() 56 61 { … … 77 82 m_pluginPath = parameters.extraInitializationData.get("plugin-path"); 78 83 platformInitializeProcess(parameters); 84 } 85 86 void PluginProcess::initializeConnection(IPC::Connection* connection) 87 { 88 ChildProcess::initializeConnection(connection); 89 90 // We call _exit() directly from the background queue in case the main thread is unresponsive 91 // and ChildProcess::didClose() does not get called. 92 connection->setDidCloseOnConnectionWorkQueueCallback(callExit); 79 93 } 80 94 -
trunk/Source/WebKit/PluginProcess/PluginProcess.h
r234910 r236988 83 83 void initializeProcess(const ChildProcessInitializationParameters&) override; 84 84 void initializeProcessName(const ChildProcessInitializationParameters&) override; 85 void initializeConnection(IPC::Connection*) override; 85 86 void initializeSandbox(const ChildProcessInitializationParameters&, SandboxInitializationParameters&) override; 86 87 bool shouldTerminate() override; -
trunk/Source/WebKit/Shared/ChildProcess.cpp
r234486 r236988 57 57 void ChildProcess::didClose(IPC::Connection&) 58 58 { 59 }60 61 NO_RETURN static void callExitNow(IPC::Connection*)62 {63 59 _exit(EXIT_SUCCESS); 64 }65 66 static void callExitSoon(IPC::Connection*)67 {68 // If the connection has been closed and we haven't responded in the main thread for 10 seconds69 // the process will exit forcibly.70 auto watchdogDelay = 10_s;71 72 WorkQueue::create("com.apple.WebKit.ChildProcess.WatchDogQueue")->dispatchAfter(watchdogDelay, [] {73 // We use _exit here since the watchdog callback is called from another thread and we don't want74 // global destructors or atexit handlers to be called from this thread while the main thread is busy75 // doing its thing.76 RELEASE_LOG_ERROR(IPC, "Exiting process early due to unacknowledged closed-connection");77 _exit(EXIT_FAILURE);78 });79 60 } 80 61 … … 100 81 101 82 m_connection = IPC::Connection::createClientConnection(parameters.connectionIdentifier, *this); 102 if (shouldCallExitWhenConnectionIsClosed())103 m_connection->setDidCloseOnConnectionWorkQueueCallback(callExitNow);104 else105 m_connection->setDidCloseOnConnectionWorkQueueCallback(callExitSoon);106 107 83 initializeConnection(m_connection.get()); 108 84 m_connection->open(); -
trunk/Source/WebKit/Shared/ChildProcess.h
r235220 r236988 96 96 virtual void terminate(); 97 97 98 virtual bool shouldCallExitWhenConnectionIsClosed() const { return true; }99 98 virtual void stopRunLoop(); 100 99 -
trunk/Source/WebKit/WebProcess/WebProcess.cpp
r236959 r236988 158 158 using namespace WebCore; 159 159 160 NO_RETURN static void callExit(IPC::Connection*) 161 { 162 _exit(EXIT_SUCCESS); 163 } 164 160 165 WebProcess& WebProcess::singleton() 161 166 { … … 227 232 { 228 233 ChildProcess::initializeConnection(connection); 234 235 // We call _exit() directly from the background queue in case the main thread is unresponsive 236 // and ChildProcess::didClose() does not get called. 237 connection->setDidCloseOnConnectionWorkQueueCallback(callExit); 229 238 230 239 #if !PLATFORM(GTK) && !PLATFORM(WPE)
Note:
See TracChangeset
for help on using the changeset viewer.