Changeset 247868 in webkit
- Timestamp:
- Jul 26, 2019, 11:27:28 AM (7 years ago)
- Location:
- trunk
- Files:
-
- 17 edited
- 2 moved
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/fast/misc/{testProcessIncomingSyncMessagesWhenWaitingForUnboundedReply-expected.txt (moved) (moved from trunk/LayoutTests/fast/misc/testProcessIncomingSyncMessagesWhenWaitingForSyncReply-expected.txt ) (1 diff)
-
LayoutTests/fast/misc/{testProcessIncomingSyncMessagesWhenWaitingForUnboundedReply.html (moved) (moved from trunk/LayoutTests/fast/misc/testProcessIncomingSyncMessagesWhenWaitingForSyncReply.html ) (1 diff)
-
Source/WebKit/ChangeLog (modified) (1 diff)
-
Source/WebKit/Platform/IPC/Connection.cpp (modified) (10 diffs)
-
Source/WebKit/Platform/IPC/Connection.h (modified) (3 diffs)
-
Source/WebKit/Platform/IPC/Decoder.cpp (modified) (1 diff)
-
Source/WebKit/Platform/IPC/Decoder.h (modified) (2 diffs)
-
Source/WebKit/Platform/IPC/Encoder.cpp (modified) (3 diffs)
-
Source/WebKit/Platform/IPC/Encoder.h (modified) (2 diffs)
-
Source/WebKit/Platform/IPC/MessageFlags.h (modified) (1 diff)
-
Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp (modified) (1 diff)
-
Source/WebKit/UIProcess/WebPageProxy.cpp (modified) (1 diff)
-
Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm (modified) (1 diff)
-
Source/WebKit/WebProcess/Network/WebLoaderStrategy.cpp (modified) (1 diff)
-
Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp (modified) (4 diffs)
-
Source/WebKit/WebProcess/WebPage/WebPage.cpp (modified) (10 diffs)
-
Source/WebKit/WebProcess/WebPage/WebPage.h (modified) (1 diff)
-
Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r247866 r247868 1 2019-07-26 Chris Dumez <cdumez@apple.com> 2 3 [iOS] WebPage::TouchEventSync() & WebPage::GetPositionInformation() sync IPC causes UIProcess hangs 4 https://bugs.webkit.org/show_bug.cgi?id=200138 5 <rdar://problem/52698157> 6 7 Reviewed by Geoffrey Garen. 8 9 Update existing layout test accordingly. 10 11 * fast/misc/{testProcessIncomingSyncMessagesWhenWaitingForUnboundedReply-expected.txt: Renamed from LayoutTests/fast/misc/testProcessIncomingSyncMessagesWhenWaitingForSyncReply-expected.txt. 12 * fast/misc/{testProcessIncomingSyncMessagesWhenWaitingForUnboundedReply.html: Renamed from LayoutTests/fast/misc/testProcessIncomingSyncMessagesWhenWaitingForSyncReply.html. 13 1 14 2019-07-26 Zalan Bujtas <zalan@apple.com> 2 15 -
trunk/LayoutTests/fast/misc/{testProcessIncomingSyncMessagesWhenWaitingForUnboundedReply-expected.txt
r247867 r247868 1 Test for the SendSyncOption:: ProcessIncomingSyncMessagesWhenWaitingForSyncReply sendSync flag1 Test for the SendSyncOption::ForceDispatchWhenDestinationIsWaitingForUnboundedSyncReply sendSync flag 2 2 3 3 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". -
trunk/LayoutTests/fast/misc/{testProcessIncomingSyncMessagesWhenWaitingForUnboundedReply.html
r247867 r247868 4 4 <script src="../../resources/js-test.js"></script> 5 5 <script> 6 description("Test for the SendSyncOption:: ProcessIncomingSyncMessagesWhenWaitingForSyncReply sendSync flag");6 description("Test for the SendSyncOption::ForceDispatchWhenDestinationIsWaitingForUnboundedSyncReply sendSync flag"); 7 7 8 8 shouldBeTrue("internals.testProcessIncomingSyncMessagesWhenWaitingForSyncReply()"); -
trunk/Source/WebKit/ChangeLog
r247866 r247868 1 2019-07-26 Chris Dumez <cdumez@apple.com> 2 3 [iOS] WebPage::TouchEventSync() & WebPage::GetPositionInformation() sync IPC causes UIProcess hangs 4 https://bugs.webkit.org/show_bug.cgi?id=200138 5 <rdar://problem/52698157> 6 7 Reviewed by Geoffrey Garen. 8 9 Revert most of r247822 and use an alternative approach to address hangs. In this patch, the proposal 10 is to add a SendSyncOption::ForceDispatchWhenDestinationIsWaitingForUnboundedSyncReply flag on the 11 WebPage::TouchEventSync() & WebPage::GetPositionInformation() sendSync() calls in the UIProcess. 12 Those will cause this IPCs to get dispatched right away in the WebContent process, even if the 13 WebContent process is itself currently stuck on unbounded (i.e. potentially slow) synchronous IPC 14 (JS alerts / prompts & sync XHR). Because re-entering WebCore on sync IPC is generally unsafe, this 15 patch also updates the WebPage::getPositionInformation() & WebPage::touchEventSync() to return early 16 (i.e. cancelled) if they get called while the WebContent process is stuck on a slow sendSync. 17 18 This approach should address the UIProcess hangs caused by the WebPage::TouchEventSync() and 19 WebPage::GetPositionInformation() sync IPC messages when the WebContent process is busy on a slow XHR 20 or a JS prompt / alert. It should be safe because we do not re-enter WebCore. The only drawback is that 21 those IPCs will be cancelled (early return with default value) when the WebContent process is busy. 22 However, I am being told that this is likely acceptable in practice. 23 24 * Platform/IPC/Connection.cpp: 25 (IPC::Connection::SyncMessageState::processIncomingMessage): 26 (IPC::Connection::sendMessage): 27 (IPC::Connection::sendSyncMessage): 28 (IPC::Connection::dispatchMessage): 29 * Platform/IPC/Connection.h: 30 (IPC::UnboundedSynchronousIPCScope::UnboundedSynchronousIPCScope): 31 (IPC::UnboundedSynchronousIPCScope::~UnboundedSynchronousIPCScope): 32 (IPC::UnboundedSynchronousIPCScope::hasOngoingUnboundedSyncIPC): 33 * Platform/IPC/Decoder.cpp: 34 (IPC::Decoder::shouldDispatchMessageWhenWaitingForSyncReply const): 35 * Platform/IPC/Decoder.h: 36 * Platform/IPC/Encoder.cpp: 37 (IPC::Encoder::shouldDispatchMessageWhenWaitingForSyncReply const): 38 (IPC::Encoder::setShouldDispatchMessageWhenWaitingForSyncReply): 39 (IPC::Encoder::wrapForTesting): 40 * Platform/IPC/Encoder.h: 41 * Platform/IPC/MessageFlags.h: 42 * UIProcess/Network/NetworkProcessProxy.cpp: 43 (WebKit::NetworkProcessProxy::testProcessIncomingSyncMessagesWhenWaitingForSyncReply): 44 * UIProcess/WebPageProxy.cpp: 45 (WebKit::WebPageProxy::handleTouchEventSynchronously): 46 * UIProcess/ios/WKContentViewInteraction.mm: 47 (-[WKContentView ensurePositionInformationIsUpToDate:]): 48 * WebProcess/Network/WebLoaderStrategy.cpp: 49 (WebKit::WebLoaderStrategy::loadResourceSynchronously): 50 * WebProcess/WebCoreSupport/WebChromeClient.cpp: 51 (WebKit::WebChromeClient::testProcessIncomingSyncMessagesWhenWaitingForSyncReply): 52 (WebKit::WebChromeClient::runJavaScriptAlert): 53 (WebKit::WebChromeClient::runJavaScriptConfirm): 54 (WebKit::WebChromeClient::runJavaScriptPrompt): 55 * WebProcess/WebPage/WebPage.cpp: 56 (WebKit::WebPage::layerVolatilityTimerFired): 57 (WebKit::WebPage::markLayersVolatile): 58 (WebKit::WebPage::cancelMarkLayersVolatile): 59 (WebKit::WebPage::touchEventSync): 60 (WebKit::WebPage::didCompletePageTransition): 61 (WebKit::WebPage::updatePreferences): 62 (WebKit::WebPage::testProcessIncomingSyncMessagesWhenWaitingForSyncReply): 63 * WebProcess/WebPage/WebPage.h: 64 (WebKit::WebPage::sendSyncWithDelayedReply): 65 * WebProcess/WebPage/ios/WebPageIOS.mm: 66 (WebKit::WebPage::getPositionInformation): 67 1 68 2019-07-26 Zalan Bujtas <zalan@apple.com> 2 69 -
trunk/Source/WebKit/Platform/IPC/Connection.cpp
r247822 r247868 28 28 29 29 #include "Logging.h" 30 #include "MessageFlags.h" 30 31 #include <memory> 31 32 #include <wtf/HashSet.h> … … 50 51 #endif 51 52 53 std::atomic<unsigned> UnboundedSynchronousIPCScope::unboundedSynchronousIPCCount = 0; 54 52 55 struct Connection::ReplyHandler { 53 56 RefPtr<FunctionDispatcher> dispatcher; … … 99 102 void dispatchMessages(Connection* allowedConnection); 100 103 101 void incrementProcessIncomingSyncMessagesWhenWaitingForSyncReplyCount() { ++m_processIncomingSyncMessagesWhenWaitingForSyncReplyCount; }102 void decrementProcessIncomingSyncMessagesWhenWaitingForSyncReplyCount() { --m_processIncomingSyncMessagesWhenWaitingForSyncReplyCount; }103 104 104 private: 105 105 void dispatchMessageAndResetDidScheduleDispatchMessagesForConnection(Connection&); … … 118 118 }; 119 119 Vector<ConnectionAndIncomingMessage> m_messagesToDispatchWhileWaitingForSyncReply; 120 121 std::atomic<unsigned> m_processIncomingSyncMessagesWhenWaitingForSyncReplyCount { 0 };122 120 }; 123 121 … … 140 138 bool Connection::SyncMessageState::processIncomingMessage(Connection& connection, std::unique_ptr<Decoder>& message) 141 139 { 142 bool shouldDispatchMessageWhenWaitingForSyncReply = message->shouldDispatchMessageWhenWaitingForSyncReply(); 143 144 // We dispatch synchronous messages even if shouldDispatchMessageWhenWaitingForSyncReply returns false if the 145 // sendSync() used SendSyncOption::ProcessIncomingSyncMessagesWhenWaitingForSyncReply. This is used for some messages 146 // in the WebContent process (which normally does not dispatch messages when waiting for a sync reply), to avoid 147 // hangs. 148 if (!shouldDispatchMessageWhenWaitingForSyncReply && message->isSyncMessage() && m_processIncomingSyncMessagesWhenWaitingForSyncReplyCount.load()) 149 shouldDispatchMessageWhenWaitingForSyncReply = true; 150 151 if (!shouldDispatchMessageWhenWaitingForSyncReply) 140 switch (message->shouldDispatchMessageWhenWaitingForSyncReply()) { 141 case ShouldDispatchWhenWaitingForSyncReply::No: 152 142 return false; 143 case ShouldDispatchWhenWaitingForSyncReply::YesDuringUnboundedIPC: 144 if (!UnboundedSynchronousIPCScope::hasOngoingUnboundedSyncIPC()) 145 return false; 146 break; 147 case ShouldDispatchWhenWaitingForSyncReply::Yes: 148 break; 149 } 153 150 154 151 ConnectionAndIncomingMessage connectionAndIncomingMessage { connection, WTFMove(message) }; … … 434 431 && (!m_onlySendMessagesAsDispatchWhenWaitingForSyncReplyWhenProcessingSuchAMessage 435 432 || m_inDispatchMessageMarkedDispatchWhenWaitingForSyncReplyCount)) 436 encoder->setShouldDispatchMessageWhenWaitingForSyncReply(true); 433 encoder->setShouldDispatchMessageWhenWaitingForSyncReply(ShouldDispatchWhenWaitingForSyncReply::Yes); 434 else if (sendOptions.contains(SendOption::DispatchMessageEvenWhenWaitingForUnboundedSyncReply)) 435 encoder->setShouldDispatchMessageWhenWaitingForSyncReply(ShouldDispatchWhenWaitingForSyncReply::YesDuringUnboundedIPC); 437 436 438 437 { … … 578 577 579 578 // First send the message. 580 sendMessage(WTFMove(encoder), IPC::SendOption::DispatchMessageEvenWhenWaitingForSyncReply); 581 582 if (sendSyncOptions.contains(SendSyncOption::ProcessIncomingSyncMessagesWhenWaitingForSyncReply)) 583 SyncMessageState::singleton().incrementProcessIncomingSyncMessagesWhenWaitingForSyncReplyCount(); 579 OptionSet<SendOption> sendOptions = IPC::SendOption::DispatchMessageEvenWhenWaitingForSyncReply; 580 if (sendSyncOptions.contains(SendSyncOption::ForceDispatchWhenDestinationIsWaitingForUnboundedSyncReply)) 581 sendOptions = sendOptions | IPC::SendOption::DispatchMessageEvenWhenWaitingForUnboundedSyncReply; 582 583 sendMessage(WTFMove(encoder), sendOptions); 584 584 585 585 // Then wait for a reply. Waiting for a reply could involve dispatching incoming sync messages, so … … 587 587 Ref<Connection> protect(*this); 588 588 std::unique_ptr<Decoder> reply = waitForSyncReply(syncRequestID, timeout, sendSyncOptions); 589 590 if (sendSyncOptions.contains(SendSyncOption::ProcessIncomingSyncMessagesWhenWaitingForSyncReply))591 SyncMessageState::singleton().decrementProcessIncomingSyncMessagesWhenWaitingForSyncReplyCount();592 589 593 590 --m_inSendSyncCount; … … 1041 1038 1042 1039 m_inDispatchMessageCount++; 1043 1044 if (message->shouldDispatchMessageWhenWaitingForSyncReply()) 1040 1041 bool isDispatchingMessageWhileWaitingForSyncReply = (message->shouldDispatchMessageWhenWaitingForSyncReply() == ShouldDispatchWhenWaitingForSyncReply::Yes) 1042 || (message->shouldDispatchMessageWhenWaitingForSyncReply() == ShouldDispatchWhenWaitingForSyncReply::YesDuringUnboundedIPC && UnboundedSynchronousIPCScope::hasOngoingUnboundedSyncIPC()); 1043 1044 if (isDispatchingMessageWhileWaitingForSyncReply) 1045 1045 m_inDispatchMessageMarkedDispatchWhenWaitingForSyncReplyCount++; 1046 1046 … … 1058 1058 // FIXME: For synchronous messages, we should not decrement the counter until we send a response. 1059 1059 // Otherwise, we would deadlock if processing the message results in a sync message back after we exit this function. 1060 if ( message->shouldDispatchMessageWhenWaitingForSyncReply())1060 if (isDispatchingMessageWhileWaitingForSyncReply) 1061 1061 m_inDispatchMessageMarkedDispatchWhenWaitingForSyncReplyCount--; 1062 1062 -
trunk/Source/WebKit/Platform/IPC/Connection.h
r247822 r247868 62 62 // This is the default for synchronous messages. 63 63 DispatchMessageEvenWhenWaitingForSyncReply = 1 << 0, 64 IgnoreFullySynchronousMode = 1 << 1, 64 DispatchMessageEvenWhenWaitingForUnboundedSyncReply = 1 << 1, 65 IgnoreFullySynchronousMode = 1 << 2, 65 66 }; 66 67 … … 69 70 InformPlatformProcessWillSuspend = 1 << 0, 70 71 UseFullySynchronousModeForTesting = 1 << 1, 71 ProcessIncomingSyncMessagesWhenWaitingForSyncReply = 1 << 2,72 ForceDispatchWhenDestinationIsWaitingForUnboundedSyncReply = 1 << 2, 72 73 }; 73 74 … … 555 556 } 556 557 558 class UnboundedSynchronousIPCScope { 559 public: 560 UnboundedSynchronousIPCScope() 561 { 562 ASSERT(RunLoop::isMain()); 563 ++unboundedSynchronousIPCCount; 564 } 565 566 ~UnboundedSynchronousIPCScope() 567 { 568 ASSERT(RunLoop::isMain()); 569 ASSERT(unboundedSynchronousIPCCount); 570 --unboundedSynchronousIPCCount; 571 } 572 573 static bool hasOngoingUnboundedSyncIPC() 574 { 575 return unboundedSynchronousIPCCount.load() > 0; 576 } 577 578 private: 579 static std::atomic<unsigned> unboundedSynchronousIPCCount; 580 }; 581 557 582 } // namespace IPC -
trunk/Source/WebKit/Platform/IPC/Decoder.cpp
r239427 r247868 89 89 } 90 90 91 bool Decoder::shouldDispatchMessageWhenWaitingForSyncReply() const 92 { 93 return m_messageFlags & DispatchMessageWhenWaitingForSyncReply; 91 ShouldDispatchWhenWaitingForSyncReply Decoder::shouldDispatchMessageWhenWaitingForSyncReply() const 92 { 93 if (m_messageFlags & DispatchMessageWhenWaitingForSyncReply) 94 return ShouldDispatchWhenWaitingForSyncReply::Yes; 95 if (m_messageFlags & DispatchMessageWhenWaitingForUnboundedSyncReply) 96 return ShouldDispatchWhenWaitingForSyncReply::YesDuringUnboundedIPC; 97 return ShouldDispatchWhenWaitingForSyncReply::No; 94 98 } 95 99 -
trunk/Source/WebKit/Platform/IPC/Decoder.h
r243460 r247868 40 40 class DataReference; 41 41 class ImportanceAssertion; 42 enum class ShouldDispatchWhenWaitingForSyncReply; 42 43 43 44 class Decoder { … … 55 56 56 57 bool isSyncMessage() const; 57 boolshouldDispatchMessageWhenWaitingForSyncReply() const;58 ShouldDispatchWhenWaitingForSyncReply shouldDispatchMessageWhenWaitingForSyncReply() const; 58 59 bool shouldUseFullySynchronousModeForTesting() const; 59 60 -
trunk/Source/WebKit/Platform/IPC/Encoder.cpp
r238798 r247868 86 86 } 87 87 88 bool Encoder::shouldDispatchMessageWhenWaitingForSyncReply() const 89 { 90 return *buffer() & DispatchMessageWhenWaitingForSyncReply; 88 ShouldDispatchWhenWaitingForSyncReply Encoder::shouldDispatchMessageWhenWaitingForSyncReply() const 89 { 90 if (*buffer() & DispatchMessageWhenWaitingForSyncReply) 91 return ShouldDispatchWhenWaitingForSyncReply::Yes; 92 if (*buffer() & DispatchMessageWhenWaitingForUnboundedSyncReply) 93 return ShouldDispatchWhenWaitingForSyncReply::YesDuringUnboundedIPC; 94 return ShouldDispatchWhenWaitingForSyncReply::No; 91 95 } 92 96 … … 99 103 } 100 104 101 void Encoder::setShouldDispatchMessageWhenWaitingForSyncReply(bool shouldDispatchMessageWhenWaitingForSyncReply) 102 { 103 if (shouldDispatchMessageWhenWaitingForSyncReply) 105 void Encoder::setShouldDispatchMessageWhenWaitingForSyncReply(ShouldDispatchWhenWaitingForSyncReply shouldDispatchWhenWaitingForSyncReply) 106 { 107 switch (shouldDispatchWhenWaitingForSyncReply) { 108 case ShouldDispatchWhenWaitingForSyncReply::No: 109 *buffer() &= ~(DispatchMessageWhenWaitingForSyncReply | DispatchMessageWhenWaitingForUnboundedSyncReply); 110 break; 111 case ShouldDispatchWhenWaitingForSyncReply::Yes: 104 112 *buffer() |= DispatchMessageWhenWaitingForSyncReply; 105 else 113 *buffer() &= ~DispatchMessageWhenWaitingForUnboundedSyncReply; 114 break; 115 case ShouldDispatchWhenWaitingForSyncReply::YesDuringUnboundedIPC: 116 *buffer() |= DispatchMessageWhenWaitingForUnboundedSyncReply; 106 117 *buffer() &= ~DispatchMessageWhenWaitingForSyncReply; 118 break; 119 } 107 120 } 108 121 … … 117 130 ASSERT(!original->isSyncMessage()); 118 131 119 original->setShouldDispatchMessageWhenWaitingForSyncReply( true);132 original->setShouldDispatchMessageWhenWaitingForSyncReply(ShouldDispatchWhenWaitingForSyncReply::Yes); 120 133 121 134 encodeVariableLengthByteArray(DataReference(original->buffer(), original->bufferSize())); -
trunk/Source/WebKit/Platform/IPC/Encoder.h
r237294 r247868 35 35 36 36 class DataReference; 37 enum class ShouldDispatchWhenWaitingForSyncReply; 37 38 38 39 class Encoder final { … … 49 50 bool isSyncMessage() const; 50 51 51 void setShouldDispatchMessageWhenWaitingForSyncReply( bool);52 boolshouldDispatchMessageWhenWaitingForSyncReply() const;52 void setShouldDispatchMessageWhenWaitingForSyncReply(ShouldDispatchWhenWaitingForSyncReply); 53 ShouldDispatchWhenWaitingForSyncReply shouldDispatchMessageWhenWaitingForSyncReply() const; 53 54 54 55 void setFullySynchronousModeForTesting(); -
trunk/Source/WebKit/Platform/IPC/MessageFlags.h
r188793 r247868 32 32 SyncMessage = 1 << 0, 33 33 DispatchMessageWhenWaitingForSyncReply = 1 << 1, 34 UseFullySynchronousModeForTesting = 1 << 2, 34 DispatchMessageWhenWaitingForUnboundedSyncReply = 1 << 2, 35 UseFullySynchronousModeForTesting = 1 << 3, 35 36 }; 37 38 enum class ShouldDispatchWhenWaitingForSyncReply { No, Yes, YesDuringUnboundedIPC }; 36 39 37 40 } // namespace IPC -
trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp
r247822 r247868 1212 1212 1213 1213 bool handled = false; 1214 if (!page->sendSync(Messages::WebPage::TestProcessIncomingSyncMessagesWhenWaitingForSyncReply(), Messages::WebPage::TestProcessIncomingSyncMessagesWhenWaitingForSyncReply::Reply(handled) ))1214 if (!page->sendSync(Messages::WebPage::TestProcessIncomingSyncMessagesWhenWaitingForSyncReply(), Messages::WebPage::TestProcessIncomingSyncMessagesWhenWaitingForSyncReply::Reply(handled), Seconds::infinity(), IPC::SendSyncOption::ForceDispatchWhenDestinationIsWaitingForUnboundedSyncReply)) 1215 1215 return reply(false); 1216 1216 reply(handled); -
trunk/Source/WebKit/UIProcess/WebPageProxy.cpp
r247866 r247868 2670 2670 m_process->responsivenessTimer().start(); 2671 2671 bool handled = false; 2672 bool replyReceived = m_process->sendSync(Messages::WebPage::TouchEventSync(event), Messages::WebPage::TouchEventSync::Reply(handled), m_pageID, 1_s );2672 bool replyReceived = m_process->sendSync(Messages::WebPage::TouchEventSync(event), Messages::WebPage::TouchEventSync::Reply(handled), m_pageID, 1_s, IPC::SendSyncOption::ForceDispatchWhenDestinationIsWaitingForUnboundedSyncReply); 2673 2673 // If the sync request has timed out, we should consider the event handled. The Web Process is too busy to answer any questions, so the default action is also likely to have issues. 2674 2674 if (!replyReceived) -
trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm
r247866 r247868 2000 2000 return connection->waitForAndDispatchImmediately<Messages::WebPageProxy::DidReceivePositionInformation>(_page->pageID(), 1_s, IPC::WaitForOption::InterruptWaitingIfSyncMessageArrives); 2001 2001 2002 bool receivedResponse = _page->process().sendSync(Messages::WebPage::GetPositionInformation(request), Messages::WebPage::GetPositionInformation::Reply(_positionInformation), _page->pageID(), 1_s );2002 bool receivedResponse = _page->process().sendSync(Messages::WebPage::GetPositionInformation(request), Messages::WebPage::GetPositionInformation::Reply(_positionInformation), _page->pageID(), 1_s, IPC::SendSyncOption::ForceDispatchWhenDestinationIsWaitingForUnboundedSyncReply); 2003 2003 _hasValidPositionInformation = receivedResponse && _positionInformation.canBeValid; 2004 2004 -
trunk/Source/WebKit/WebProcess/Network/WebLoaderStrategy.cpp
r246452 r247868 565 565 566 566 HangDetectionDisabler hangDetectionDisabler; 567 IPC::UnboundedSynchronousIPCScope unboundedSynchronousIPCScope; 567 568 568 569 bool shouldNotifyOfUpload = request.hasUpload() && m_loadersWithUploads.isEmpty(); -
trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp
r247822 r247868 308 308 bool WebChromeClient::testProcessIncomingSyncMessagesWhenWaitingForSyncReply() 309 309 { 310 IPC::UnboundedSynchronousIPCScope unboundedSynchronousIPCScope; 310 311 bool handled = false; 311 if (!WebProcess::singleton().ensureNetworkProcessConnection().connection().sendSync(Messages::NetworkConnectionToWebProcess::TestProcessIncomingSyncMessagesWhenWaitingForSyncReply(m_page.pageID()), Messages::NetworkConnectionToWebProcess::TestProcessIncomingSyncMessagesWhenWaitingForSyncReply::Reply(handled), 0 , Seconds::infinity(), IPC::SendSyncOption::ProcessIncomingSyncMessagesWhenWaitingForSyncReply))312 if (!WebProcess::singleton().ensureNetworkProcessConnection().connection().sendSync(Messages::NetworkConnectionToWebProcess::TestProcessIncomingSyncMessagesWhenWaitingForSyncReply(m_page.pageID()), Messages::NetworkConnectionToWebProcess::TestProcessIncomingSyncMessagesWhenWaitingForSyncReply::Reply(handled), 0)) 312 313 return false; 313 314 return handled; … … 468 469 469 470 HangDetectionDisabler hangDetectionDisabler; 470 471 m_page.sendSyncWithDelayedReply(Messages::WebPageProxy::RunJavaScriptAlert(webFrame->frameID(), SecurityOriginData::fromFrame(&frame), alertText), Messages::WebPageProxy::RunJavaScriptAlert::Reply(), IPC::SendSyncOption::ProcessIncomingSyncMessagesWhenWaitingForSyncReply); 471 IPC::UnboundedSynchronousIPCScope unboundedSynchronousIPCScope; 472 473 m_page.sendSyncWithDelayedReply(Messages::WebPageProxy::RunJavaScriptAlert(webFrame->frameID(), SecurityOriginData::fromFrame(&frame), alertText), Messages::WebPageProxy::RunJavaScriptAlert::Reply()); 472 474 } 473 475 … … 484 486 485 487 HangDetectionDisabler hangDetectionDisabler; 488 IPC::UnboundedSynchronousIPCScope unboundedSynchronousIPCScope; 486 489 487 490 bool result = false; 488 if (!m_page.sendSyncWithDelayedReply(Messages::WebPageProxy::RunJavaScriptConfirm(webFrame->frameID(), SecurityOriginData::fromFrame(&frame), message), Messages::WebPageProxy::RunJavaScriptConfirm::Reply(result) , IPC::SendSyncOption::ProcessIncomingSyncMessagesWhenWaitingForSyncReply))491 if (!m_page.sendSyncWithDelayedReply(Messages::WebPageProxy::RunJavaScriptConfirm(webFrame->frameID(), SecurityOriginData::fromFrame(&frame), message), Messages::WebPageProxy::RunJavaScriptConfirm::Reply(result))) 489 492 return false; 490 493 … … 504 507 505 508 HangDetectionDisabler hangDetectionDisabler; 506 507 if (!m_page.sendSyncWithDelayedReply(Messages::WebPageProxy::RunJavaScriptPrompt(webFrame->frameID(), SecurityOriginData::fromFrame(&frame), message, defaultValue), Messages::WebPageProxy::RunJavaScriptPrompt::Reply(result), IPC::SendSyncOption::ProcessIncomingSyncMessagesWhenWaitingForSyncReply)) 509 IPC::UnboundedSynchronousIPCScope unboundedSynchronousIPCScope; 510 511 if (!m_page.sendSyncWithDelayedReply(Messages::WebPageProxy::RunJavaScriptPrompt(webFrame->frameID(), SecurityOriginData::fromFrame(&frame), message, defaultValue), Messages::WebPageProxy::RunJavaScriptPrompt::Reply(result))) 508 512 return false; 509 513 -
trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp
r247866 r247868 317 317 static const Seconds maximumLayerVolatilityTimerInterval { 2_s }; 318 318 319 #define RELEASE_LOG_IF_ALLOWED( ...) RELEASE_LOG_IF(isAlwaysOnLoggingAllowed(), Layers,__VA_ARGS__)320 #define RELEASE_LOG_ERROR_IF_ALLOWED( ...) RELEASE_LOG_ERROR_IF(isAlwaysOnLoggingAllowed(), Layers,__VA_ARGS__)319 #define RELEASE_LOG_IF_ALLOWED(channel, fmt, ...) RELEASE_LOG_IF(isAlwaysOnLoggingAllowed(), channel, "%p - WebPage::" fmt, this, ##__VA_ARGS__) 320 #define RELEASE_LOG_ERROR_IF_ALLOWED(channel, fmt, ...) RELEASE_LOG_ERROR_IF(isAlwaysOnLoggingAllowed(), channel, "%p - WebPage::" fmt, this, ##__VA_ARGS__) 321 321 322 322 class SendStopResponsivenessTimer { … … 2557 2557 m_layerVolatilityTimer.stop(); 2558 2558 if (didSucceed) 2559 RELEASE_LOG_IF_ALLOWED( "%p - WebPage - Succeeded in marking layers as volatile", this);2559 RELEASE_LOG_IF_ALLOWED(Layers, "layerVolatilityTimerFired: Succeeded in marking layers as volatile"); 2560 2560 else 2561 RELEASE_LOG_IF_ALLOWED( "%p - WebPage - Failed to mark layers as volatile within %gms", this, maximumLayerVolatilityTimerInterval.milliseconds());2561 RELEASE_LOG_IF_ALLOWED(Layers, "layerVolatilityTimerFired: Failed to mark layers as volatile within %gms", maximumLayerVolatilityTimerInterval.milliseconds()); 2562 2562 callVolatilityCompletionHandlers(didSucceed); 2563 2563 return; 2564 2564 } 2565 2565 2566 RELEASE_LOG_ERROR_IF_ALLOWED( "%p - WebPage - Failed to mark all layers as volatile, will retry in %g ms", this, newInterval.milliseconds());2566 RELEASE_LOG_ERROR_IF_ALLOWED(Layers, "layerVolatilityTimerFired: Failed to mark all layers as volatile, will retry in %g ms", newInterval.milliseconds()); 2567 2567 m_layerVolatilityTimer.startRepeating(newInterval); 2568 2568 } … … 2575 2575 void WebPage::markLayersVolatile(WTF::Function<void (bool)>&& completionHandler) 2576 2576 { 2577 RELEASE_LOG_IF_ALLOWED( "%p - WebPage::markLayersVolatile()", this);2577 RELEASE_LOG_IF_ALLOWED(Layers, "markLayersVolatile"); 2578 2578 2579 2579 if (m_layerVolatilityTimer.isActive()) … … 2586 2586 if (didSucceed || m_isSuspendedUnderLock) { 2587 2587 if (didSucceed) 2588 RELEASE_LOG_IF_ALLOWED( "%p - WebPage - Successfully marked layers as volatile", this);2588 RELEASE_LOG_IF_ALLOWED(Layers, "markLayersVolatile: Successfully marked layers as volatile"); 2589 2589 else { 2590 2590 // If we get suspended when locking the screen, it is expected that some IOSurfaces cannot be marked as purgeable so we do not keep retrying. 2591 RELEASE_LOG_IF_ALLOWED( "%p - WebPage - Did what we could to mark IOSurfaces as purgeable after locking the screen", this);2591 RELEASE_LOG_IF_ALLOWED(Layers, "markLayersVolatile: Did what we could to mark IOSurfaces as purgeable after locking the screen"); 2592 2592 } 2593 2593 callVolatilityCompletionHandlers(didSucceed); … … 2595 2595 } 2596 2596 2597 RELEASE_LOG_IF_ALLOWED( "%p - Failed to mark all layers as volatile, will retry in %g ms", this, initialLayerVolatilityTimerInterval.milliseconds());2597 RELEASE_LOG_IF_ALLOWED(Layers, "markLayersVolatile: Failed to mark all layers as volatile, will retry in %g ms", initialLayerVolatilityTimerInterval.milliseconds()); 2598 2598 m_layerVolatilityTimer.startRepeating(initialLayerVolatilityTimerInterval); 2599 2599 } … … 2601 2601 void WebPage::cancelMarkLayersVolatile() 2602 2602 { 2603 RELEASE_LOG_IF_ALLOWED( "%p - WebPage::cancelMarkLayersVolatile()", this);2603 RELEASE_LOG_IF_ALLOWED(Layers, "cancelMarkLayersVolatile"); 2604 2604 m_layerVolatilityTimer.stop(); 2605 2605 m_markLayersAsVolatileCompletionHandlers.clear(); … … 2911 2911 void WebPage::touchEventSync(const WebTouchEvent& touchEvent, CompletionHandler<void(bool)>&& reply) 2912 2912 { 2913 // Avoid UIProcess hangs when the WebContent process is stuck on a sync IPC. 2914 if (IPC::UnboundedSynchronousIPCScope::hasOngoingUnboundedSyncIPC()) { 2915 RELEASE_LOG_ERROR_IF_ALLOWED(Process, "touchEventSync - Not processing because the process is stuck on unbounded sync IPC"); 2916 return reply(true); 2917 } 2918 2913 2919 m_pendingSynchronousTouchEventReply = WTFMove(reply); 2914 2920 … … 3280 3286 unfreezeLayerTree(LayerTreeFreezeReason::PageTransition); 3281 3287 3282 RELEASE_LOG_IF_ALLOWED( "%p - WebPage - Did complete page transition", this);3288 RELEASE_LOG_IF_ALLOWED(Layers, "didCompletePageTransition: Did complete page transition"); 3283 3289 3284 3290 bool isInitialEmptyDocument = !m_mainFrame; … … 3545 3551 #if !PLATFORM(GTK) && !PLATFORM(WIN) 3546 3552 if (!settings.acceleratedCompositingEnabled()) { 3547 RELEASE_LOG_IF_ALLOWED( "%p - WebPage - acceleratedCompositingEnabled setting was false. WebKit cannot function in this mode; changing setting to true", this);3553 RELEASE_LOG_IF_ALLOWED(Layers, "updatePreferences: acceleratedCompositingEnabled setting was false. WebKit cannot function in this mode; changing setting to true"); 3548 3554 settings.setAcceleratedCompositingEnabled(true); 3549 3555 } … … 5886 5892 void WebPage::testProcessIncomingSyncMessagesWhenWaitingForSyncReply(Messages::WebPage::TestProcessIncomingSyncMessagesWhenWaitingForSyncReply::DelayedReply&& reply) 5887 5893 { 5894 RELEASE_ASSERT(IPC::UnboundedSynchronousIPCScope::hasOngoingUnboundedSyncIPC()); 5888 5895 reply(true); 5889 5896 } -
trunk/Source/WebKit/WebProcess/WebPage/WebPage.h
r247866 r247868 1168 1168 1169 1169 template<typename T> 1170 bool sendSyncWithDelayedReply(T&& message, typename T::Reply&& reply , OptionSet<IPC::SendSyncOption> sendSyncOptions = { })1170 bool sendSyncWithDelayedReply(T&& message, typename T::Reply&& reply) 1171 1171 { 1172 1172 cancelGesturesBlockedOnSynchronousReplies(); 1173 return sendSync(WTFMove(message), WTFMove(reply), Seconds::infinity(), sendSyncOptions |IPC::SendSyncOption::InformPlatformProcessWillSuspend);1173 return sendSync(WTFMove(message), WTFMove(reply), Seconds::infinity(), IPC::SendSyncOption::InformPlatformProcessWillSuspend); 1174 1174 } 1175 1175 -
trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm
r247866 r247868 133 133 #import <wtf/text/TextStream.h> 134 134 135 #define RELEASE_LOG_IF_ALLOWED(channel, fmt, ...) RELEASE_LOG_IF(isAlwaysOnLoggingAllowed(), channel, "%p - WebPage::" fmt, this, ##__VA_ARGS__) 136 #define RELEASE_LOG_ERROR_IF_ALLOWED(channel, fmt, ...) RELEASE_LOG_ERROR_IF(isAlwaysOnLoggingAllowed(), channel, "%p - WebPage::" fmt, this, ##__VA_ARGS__) 137 135 138 namespace WebKit { 136 139 using namespace WebCore; … … 2517 2520 void WebPage::getPositionInformation(const InteractionInformationRequest& request, CompletionHandler<void(InteractionInformationAtPosition&&)>&& reply) 2518 2521 { 2522 // Avoid UIProcess hangs when the WebContent process is stuck on a sync IPC. 2523 if (IPC::UnboundedSynchronousIPCScope::hasOngoingUnboundedSyncIPC()) { 2524 RELEASE_LOG_ERROR_IF_ALLOWED(Process, "getPositionInformation - Not processing because the process is stuck on unbounded sync IPC"); 2525 return reply({ }); 2526 } 2527 2519 2528 m_pendingSynchronousPositionInformationReply = WTFMove(reply); 2520 2529 … … 4016 4025 } // namespace WebKit 4017 4026 4027 #undef RELEASE_LOG_IF_ALLOWED 4028 #undef RELEASE_LOG_ERROR_IF_ALLOWED 4029 4018 4030 #endif // PLATFORM(IOS_FAMILY)
Note:
See TracChangeset
for help on using the changeset viewer.