Title: [185660] trunk/Source/WebCore
Revision
185660
Author
[email protected]
Date
2015-06-17 12:18:30 -0700 (Wed, 17 Jun 2015)

Log Message

iOS WebKit1: [LegacyTileLayer drawInContext:] should ensure it has web lock
https://bugs.webkit.org/show_bug.cgi?id=146072
rdar://problem/21149759

Reviewed by Simon Fraser

There are some scenarios where we end up drawing without web lock due to client or system issues.
This can cause crashes.

* platform/ios/LegacyTileLayer.mm:
(-[LegacyTileLayer setNeedsDisplayInRect:]):
(-[LegacyTileLayer drawInContext:]):

    Ensure we have the web lock when called in main thread (even though we should have it already).

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (185659 => 185660)


--- trunk/Source/WebCore/ChangeLog	2015-06-17 18:54:13 UTC (rev 185659)
+++ trunk/Source/WebCore/ChangeLog	2015-06-17 19:18:30 UTC (rev 185660)
@@ -1,3 +1,20 @@
+2015-06-17  Antti Koivisto  <[email protected]>
+
+        iOS WebKit1: [LegacyTileLayer drawInContext:] should ensure it has web lock
+        https://bugs.webkit.org/show_bug.cgi?id=146072
+        rdar://problem/21149759
+
+        Reviewed by Simon Fraser
+
+        There are some scenarios where we end up drawing without web lock due to client or system issues.
+        This can cause crashes.
+
+        * platform/ios/LegacyTileLayer.mm:
+        (-[LegacyTileLayer setNeedsDisplayInRect:]):
+        (-[LegacyTileLayer drawInContext:]):
+
+            Ensure we have the web lock when called in main thread (even though we should have it already).
+
 2015-06-17  Brent Fulgham  <[email protected]>
 
         CSS scroll snap: defining snap points on axis that does not scroll does not work properly

Modified: trunk/Source/WebCore/platform/ios/LegacyTileLayer.mm (185659 => 185660)


--- trunk/Source/WebCore/platform/ios/LegacyTileLayer.mm	2015-06-17 18:54:13 UTC (rev 185659)
+++ trunk/Source/WebCore/platform/ios/LegacyTileLayer.mm	2015-06-17 19:18:30 UTC (rev 185660)
@@ -76,6 +76,10 @@
 
 - (void)setNeedsDisplayInRect:(CGRect)rect
 {
+    // We need to do WebKit layout before painting. Layout may generate new repaint rects and
+    // invalidate more tiles, something that is not allowed in drawInContext.
+    // Calling setNeedsLayout ensures that layoutSublayers will get called before drawInContext and
+    // we do WebKit layout there.
     [self setNeedsLayout];
     [super setNeedsDisplayInRect:rect];
 }
@@ -91,6 +95,15 @@
 
 - (void)drawInContext:(CGContextRef)context
 {
+    // Bugs in clients or other frameworks may cause tile invalidation from within a CA commit.
+    // In that case we maybe left with dirty tiles that have display still pending. Some future
+    // commit will flush such tiles and they will get painted without holding the web lock.
+    // rdar://problem/21149759
+    // Still assert as the condition is not normal and may cause graphical glitches.
+    ASSERT(WebThreadIsLockedOrDisabled());
+    if (pthread_main_np())
+        WebThreadLock();
+
     if (_tileGrid)
         _tileGrid->tileCache().drawLayer(self, context);
 }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to