Changeset 198745 in webkit


Ignore:
Timestamp:
Mar 28, 2016 10:17:51 AM (8 years ago)
Author:
Simon Fraser
Message:

Inspector Memory Timeline sometimes encounters unstoppable rAF drawing
https://bugs.webkit.org/show_bug.cgi?id=155906

Reviewed by Anders Carlsson.

It was possible to get Web Inspector into a state where repeated, expensive
requestAnimationFrame calls prevented user events from being handled, making it
unresponsive.

requestAnimationFrame uses callOnMainThread() to get a notification from the
CVDispayLink thread to the main thread, which is a -performSelectorOnMainThread...
Under the hood, this ends up as a CFRunLoopPerformBlock().

User events come in via Connection::enqueueIncomingMessage(), which uses RunLoop::main()::dispatch(),
which uses a CFRunLoopSource. Evidently, repeated calls to CFRunLoopPerformBlock() can prevent the
CFRunLoopSource from being handled.

Fix by moving requestAnimationFrame from callOnMainThread() to RunLoop::main()::dispatch().

  • platform/graphics/mac/DisplayRefreshMonitorMac.cpp:

(WebCore::DisplayRefreshMonitorMac::displayLinkFired):

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r198741 r198745  
     12016-03-25  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Inspector Memory Timeline sometimes encounters unstoppable rAF drawing
     4        https://bugs.webkit.org/show_bug.cgi?id=155906
     5
     6        Reviewed by Anders Carlsson.
     7
     8        It was possible to get Web Inspector into a state where repeated, expensive
     9        requestAnimationFrame calls prevented user events from being handled, making it
     10        unresponsive.
     11       
     12        requestAnimationFrame uses callOnMainThread() to get a notification from the
     13        CVDispayLink thread to the main thread, which is a -performSelectorOnMainThread...
     14        Under the hood, this ends up as a CFRunLoopPerformBlock().
     15       
     16        User events come in via Connection::enqueueIncomingMessage(), which uses RunLoop::main()::dispatch(),
     17        which uses a CFRunLoopSource. Evidently, repeated calls to CFRunLoopPerformBlock() can prevent the
     18        CFRunLoopSource from being handled.
     19       
     20        Fix by moving requestAnimationFrame from callOnMainThread() to RunLoop::main()::dispatch().
     21
     22        * platform/graphics/mac/DisplayRefreshMonitorMac.cpp:
     23        (WebCore::DisplayRefreshMonitorMac::displayLinkFired):
     24
    1252016-03-28  Chris Dumez  <cdumez@apple.com>
    226
  • trunk/Source/WebCore/platform/graphics/mac/DisplayRefreshMonitorMac.cpp

    r188700 r198745  
    3131#include <QuartzCore/QuartzCore.h>
    3232#include <wtf/CurrentTime.h>
    33 #include <wtf/MainThread.h>
     33#include <wtf/RunLoop.h>
    3434
    3535namespace WebCore {
     
    104104    auto weakPtr = m_weakFactory.createWeakPtr();
    105105
    106     callOnMainThread([weakPtr] {
     106    RunLoop::main().dispatch([weakPtr] {
    107107        if (auto* monitor = weakPtr.get())
    108108            handleDisplayRefreshedNotificationOnMainThread(monitor);
Note: See TracChangeset for help on using the changeset viewer.