No content shows up for WKWebView while locked even with _canShowWhileLocked is YES
authortimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 13 Jun 2019 21:20:26 +0000 (21:20 +0000)
committertimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 13 Jun 2019 21:20:26 +0000 (21:20 +0000)
https://bugs.webkit.org/show_bug.cgi?id=198819
<rdar://problem/51636240>

Reviewed by Simon Fraser.

* UIProcess/Cocoa/WebPageProxyCocoa.mm:
(WebKit::WebPageProxy::didCreateContextForVisibilityPropagation):
* UIProcess/WebPageProxy.h:
(WebKit::WebPageProxy::contextIDForVisibilityPropagation const):
* UIProcess/WebPageProxy.messages.in:
* UIProcess/WebProcessProxy.h:
(WebKit::WebProcessProxy::contextIDForVisibilityPropagation): Deleted.
* UIProcess/WebProcessProxy.messages.in:
* UIProcess/ios/WKContentView.mm:
(-[WKContentView _setupVisibilityPropagationView]):
* UIProcess/ios/WebPageProxyIOS.mm:
(WebKit::WebPageProxy::didCreateContextForVisibilityPropagation): Deleted.
* UIProcess/ios/WebProcessProxyIOS.mm:
(WebKit::WebProcessProxy::didCreateContextForVisibilityPropagation): Deleted.
* WebProcess/WebPage/WebPage.cpp:
(WebKit::m_shrinkToFitContentTimer):
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebProcess.h:
* WebProcess/cocoa/WebProcessCocoa.mm:
(WebKit::WebProcess::platformInitializeWebProcess):
Move the creation of the visibility propagation context to WebPage instead of WebProcess,
because canShowWhileLocked is per-page, not per-process.

Also, pass canShowWhileLocked into the context creation function for the visibility
propagation context, not just RemoteLayerTree contexts.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@246413 268f45cc-cd09-0410-ab3c-d52691b4dbfc

13 files changed:
Source/WebKit/ChangeLog
Source/WebKit/UIProcess/Cocoa/WebPageProxyCocoa.mm
Source/WebKit/UIProcess/WebPageProxy.h
Source/WebKit/UIProcess/WebPageProxy.messages.in
Source/WebKit/UIProcess/WebProcessProxy.h
Source/WebKit/UIProcess/WebProcessProxy.messages.in
Source/WebKit/UIProcess/ios/WKContentView.mm
Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm
Source/WebKit/UIProcess/ios/WebProcessProxyIOS.mm
Source/WebKit/WebProcess/WebPage/WebPage.cpp
Source/WebKit/WebProcess/WebPage/WebPage.h
Source/WebKit/WebProcess/WebProcess.h
Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm

index 5cf5890..b1068f7 100644 (file)
@@ -1,3 +1,37 @@
+2019-06-13  Tim Horton  <timothy_horton@apple.com>
+
+        No content shows up for WKWebView while locked even with _canShowWhileLocked is YES
+        https://bugs.webkit.org/show_bug.cgi?id=198819
+        <rdar://problem/51636240>
+
+        Reviewed by Simon Fraser.
+
+        * UIProcess/Cocoa/WebPageProxyCocoa.mm:
+        (WebKit::WebPageProxy::didCreateContextForVisibilityPropagation):
+        * UIProcess/WebPageProxy.h:
+        (WebKit::WebPageProxy::contextIDForVisibilityPropagation const):
+        * UIProcess/WebPageProxy.messages.in:
+        * UIProcess/WebProcessProxy.h:
+        (WebKit::WebProcessProxy::contextIDForVisibilityPropagation): Deleted.
+        * UIProcess/WebProcessProxy.messages.in:
+        * UIProcess/ios/WKContentView.mm:
+        (-[WKContentView _setupVisibilityPropagationView]):
+        * UIProcess/ios/WebPageProxyIOS.mm:
+        (WebKit::WebPageProxy::didCreateContextForVisibilityPropagation): Deleted.
+        * UIProcess/ios/WebProcessProxyIOS.mm:
+        (WebKit::WebProcessProxy::didCreateContextForVisibilityPropagation): Deleted.
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::m_shrinkToFitContentTimer):
+        * WebProcess/WebPage/WebPage.h:
+        * WebProcess/WebProcess.h:
+        * WebProcess/cocoa/WebProcessCocoa.mm:
+        (WebKit::WebProcess::platformInitializeWebProcess):
+        Move the creation of the visibility propagation context to WebPage instead of WebProcess,
+        because canShowWhileLocked is per-page, not per-process.
+
+        Also, pass canShowWhileLocked into the context creation function for the visibility
+        propagation context, not just RemoteLayerTree contexts.
+
 2019-06-13  Antoine Quint  <graouts@apple.com>
 
         "display: contents" Content click does not trigger
