@@ -425,7 +425,7 @@ static void scheduleLogMemoryStatistics(LogMemoryStatisticsReason reason)
425425}
426426
427427void WebProcess::initializeWebProcess (WebProcessCreationParameters&& parameters, CompletionHandler<void (ProcessIdentity)>&& completionHandler)
428- {
428+ {
429429 TraceScope traceScope (InitializeWebProcessStart, InitializeWebProcessEnd);
430430 // Reply immediately so that the identity is available as soon as possible.
431431 completionHandler (ProcessIdentity { ProcessIdentity::CurrentProcess });
@@ -544,7 +544,7 @@ void WebProcess::initializeWebProcess(WebProcessCreationParameters&& parameters,
544544 for (auto & supplement : m_supplements.values ())
545545 supplement->initialize (parameters);
546546#if ENABLE(GPU_PROCESS) && ENABLE(VIDEO)
547- m_remoteMediaPlayerManager ->initialize (parameters);
547+ protectedRemoteMediaPlayerManager () ->initialize (parameters);
548548#endif
549549
550550 setCacheModel (parameters.cacheModel );
@@ -1267,7 +1267,7 @@ NetworkProcessConnection& WebProcess::ensureNetworkProcessConnection()
12671267#endif
12681268
12691269 // This can be called during a WebPage's constructor, so wait until after the constructor returns to touch the WebPage.
1270- RunLoop::protectedMain ()->dispatch ([this ] {
1270+ RunLoop::protectedMain ()->dispatch ([this , protectedThis = Ref { * this } ] {
12711271 for (auto & webPage : m_pageMap.values ())
12721272 webPage->synchronizeCORSDisablingPatternsWithNetworkProcess ();
12731273 });
@@ -1706,7 +1706,7 @@ void WebProcess::prepareToSuspend(bool isSuspensionImminent, MonotonicTime estim
17061706 updateFreezerStatus ();
17071707#endif
17081708
1709- markAllLayersVolatile ([this , completionHandler = WTFMove (completionHandler)]() mutable {
1709+ markAllLayersVolatile ([this , protectedThis = Ref { * this }, completionHandler = WTFMove (completionHandler)]() mutable {
17101710 WEBPROCESS_RELEASE_LOG (ProcessSuspension, " prepareToSuspend: Process is ready to suspend" );
17111711 completionHandler ();
17121712 });
@@ -1731,7 +1731,7 @@ void WebProcess::markAllLayersVolatile(CompletionHandler<void()>&& completionHan
17311731 WEBPROCESS_RELEASE_LOG (ProcessSuspension, " markAllLayersVolatile:" );
17321732 auto callbackAggregator = CallbackAggregator::create (WTFMove (completionHandler));
17331733 for (auto & page : m_pageMap.values ()) {
1734- page->markLayersVolatile ([this , callbackAggregator, pageID = page->identifier ()] (bool succeeded) {
1734+ page->markLayersVolatile ([this , protectedThis = Ref { * this }, callbackAggregator, pageID = page->identifier ()] (bool succeeded) {
17351735 if (succeeded)
17361736 WEBPROCESS_RELEASE_LOG (ProcessSuspension, " markAllLayersVolatile: Successfuly marked layers as volatile for webPageID=%" PRIu64, pageID.toUInt64 ());
17371737 else
@@ -2074,7 +2074,7 @@ void WebProcess::clearCachedPage(BackForwardItemIdentifier backForwardItemID, Co
20742074LibWebRTCNetwork& WebProcess::libWebRTCNetwork ()
20752075{
20762076 if (!m_libWebRTCNetwork)
2077- m_libWebRTCNetwork = makeUniqueWithoutRefCountedCheck<LibWebRTCNetwork>(*this );
2077+ lazyInitialize ( m_libWebRTCNetwork, makeUniqueWithoutRefCountedCheck<LibWebRTCNetwork>(*this ) );
20782078 return *m_libWebRTCNetwork;
20792079}
20802080
@@ -2371,11 +2371,11 @@ void WebProcess::setUseGPUProcessForMedia(bool useGPUProcessForMedia)
23712371
23722372#if PLATFORM(COCOA)
23732373 if (useGPUProcessForMedia) {
2374- SystemBatteryStatusTestingOverrides::singleton ().setConfigurationChangedCallback ([this ] (bool forceUpdate) {
2374+ SystemBatteryStatusTestingOverrides::singleton ().setConfigurationChangedCallback ([this , protectedThis = Ref { * this } ] (bool forceUpdate) {
23752375 ensureGPUProcessConnection ().updateMediaConfiguration (forceUpdate);
23762376 });
23772377#if ENABLE(VP9)
2378- VP9TestingOverrides::singleton ().setConfigurationChangedCallback ([this ] (bool forceUpdate) {
2378+ VP9TestingOverrides::singleton ().setConfigurationChangedCallback ([this , protectedThis = Ref { * this } ] (bool forceUpdate) {
23792379 ensureGPUProcessConnection ().updateMediaConfiguration (forceUpdate);
23802380 });
23812381#endif
0 commit comments