Changeset 252712 in webkit
- Timestamp:
- Nov 20, 2019, 3:01:40 PM (7 years ago)
- Location:
- trunk/Source/WebKit
- Files:
-
- 3 edited
-
ChangeLog (modified) (1 diff)
-
WebProcess/WebProcess.h (modified) (2 diffs)
-
WebProcess/cocoa/WebProcessCocoa.mm (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r252702 r252712 1 2019-11-20 Chris Dumez <cdumez@apple.com> 2 3 [iOS] Make sure WebContent process does not get suspended while it is holding a process assertion for the UIProcess 4 https://bugs.webkit.org/show_bug.cgi?id=204418 5 6 Reviewed by Jer Noble. 7 8 Make sure WebContent process does not get suspended while it is holding a process assertion for the UIProcess. We 9 see this happening in sysdiagnoses, and it means the system ends up killing the WebContent process because it leaked 10 a process assertion. 11 12 * WebProcess/WebProcess.h: 13 * WebProcess/cocoa/WebProcessCocoa.mm: 14 (WebKit::WebProcess::processTaskStateDidChange): 15 (WebKit::WebProcess::releaseProcessWasResumedAssertions): 16 1 17 2019-11-19 Brian Burg <bburg@apple.com> 2 18 -
trunk/Source/WebKit/WebProcess/WebProcess.h
r252636 r252712 465 465 bool shouldFreezeOnSuspension() const; 466 466 void updateFreezerStatus(); 467 468 void releaseProcessWasResumedAssertions(); 467 469 #endif 468 470 … … 543 545 WebSQLiteDatabaseTracker m_webSQLiteDatabaseTracker; 544 546 RefPtr<ProcessTaskStateObserver> m_taskStateObserver; 545 Lock m_processWasResumed UIAssertionLock;547 Lock m_processWasResumedAssertionsLock; 546 548 RetainPtr<BKSProcessAssertion> m_processWasResumedUIAssertion; 549 RetainPtr<BKSProcessAssertion> m_processWasResumedOwnAssertion; 547 550 #endif 548 551 -
trunk/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm
r252636 r252712 301 301 return; 302 302 303 LockHolder holder(m_processWasResumed UIAssertionLock);304 if (m_processWasResumedUIAssertion )303 LockHolder holder(m_processWasResumedAssertionsLock); 304 if (m_processWasResumedUIAssertion && m_processWasResumedOwnAssertion) 305 305 return; 306 306 … … 308 308 // to ensure that it too is awakened. 309 309 RELEASE_LOG(ProcessSuspension, "%p - WebProcess::processTaskStateChanged() Taking 'WebProcess was resumed' assertion on behalf on UIProcess", this); 310 m_processWasResumedUIAssertion = adoptNS([[BKSProcessAssertion alloc] initWithPID:parentProcessConnection()->remoteProcessID() flags:BKSProcessAssertionPreventTaskSuspend reason:BKSProcessAssertionReasonFinishTask name:@"WebProcess was resumed" withHandler:nil]); 311 310 m_processWasResumedUIAssertion = adoptNS([[BKSProcessAssertion alloc] initWithPID:parentProcessConnection()->remoteProcessID() flags:BKSProcessAssertionPreventTaskSuspend reason:BKSProcessAssertionReasonFinishTask name:@"WebProcess was resumed" withHandler:^(BOOL acquired) { 311 if (!acquired) 312 RELEASE_LOG_ERROR(ProcessSuspension, "%p - WebProcess::processTaskStateDidChange() failed to take 'WebProcess was resumed' assertion for parent process", this); 313 }]); 312 314 m_processWasResumedUIAssertion.get().invalidationHandler = [this] { 313 LockHolder holder(m_processWasResumedUIAssertionLock); 314 RELEASE_LOG(ProcessSuspension, "%p - WebProcess::processTaskStateChanged() Releasing 'WebProcess was resumed' assertion on behalf on UIProcess due invalidation", this); 315 RELEASE_LOG_ERROR(ProcessSuspension, "%p - WebProcess::processTaskStateChanged() Releasing 'WebProcess was resumed' assertion on behalf on UIProcess due to invalidation", this); 316 releaseProcessWasResumedAssertions(); 317 }; 318 m_processWasResumedOwnAssertion = adoptNS([[BKSProcessAssertion alloc] initWithPID:getpid() flags:BKSProcessAssertionPreventTaskSuspend reason:BKSProcessAssertionReasonFinishTask name:@"WebProcess was resumed" withHandler:^(BOOL acquired) { 319 if (!acquired) 320 RELEASE_LOG_ERROR(ProcessSuspension, "%p - WebProcess::processTaskStateDidChange() failed to take 'WebProcess was resumed' assertion for WebContent process", this); 321 }]); 322 m_processWasResumedOwnAssertion.get().invalidationHandler = [this] { 323 RELEASE_LOG_ERROR(ProcessSuspension, "%p - WebProcess::processTaskStateChanged() Releasing 'WebProcess was resumed' assertion on behalf on WebContent process due to invalidation", this); 324 releaseProcessWasResumedAssertions(); 325 }; 326 327 parentProcessConnection()->sendWithAsyncReply(Messages::WebProcessProxy::ProcessWasResumed(), [this] { 328 RELEASE_LOG(ProcessSuspension, "%p - WebProcess::processTaskStateDidChange() Parent process handled ProcessWasResumed IPC, releasing our assertions", this); 329 releaseProcessWasResumedAssertions(); 330 }); 331 } 332 333 void WebProcess::releaseProcessWasResumedAssertions() 334 { 335 LockHolder holder(m_processWasResumedAssertionsLock); 336 if (m_processWasResumedUIAssertion) { 337 RELEASE_LOG(ProcessSuspension, "%p - WebProcess::releaseProcessWasResumedAssertions() Releasing parent process 'WebProcess was resumed' assertion", this); 315 338 [m_processWasResumedUIAssertion invalidate]; 316 339 m_processWasResumedUIAssertion = nullptr; 317 }; 318 319 // This will cause the parent process to send a ParentProcessDidHandleProcessWasResumed IPC back, so that we can release our assertion on its behalf. 320 parentProcessConnection()->sendWithAsyncReply(Messages::WebProcessProxy::ProcessWasResumed(), [this] { 321 LockHolder holder(m_processWasResumedUIAssertionLock); 322 ASSERT(m_processWasResumedUIAssertion); 323 RELEASE_LOG(ProcessSuspension, "%p - WebProcess::parentProcessDidHandleProcessWasResumed() Releasing 'WebProcess was resumed' assertion on behalf on UIProcess", this); 324 [m_processWasResumedUIAssertion invalidate]; 325 m_processWasResumedUIAssertion = nullptr; 326 }); 340 } 341 if (m_processWasResumedOwnAssertion) { 342 RELEASE_LOG(ProcessSuspension, "%p - WebProcess::releaseProcessWasResumedAssertions() Releasing WebContent process 'WebProcess was resumed' assertion", this); 343 [m_processWasResumedOwnAssertion invalidate]; 344 m_processWasResumedOwnAssertion = nullptr; 345 } 327 346 } 328 347
Note:
See TracChangeset
for help on using the changeset viewer.