A WKView with plug-ins paints white when first moved into a window
authormitz@apple.com <mitz@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 9 May 2011 23:31:55 +0000 (23:31 +0000)
committermitz@apple.com <mitz@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 9 May 2011 23:31:55 +0000 (23:31 +0000)
https://bugs.webkit.org/show_bug.cgi?id=60511

Reviewed by Darin Adler.

The UI process’s wait for DidUpdateBackingStoreState would always time out because the Web process
was blocked on a synchronous message the UI process trying to get the connections for plug-ins in
the view. This is avoided by deferring the call to Page::setCanStartMedia().

* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::WebPage): Initialize the new m_setCanStartMediaTimer.
(WebKit::WebPage::setCanStartMediaTimerFired): Added. Calls setCanStartMedia(true) when the timer
fires.
(WebKit::WebPage::setIsInWindow): When going out of a window, stop the timer. When going into a
window, start it.
* WebProcess/WebPage/WebPage.h:

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

Source/WebKit2/ChangeLog
Source/WebKit2/WebProcess/WebPage/WebPage.cpp
Source/WebKit2/WebProcess/WebPage/WebPage.h

index 03b529f..17098eb 100644 (file)
@@ -1,3 +1,22 @@
+2011-05-09  Dan Bernstein  <mitz@apple.com>
+
+        Reviewed by Darin Adler.
+
+        A WKView with plug-ins paints white when first moved into a window
+        https://bugs.webkit.org/show_bug.cgi?id=60511
+
+        The UI process’s wait for DidUpdateBackingStoreState would always time out because the Web process
+        was blocked on a synchronous message the UI process trying to get the connections for plug-ins in
+        the view. This is avoided by deferring the call to Page::setCanStartMedia().
+
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::WebPage): Initialize the new m_setCanStartMediaTimer.
+        (WebKit::WebPage::setCanStartMediaTimerFired): Added. Calls setCanStartMedia(true) when the timer
+        fires.
+        (WebKit::WebPage::setIsInWindow): When going out of a window, stop the timer. When going into a
+        window, start it.
+        * WebProcess/WebPage/WebPage.h:
+
 2011-05-09  Anders Carlsson  <andersca@apple.com>
 
         Reviewed by Dan Bernstein.
index 962740b..62efaaf 100644 (file)
@@ -178,6 +178,7 @@ WebPage::WebPage(uint64_t pageID, const WebPageCreationParameters& parameters)
 #elif PLATFORM(WIN)
     , m_nativeWindow(parameters.nativeWindow)
 #endif
+    , m_setCanStartMediaTimer(WebProcess::shared().runLoop(), this, &WebPage::setCanStartMediaTimerFired)
     , m_findController(this)
     , m_geolocationPermissionRequestManager(this)
     , m_pageID(pageID)
@@ -1281,13 +1282,23 @@ void WebPage::setWindowResizerSize(const IntSize& windowResizerSize)
     }
 }
 
+void WebPage::setCanStartMediaTimerFired()
+{
+    if (m_page)
+        m_page->setCanStartMedia(true);
+}
+
 void WebPage::setIsInWindow(bool isInWindow)
 {
     if (!isInWindow) {
+        m_setCanStartMediaTimer.stop();
         m_page->setCanStartMedia(false);
         m_page->willMoveOffscreen();
     } else {
-        m_page->setCanStartMedia(true);
+        // Defer the call to Page::setCanStartMedia() since it ends up sending a syncrhonous messages to the UI process
+        // in order to get plug-in connections, and the UI process will be waiting for the Web process to update the backing
+        // store after moving the view into a window, until it times out and paints white. See <rdar://problem/9242771>.
+        m_setCanStartMediaTimer.startOneShot(0);
         m_page->didMoveOnscreen();
     }
 }
index 1d7cbb7..982d99b 100644 (file)
@@ -561,6 +561,8 @@ private:
 
     void platformDragEnded();
 
+    void setCanStartMediaTimerFired();
+
     static bool platformCanHandleRequest(const WebCore::ResourceRequest&);
 
     OwnPtr<WebCore::Page> m_page;
@@ -600,7 +602,7 @@ private:
     
     // All plug-in views on this web page.
     HashSet<PluginView*> m_pluginViews;
-    
+
     RetainPtr<AccessibilityWebPageObject> m_mockAccessibilityElement;
 
     RetainPtr<NSObject> m_dragSource;
@@ -614,6 +616,8 @@ private:
     RefPtr<WebCore::Node> m_gestureTargetNode;
 #endif
     
+    RunLoop::Timer<WebPage> m_setCanStartMediaTimer;
+
     HashMap<uint64_t, RefPtr<WebEditCommand> > m_editCommandMap;
 
     WebCore::IntSize m_windowResizerSize;