Changeset 185660 in webkit


Ignore:
Timestamp:
Jun 17, 2015 12:18:30 PM (9 years ago)
Author:
Antti Koivisto
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).

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r185658 r185660  
     12015-06-17  Antti Koivisto  <antti@apple.com>
     2
     3        iOS WebKit1: [LegacyTileLayer drawInContext:] should ensure it has web lock
     4        https://bugs.webkit.org/show_bug.cgi?id=146072
     5        rdar://problem/21149759
     6
     7        Reviewed by Simon Fraser
     8
     9        There are some scenarios where we end up drawing without web lock due to client or system issues.
     10        This can cause crashes.
     11
     12        * platform/ios/LegacyTileLayer.mm:
     13        (-[LegacyTileLayer setNeedsDisplayInRect:]):
     14        (-[LegacyTileLayer drawInContext:]):
     15
     16            Ensure we have the web lock when called in main thread (even though we should have it already).
     17
    1182015-06-17  Brent Fulgham  <bfulgham@apple.com>
    219
  • trunk/Source/WebCore/platform/ios/LegacyTileLayer.mm

    r185461 r185660  
    7777- (void)setNeedsDisplayInRect:(CGRect)rect
    7878{
     79    // We need to do WebKit layout before painting. Layout may generate new repaint rects and
     80    // invalidate more tiles, something that is not allowed in drawInContext.
     81    // Calling setNeedsLayout ensures that layoutSublayers will get called before drawInContext and
     82    // we do WebKit layout there.
    7983    [self setNeedsLayout];
    8084    [super setNeedsDisplayInRect:rect];
     
    9296- (void)drawInContext:(CGContextRef)context
    9397{
     98    // Bugs in clients or other frameworks may cause tile invalidation from within a CA commit.
     99    // In that case we maybe left with dirty tiles that have display still pending. Some future
     100    // commit will flush such tiles and they will get painted without holding the web lock.
     101    // rdar://problem/21149759
     102    // Still assert as the condition is not normal and may cause graphical glitches.
     103    ASSERT(WebThreadIsLockedOrDisabled());
     104    if (pthread_main_np())
     105        WebThreadLock();
     106
    94107    if (_tileGrid)
    95108        _tileGrid->tileCache().drawLayer(self, context);
Note: See TracChangeset for help on using the changeset viewer.