- Revision
- 289261
- Author
- [email protected]
- Date
- 2022-02-07 18:52:22 -0800 (Mon, 07 Feb 2022)
Log Message
Cherry-pick r287930. rdar://problem/85790203
[iOS] Page loading hangs for ~10s on WebProcess launch
https://bugs.webkit.org/show_bug.cgi?id=235089
Reviewed by Eric Carlson.
WebPage::setMuted() will result in calling into the current audioCaptureFactory,
which will be by default CoreAudioAudioCaptureFactory unless replaced.
CoreAudioAudioCaptureFactory will in turn call into AVAudioSession, which will block
for multiple seconds due to the WebContent process sandbox.
Change the order in which these calls occur by configuring the audioCaptureFactory
in platformInitialize(), which occurs near the top of the constructor. This requires
access to the WebPageCreationParameters passed into the constructor, modify that method
to take a WebPageCreationParameters, and modify all the platform-specific definitions of
that method.
* WebProcess/WebPage/Cocoa/WebPageCocoa.mm:
(WebKit::WebPage::platformInitialize):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::m_appHighlightsVisible):
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/gtk/WebPageGtk.cpp:
(WebKit::WebPage::platformInitialize):
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::platformInitialize): Deleted.
* WebProcess/WebPage/mac/WebPageMac.mm:
(WebKit::WebPage::platformInitializeAccessibility):
(WebKit::WebPage::platformInitialize): Deleted.
* WebProcess/WebPage/playstation/WebPagePlayStation.cpp:
(WebKit::WebPage::platformInitialize):
* WebProcess/WebPage/win/WebPageWin.cpp:
(WebKit::WebPage::platformInitialize):
* WebProcess/WebPage/wpe/WebPageWPE.cpp:
(WebKit::WebPage::platformInitialize):
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@287930 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Modified Paths
Diff
Modified: branches/safari-613-branch/Source/WebKit/ChangeLog (289260 => 289261)
--- branches/safari-613-branch/Source/WebKit/ChangeLog 2022-02-08 02:52:17 UTC (rev 289260)
+++ branches/safari-613-branch/Source/WebKit/ChangeLog 2022-02-08 02:52:22 UTC (rev 289261)
@@ -1,5 +1,84 @@
2022-02-07 Russell Epstein <[email protected]>
+ Cherry-pick r287930. rdar://problem/85790203
+
+ [iOS] Page loading hangs for ~10s on WebProcess launch
+ https://bugs.webkit.org/show_bug.cgi?id=235089
+
+ Reviewed by Eric Carlson.
+
+ WebPage::setMuted() will result in calling into the current audioCaptureFactory,
+ which will be by default CoreAudioAudioCaptureFactory unless replaced.
+ CoreAudioAudioCaptureFactory will in turn call into AVAudioSession, which will block
+ for multiple seconds due to the WebContent process sandbox.
+
+ Change the order in which these calls occur by configuring the audioCaptureFactory
+ in platformInitialize(), which occurs near the top of the constructor. This requires
+ access to the WebPageCreationParameters passed into the constructor, modify that method
+ to take a WebPageCreationParameters, and modify all the platform-specific definitions of
+ that method.
+
+ * WebProcess/WebPage/Cocoa/WebPageCocoa.mm:
+ (WebKit::WebPage::platformInitialize):
+ * WebProcess/WebPage/WebPage.cpp:
+ (WebKit::m_appHighlightsVisible):
+ * WebProcess/WebPage/WebPage.h:
+ * WebProcess/WebPage/gtk/WebPageGtk.cpp:
+ (WebKit::WebPage::platformInitialize):
+ * WebProcess/WebPage/ios/WebPageIOS.mm:
+ (WebKit::WebPage::platformInitialize): Deleted.
+ * WebProcess/WebPage/mac/WebPageMac.mm:
+ (WebKit::WebPage::platformInitializeAccessibility):
+ (WebKit::WebPage::platformInitialize): Deleted.
+ * WebProcess/WebPage/playstation/WebPagePlayStation.cpp:
+ (WebKit::WebPage::platformInitialize):
+ * WebProcess/WebPage/win/WebPageWin.cpp:
+ (WebKit::WebPage::platformInitialize):
+ * WebProcess/WebPage/wpe/WebPageWPE.cpp:
+ (WebKit::WebPage::platformInitialize):
+
+
+ git-svn-id: https://svn.webkit.org/repository/webkit/trunk@287930 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+ 2022-01-12 Jer Noble <[email protected]>
+
+ [iOS] Page loading hangs for ~10s on WebProcess launch
+ https://bugs.webkit.org/show_bug.cgi?id=235089
+
+ Reviewed by Eric Carlson.
+
+ WebPage::setMuted() will result in calling into the current audioCaptureFactory,
+ which will be by default CoreAudioAudioCaptureFactory unless replaced.
+ CoreAudioAudioCaptureFactory will in turn call into AVAudioSession, which will block
+ for multiple seconds due to the WebContent process sandbox.
+
+ Change the order in which these calls occur by configuring the audioCaptureFactory
+ in platformInitialize(), which occurs near the top of the constructor. This requires
+ access to the WebPageCreationParameters passed into the constructor, modify that method
+ to take a WebPageCreationParameters, and modify all the platform-specific definitions of
+ that method.
+
+ * WebProcess/WebPage/Cocoa/WebPageCocoa.mm:
+ (WebKit::WebPage::platformInitialize):
+ * WebProcess/WebPage/WebPage.cpp:
+ (WebKit::m_appHighlightsVisible):
+ * WebProcess/WebPage/WebPage.h:
+ * WebProcess/WebPage/gtk/WebPageGtk.cpp:
+ (WebKit::WebPage::platformInitialize):
+ * WebProcess/WebPage/ios/WebPageIOS.mm:
+ (WebKit::WebPage::platformInitialize): Deleted.
+ * WebProcess/WebPage/mac/WebPageMac.mm:
+ (WebKit::WebPage::platformInitializeAccessibility):
+ (WebKit::WebPage::platformInitialize): Deleted.
+ * WebProcess/WebPage/playstation/WebPagePlayStation.cpp:
+ (WebKit::WebPage::platformInitialize):
+ * WebProcess/WebPage/win/WebPageWin.cpp:
+ (WebKit::WebPage::platformInitialize):
+ * WebProcess/WebPage/wpe/WebPageWPE.cpp:
+ (WebKit::WebPage::platformInitialize):
+
+2022-02-07 Russell Epstein <[email protected]>
+
Cherry-pick r287914. rdar://problem/85451366
Protect DocumentLoader when a reference to its members is used.
Modified: branches/safari-613-branch/Source/WebKit/WebProcess/WebPage/Cocoa/WebPageCocoa.mm (289260 => 289261)
--- branches/safari-613-branch/Source/WebKit/WebProcess/WebPage/Cocoa/WebPageCocoa.mm 2022-02-08 02:52:17 UTC (rev 289260)
+++ branches/safari-613-branch/Source/WebKit/WebProcess/WebPage/Cocoa/WebPageCocoa.mm 2022-02-08 02:52:22 UTC (rev 289261)
@@ -30,6 +30,7 @@
#import "LaunchServicesDatabaseManager.h"
#import "LoadParameters.h"
#import "PluginView.h"
+#import "UserMediaCaptureManager.h"
#import "WKAccessibilityWebPageObjectBase.h"
#import "WebPageProxyMessages.h"
#import "WebPaymentCoordinator.h"
@@ -64,6 +65,16 @@
namespace WebKit {
+void WebPage::platformInitialize(const WebPageCreationParameters& parameters)
+{
+ platformInitializeAccessibility();
+
+#if ENABLE(MEDIA_STREAM)
+ if (auto* captureManager = WebProcess::singleton().supplement<UserMediaCaptureManager>())
+ captureManager->setupCaptureProcesses(parameters.shouldCaptureAudioInUIProcess, parameters.shouldCaptureAudioInGPUProcess, parameters.shouldCaptureVideoInUIProcess, parameters.shouldCaptureVideoInGPUProcess, parameters.shouldCaptureDisplayInUIProcess);
+#endif
+}
+
void WebPage::platformDidReceiveLoadParameters(const LoadParameters& parameters)
{
#if HAVE(LSDATABASECONTEXT)
Modified: branches/safari-613-branch/Source/WebKit/WebProcess/WebPage/WebPage.cpp (289260 => 289261)
--- branches/safari-613-branch/Source/WebKit/WebProcess/WebPage/WebPage.cpp 2022-02-08 02:52:17 UTC (rev 289260)
+++ branches/safari-613-branch/Source/WebKit/WebProcess/WebPage/WebPage.cpp 2022-02-08 02:52:22 UTC (rev 289261)
@@ -296,7 +296,6 @@
#include "RemoteLayerTreeTransaction.h"
#include "RemoteObjectRegistryMessages.h"
#include "TextCheckingControllerProxy.h"
-#include "UserMediaCaptureManager.h"
#include "VideoFullscreenManager.h"
#include "WKStringCF.h"
#include "WebRemoteObjectRegistry.h"
@@ -745,7 +744,7 @@
setOverrideViewportArguments(parameters.overrideViewportArguments);
#endif
- platformInitialize();
+ platformInitialize(parameters);
setUseFixedLayout(parameters.useFixedLayout);
@@ -858,11 +857,7 @@
if (parameters.enumeratingAllNetworkInterfacesEnabled)
m_page->libWebRTCProvider().enableEnumeratingAllNetworkInterfaces();
#endif
-#if PLATFORM(COCOA) && ENABLE(MEDIA_STREAM)
- if (auto* captureManager = WebProcess::singleton().supplement<UserMediaCaptureManager>())
- captureManager->setupCaptureProcesses(parameters.shouldCaptureAudioInUIProcess, parameters.shouldCaptureAudioInGPUProcess, parameters.shouldCaptureVideoInUIProcess, parameters.shouldCaptureVideoInGPUProcess, parameters.shouldCaptureDisplayInUIProcess);
#endif
-#endif
for (const auto& iterator : parameters.urlSchemeHandlers)
registerURLSchemeHandler(iterator.value, iterator.key);
Modified: branches/safari-613-branch/Source/WebKit/WebProcess/WebPage/WebPage.h (289260 => 289261)
--- branches/safari-613-branch/Source/WebKit/WebProcess/WebPage/WebPage.h 2022-02-08 02:52:17 UTC (rev 289260)
+++ branches/safari-613-branch/Source/WebKit/WebProcess/WebPage/WebPage.h 2022-02-08 02:52:22 UTC (rev 289261)
@@ -927,6 +927,7 @@
void didEndUserTriggeredSelectionChanges();
#if PLATFORM(COCOA)
+ void platformInitializeAccessibility();
void registerUIProcessAccessibilityTokens(const IPC::DataReference& elemenToken, const IPC::DataReference& windowToken);
WKAccessibilityWebPageObject* accessibilityRemoteObject();
NSObject *accessibilityObjectForMainFramePlugin();
@@ -1507,7 +1508,7 @@
IPC::Connection* messageSenderConnection() const override;
uint64_t messageSenderDestinationID() const override;
- void platformInitialize();
+ void platformInitialize(const WebPageCreationParameters&);
void platformReinitialize();
void platformDetach();
void getPlatformEditorState(WebCore::Frame&, EditorState&) const;
@@ -1529,7 +1530,6 @@
void updateViewportSizeForCSSViewportUnits();
std::optional<FocusedElementInformation> focusedElementInformation();
- void platformInitializeAccessibility();
void generateSyntheticEditingCommand(SyntheticEditingCommandType);
void handleSyntheticClick(WebCore::Node& nodeRespondingToClick, const WebCore::FloatPoint& location, OptionSet<WebKit::WebEvent::Modifier>, WebCore::PointerID = WebCore::mousePointerID);
void completeSyntheticClick(WebCore::Node& nodeRespondingToClick, const WebCore::FloatPoint& location, OptionSet<WebKit::WebEvent::Modifier>, WebCore::SyntheticClickType, WebCore::PointerID = WebCore::mousePointerID);
Modified: branches/safari-613-branch/Source/WebKit/WebProcess/WebPage/gtk/WebPageGtk.cpp (289260 => 289261)
--- branches/safari-613-branch/Source/WebKit/WebProcess/WebPage/gtk/WebPageGtk.cpp 2022-02-08 02:52:17 UTC (rev 289260)
+++ branches/safari-613-branch/Source/WebKit/WebProcess/WebPage/gtk/WebPageGtk.cpp 2022-02-08 02:52:22 UTC (rev 289261)
@@ -54,7 +54,7 @@
namespace WebKit {
using namespace WebCore;
-void WebPage::platformInitialize()
+void WebPage::platformInitialize(const WebPageCreationParameters&)
{
#if ENABLE(ACCESSIBILITY)
// Create the accessible object (the plug) that will serve as the
Modified: branches/safari-613-branch/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm (289260 => 289261)
--- branches/safari-613-branch/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm 2022-02-08 02:52:17 UTC (rev 289260)
+++ branches/safari-613-branch/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm 2022-02-08 02:52:22 UTC (rev 289261)
@@ -189,11 +189,6 @@
return range ? plainTextForDisplay(*range) : emptyString();
}
-void WebPage::platformInitialize()
-{
- platformInitializeAccessibility();
-}
-
void WebPage::platformDetach()
{
[m_mockAccessibilityElement setWebPage:nullptr];
Modified: branches/safari-613-branch/Source/WebKit/WebProcess/WebPage/mac/WebPageMac.mm (289260 => 289261)
--- branches/safari-613-branch/Source/WebKit/WebProcess/WebPage/mac/WebPageMac.mm 2022-02-08 02:52:17 UTC (rev 289260)
+++ branches/safari-613-branch/Source/WebKit/WebProcess/WebPage/mac/WebPageMac.mm 2022-02-08 02:52:22 UTC (rev 289261)
@@ -109,7 +109,7 @@
namespace WebKit {
using namespace WebCore;
-void WebPage::platformInitialize()
+void WebPage::platformInitializeAccessibility()
{
auto mockAccessibilityElement = adoptNS([[WKAccessibilityWebPageObject alloc] init]);
Modified: branches/safari-613-branch/Source/WebKit/WebProcess/WebPage/playstation/WebPagePlayStation.cpp (289260 => 289261)
--- branches/safari-613-branch/Source/WebKit/WebProcess/WebPage/playstation/WebPagePlayStation.cpp 2022-02-08 02:52:17 UTC (rev 289260)
+++ branches/safari-613-branch/Source/WebKit/WebProcess/WebPage/playstation/WebPagePlayStation.cpp 2022-02-08 02:52:22 UTC (rev 289261)
@@ -34,7 +34,7 @@
namespace WebKit {
using namespace WebCore;
-void WebPage::platformInitialize()
+void WebPage::platformInitialize(const WebPageCreationParameters&)
{
}
Modified: branches/safari-613-branch/Source/WebKit/WebProcess/WebPage/win/WebPageWin.cpp (289260 => 289261)
--- branches/safari-613-branch/Source/WebKit/WebProcess/WebPage/win/WebPageWin.cpp 2022-02-08 02:52:17 UTC (rev 289260)
+++ branches/safari-613-branch/Source/WebKit/WebProcess/WebPage/win/WebPageWin.cpp 2022-02-08 02:52:22 UTC (rev 289261)
@@ -52,7 +52,7 @@
namespace WebKit {
using namespace WebCore;
-void WebPage::platformInitialize()
+void WebPage::platformInitialize(const WebPageCreationParameters&)
{
}
Modified: branches/safari-613-branch/Source/WebKit/WebProcess/WebPage/wpe/WebPageWPE.cpp (289260 => 289261)
--- branches/safari-613-branch/Source/WebKit/WebProcess/WebPage/wpe/WebPageWPE.cpp 2022-02-08 02:52:17 UTC (rev 289260)
+++ branches/safari-613-branch/Source/WebKit/WebProcess/WebPage/wpe/WebPageWPE.cpp 2022-02-08 02:52:22 UTC (rev 289261)
@@ -36,7 +36,7 @@
namespace WebKit {
using namespace WebCore;
-void WebPage::platformInitialize()
+void WebPage::platformInitialize(const WebPageCreationParameters&)
{
#if ENABLE(ACCESSIBILITY)
// Create the accessible object (the plug) that will serve as the