index 01d5507..a41cd3a 100644 (file)
@@ -291,4 +291,12 @@ void WebPageProxy::voicesDidChange()
 }
 #endif // ENABLE(SPEECH_SYNTHESIS)
 
+#if HAVE(VISIBILITY_PROPAGATION_VIEW)
+void WebPageProxy::didCreateContextForVisibilityPropagation(LayerHostingContextID contextID)
+{
+    m_contextIDForVisibilityPropagation = contextID;
+    pageClient().didCreateContextForVisibilityPropagation(contextID);
+}
+#endif
+
 } // namespace WebKit
index d9791fe..f54f67f 100644 (file)
@@ -1078,6 +1078,7 @@ public:
 
 #if HAVE(VISIBILITY_PROPAGATION_VIEW)
     void didCreateContextForVisibilityPropagation(LayerHostingContextID);
+    LayerHostingContextID contextIDForVisibilityPropagation() const { return m_contextIDForVisibilityPropagation; }
 #endif
 
     virtual void enterAcceleratedCompositingMode(const LayerTreeContext&);
@@ -2518,6 +2519,10 @@ WEBPAGEPROXY_LOADOPTIMIZER_ADDITIONS_2
     std::unique_ptr<EditableImageController> m_editableImageController;
 #endif
 
+#if HAVE(VISIBILITY_PROPAGATION_VIEW)
+    LayerHostingContextID m_contextIDForVisibilityPropagation { 0 };
+#endif
+
     HashMap<WebViewDidMoveToWindowObserver*, WeakPtr<WebViewDidMoveToWindowObserver>> m_webViewDidMoveToWindowObservers;
 
     mutable RefPtr<Logger> m_logger;
index c008f2c..8bf9861 100644 (file)
@@ -568,4 +568,8 @@ messages -> WebPageProxy {
 #if PLATFORM(GTK)
     ShowEmojiPicker(WebCore::IntRect caretRect) -> (String result) Async
 #endif
+
+#if HAVE(VISIBILITY_PROPAGATION_VIEW)
+    DidCreateContextForVisibilityPropagation(WebKit::LayerHostingContextID contextID);
+#endif
 }
index 063e861..e790bc6 100644 (file)
@@ -301,10 +301,6 @@ public:
     void unblockAccessibilityServerIfNeeded();
 #endif
 
-#if HAVE(VISIBILITY_PROPAGATION_VIEW)
-    LayerHostingContextID contextIDForVisibilityPropagation() { return m_contextIDForVisibilityPropagation; }
-#endif
-
 #if PLATFORM(IOS_FAMILY)
     void processWasUnexpectedlyUnsuspended(CompletionHandler<void()>&&);
 #endif
@@ -351,10 +347,6 @@ private:
     void didDeliverMessagePortMessages(uint64_t messageBatchIdentifier);
     void didCheckProcessLocalPortForActivity(uint64_t callbackIdentifier, bool isLocallyReachable);
 
-#if HAVE(VISIBILITY_PROPAGATION_VIEW)
-    void didCreateContextForVisibilityPropagation(LayerHostingContextID);
-#endif
-
     bool hasProvisionalPageWithID(WebCore::PageIdentifier) const;
     bool isAllowedToUpdateBackForwardItem(WebBackForwardListItem&) const;
 
@@ -461,10 +453,6 @@ private:
     std::unique_ptr<WebCore::DeferrableOneShotTimer> m_unexpectedActivityTimer;
 #endif
 
-#if HAVE(VISIBILITY_PROPAGATION_VIEW)
-    LayerHostingContextID m_contextIDForVisibilityPropagation { 0 };
-#endif
-
     HashMap<String, uint64_t> m_pageURLRetainCountMap;
 
     Optional<WebCore::RegistrableDomain> m_registrableDomain;
