Crash removing RemoteLayerTreeDisplayRefreshMonitor from the drawing area's map
authortimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 13 Feb 2015 06:48:03 +0000 (06:48 +0000)
committertimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 13 Feb 2015 06:48:03 +0000 (06:48 +0000)
https://bugs.webkit.org/show_bug.cgi?id=141545
<rdar://problem/17712200>

Reviewed by Simon Fraser.

* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::windowScreenDidChange):
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/WebPage.messages.in:
windowScreenDidChange should take uint32_t, since that's what PlatformDisplayID is.

* WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm:
(WebKit::RemoteLayerTreeDrawingArea::RemoteLayerTreeDrawingArea):
RemoteLayerTreeDisplayRefreshMonitor is driven by the page's
RemoteLayerTreeDrawingArea. Because of this, we cannot have the same
sharing of DisplayRefreshMonitors that other platforms use.
In order to ensure that we get a unique DisplayRefreshMonitor
per-DrawingArea, give each page a unique DisplayID derived
from WebPage's unique ID.

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

Source/WebKit2/ChangeLog
Source/WebKit2/WebProcess/WebPage/WebPage.cpp
Source/WebKit2/WebProcess/WebPage/WebPage.h
Source/WebKit2/WebProcess/WebPage/WebPage.messages.in
Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm

index 512502539433f8076b904c1280a7978b2215594f..4a3af8934bfb06aecab15bd229d4bc8a4d4e1f9c 100644 (file)
@@ -1,3 +1,26 @@
+2015-02-12  Tim Horton  <timothy_horton@apple.com>
+
+        Crash removing RemoteLayerTreeDisplayRefreshMonitor from the drawing area's map
+        https://bugs.webkit.org/show_bug.cgi?id=141545
+        <rdar://problem/17712200>
+
+        Reviewed by Simon Fraser.
+
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::windowScreenDidChange):
+        * WebProcess/WebPage/WebPage.h:
+        * WebProcess/WebPage/WebPage.messages.in:
+        windowScreenDidChange should take uint32_t, since that's what PlatformDisplayID is.
+
+        * WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm:
+        (WebKit::RemoteLayerTreeDrawingArea::RemoteLayerTreeDrawingArea):
+        RemoteLayerTreeDisplayRefreshMonitor is driven by the page's
+        RemoteLayerTreeDrawingArea. Because of this, we cannot have the same
+        sharing of DisplayRefreshMonitors that other platforms use.
+        In order to ensure that we get a unique DisplayRefreshMonitor
+        per-DrawingArea, give each page a unique DisplayID derived
+        from WebPage's unique ID.
+
 2015-02-12  Tim Horton  <timothy_horton@apple.com>
 
         Crash under RemoteLayerTreeDrawingArea::flushLayers() when closing a tab
 2015-02-12  Tim Horton  <timothy_horton@apple.com>
 
         Crash under RemoteLayerTreeDrawingArea::flushLayers() when closing a tab
index 60a10b9813f3f46eeecb5795fbbf28e5b12ae344..31c929df0f64920847dfc5cbd41c346ebf660b12 100644 (file)
@@ -1428,7 +1428,7 @@ void WebPage::setPageAndTextZoomFactors(double pageZoomFactor, double textZoomFa
     return frame->setPageAndTextZoomFactors(static_cast<float>(pageZoomFactor), static_cast<float>(textZoomFactor));
 }
 
     return frame->setPageAndTextZoomFactors(static_cast<float>(pageZoomFactor), static_cast<float>(textZoomFactor));
 }
 
-void WebPage::windowScreenDidChange(uint64_t displayID)
+void WebPage::windowScreenDidChange(uint32_t displayID)
 {
     m_page->chrome().windowScreenDidChange(static_cast<PlatformDisplayID>(displayID));
 }
 {
     m_page->chrome().windowScreenDidChange(static_cast<PlatformDisplayID>(displayID));
 }
index 0bd71c6327ee8d4d5e8e32fc6b93c3e7145b711e..8197ff4d27de452db5229bd341f21a965cbcbd3f 100644 (file)
@@ -350,7 +350,7 @@ public:
     double pageZoomFactor() const;
     void setPageZoomFactor(double);
     void setPageAndTextZoomFactors(double pageZoomFactor, double textZoomFactor);
     double pageZoomFactor() const;
     void setPageZoomFactor(double);
     void setPageAndTextZoomFactors(double pageZoomFactor, double textZoomFactor);
-    void windowScreenDidChange(uint64_t);
+    void windowScreenDidChange(uint32_t);
 
     void scalePage(double scale, const WebCore::IntPoint& origin);
     void scalePageInViewCoordinates(double scale, WebCore::IntPoint centerInViewCoordinates);
 
     void scalePage(double scale, const WebCore::IntPoint& origin);
     void scalePageInViewCoordinates(double scale, WebCore::IntPoint centerInViewCoordinates);
index 2c771f6e9caf82dc3d9654637c6cee64e00daa08..8e1130e5775216d2de9c8f26dede979ec5a010a3 100644 (file)
@@ -190,7 +190,7 @@ messages -> WebPage LegacyReceiver {
     SetPageAndTextZoomFactors(double pageZoomFactor, double textZoomFactor)
     SetPageZoomFactor(double zoomFactor)
     SetTextZoomFactor(double zoomFactor)
     SetPageAndTextZoomFactors(double pageZoomFactor, double textZoomFactor)
     SetPageZoomFactor(double zoomFactor)
     SetTextZoomFactor(double zoomFactor)
-    WindowScreenDidChange(uint64_t displayID)
+    WindowScreenDidChange(uint32_t displayID)
 
     ScalePage(double scale, WebCore::IntPoint origin)
     ScalePageInViewCoordinates(double scale, WebCore::IntPoint centerInViewCoordinates)
 
     ScalePage(double scale, WebCore::IntPoint origin)
     ScalePageInViewCoordinates(double scale, WebCore::IntPoint centerInViewCoordinates)
index 5e972ac7d945f356959d6ecdf11963adf49ca1db..e207500a1aae55777e5b86849f6f9a104bdad611 100644 (file)
@@ -77,6 +77,13 @@ RemoteLayerTreeDrawingArea::RemoteLayerTreeDrawingArea(WebPage& webPage, const W
 #endif
 
     m_commitQueue = dispatch_queue_create("com.apple.WebKit.WebContent.RemoteLayerTreeDrawingArea.CommitQueue", nullptr);
 #endif
 
     m_commitQueue = dispatch_queue_create("com.apple.WebKit.WebContent.RemoteLayerTreeDrawingArea.CommitQueue", nullptr);
+
+    // In order to ensure that we get a unique DisplayRefreshMonitor per-DrawingArea (necessary because DisplayRefreshMonitor
+    // is driven by this class), give each page a unique DisplayID derived from WebPage's unique ID.
+    // FIXME: While using the high end of the range of DisplayIDs makes a collision with real, non-RemoteLayerTreeDrawingArea
+    // DisplayIDs less likely, it is not entirely safe to have a RemoteLayerTreeDrawingArea and TiledCoreAnimationDrawingArea
+    // coeexist in the same process.
+    webPage.windowScreenDidChange(std::numeric_limits<uint32_t>::max() - webPage.pageID());
 }
 
 RemoteLayerTreeDrawingArea::~RemoteLayerTreeDrawingArea()
 }
 
 RemoteLayerTreeDrawingArea::~RemoteLayerTreeDrawingArea()