index 1e0a67c..f3d5e93 100644 (file)
@@ -80,10 +80,6 @@ messages -> WebProcessProxy LegacyReceiver {
     StopDisplayLink(unsigned observerID, uint32_t displayID)
 #endif
 
-#if HAVE(VISIBILITY_PROPAGATION_VIEW)
-    DidCreateContextForVisibilityPropagation(WebKit::LayerHostingContextID contextID);
-#endif
-
 #if PLATFORM(IOS_FAMILY)
     ProcessWasUnexpectedlyUnsuspended() -> () Async
 #endif
index 29d3060..fe54df8 100644 (file)
 - (void)_setupVisibilityPropagationView
 {
     auto processIdentifier = _page->process().processIdentifier();
-    auto contextID = _page->process().contextIDForVisibilityPropagation();
+    auto contextID = _page->contextIDForVisibilityPropagation();
     if (!processIdentifier || !contextID)
         return;
 
index 49d0605..2137afb 100644 (file)
@@ -84,13 +84,6 @@ String WebPageProxy::standardUserAgent(const String& applicationNameForUserAgent
     return standardUserAgentWithApplicationName(applicationNameForUserAgent);
 }
 
-#if HAVE(VISIBILITY_PROPAGATION_VIEW)
-void WebPageProxy::didCreateContextForVisibilityPropagation(LayerHostingContextID contextID)
-{
-    pageClient().didCreateContextForVisibilityPropagation(contextID);
-}
-#endif
-
 void WebPageProxy::getIsSpeaking(CompletionHandler<void(bool)>&& completionHandler)
 {
     notImplemented();
index 70ba162..4388087 100644 (file)
@@ -62,15 +62,6 @@ void WebProcessProxy::unblockAccessibilityServerIfNeeded()
     m_hasSentMessageToUnblockAccessibilityServer = true;
 }
 
-#if HAVE(VISIBILITY_PROPAGATION_VIEW)
-void WebProcessProxy::didCreateContextForVisibilityPropagation(LayerHostingContextID contextID)
-{
-    m_contextIDForVisibilityPropagation = contextID;
-    for (auto& page : copyToVectorOf<RefPtr<WebPageProxy>>(m_pageMap.values()))
-        page->didCreateContextForVisibilityPropagation(contextID);
-}
-#endif
-
 } // namespace WebKit
 
 #endif // PLATFORM(IOS_FAMILY)
index c0c2f2a..1c10ec1 100644 (file)
@@ -683,6 +683,14 @@ WebPage::WebPage(PageIdentifier pageID, WebPageCreationParameters&& parameters)
     PlatformMediaSessionManager::setShouldDeactivateAudioSession(true);
 #endif
 
+#if HAVE(VISIBILITY_PROPAGATION_VIEW)
+    m_contextForVisibilityPropagation = LayerHostingContext::createForExternalHostingProcess({
+        m_canShowWhileLocked
+    });
+    RELEASE_LOG(Process, "Created context with ID %d for visibility propagation from UIProcess", m_contextForVisibilityPropagation->contextID());
+    send(Messages::WebPageProxy::DidCreateContextForVisibilityPropagation(m_contextForVisibilityPropagation->contextID()));
+#endif
+
     updateThrottleState();
 }
 
index 87a3e64..aa73058 100644 (file)
@@ -1940,6 +1940,9 @@ private:
 #if ENABLE(VIEWPORT_RESIZING)
     WebCore::DeferrableOneShotTimer m_shrinkToFitContentTimer;
 #endif
+#if HAVE(VISIBILITY_PROPAGATION_VIEW)
+    std::unique_ptr<LayerHostingContext> m_contextForVisibilityPropagation;
+#endif
 };
 
 } // namespace WebKit
index a644421..89901ce 100644 (file)
@@ -531,9 +531,6 @@ private:
     WebSQLiteDatabaseTracker m_webSQLiteDatabaseTracker;
     ProcessTaskStateObserver m_taskStateObserver { *this };
 #endif
-#if HAVE(VISIBILITY_PROPAGATION_VIEW)
-    std::unique_ptr<LayerHostingContext> m_contextForVisibilityPropagation;
-#endif
 
     enum PageMarkingLayersAsVolatileCounterType { };
     using PageMarkingLayersAsVolatileCounter = RefCounter<PageMarkingLayersAsVolatileCounterType>;
index b9ce79d..551e37a 100644 (file)
@@ -174,12 +174,6 @@ void WebProcess::platformInitializeWebProcess(WebProcessCreationParameters& para
 
     m_compositingRenderServerPort = WTFMove(parameters.acceleratedCompositingPort);
 
-#if HAVE(VISIBILITY_PROPAGATION_VIEW)
-    m_contextForVisibilityPropagation = LayerHostingContext::createForExternalHostingProcess();
-    RELEASE_LOG(Process, "Created context with ID %d for visibility propagation from UIProcess", m_contextForVisibilityPropagation->contextID());
-    parentProcessConnection()->send(Messages::WebProcessProxy::DidCreateContextForVisibilityPropagation(m_contextForVisibilityPropagation->contextID()), 0);
-#endif
-
     WebCore::registerMemoryReleaseNotifyCallbacks();
     MemoryPressureHandler::ReliefLogger::setLoggingEnabled(parameters.shouldEnableMemoryPressureReliefLogging);