Changeset 215116 in webkit


Ignore:
Timestamp:
Apr 7, 2017, 1:49:49 PM (8 years ago)
Author:
Chris Dumez
Message:

Throttle / Align DOM Timers in cross-origin iframes to 30fps
https://bugs.webkit.org/show_bug.cgi?id=170613
<rdar://problem/31506444>

Reviewed by Simon Fraser.

Source/WebCore:

Throttle / Align DOM Timers in cross-origin iframes to 30fps unless the user
has interacted with them, in order to reduce power use.

Test: http/tests/frame-throttling/timer-throttle-in-cross-origin-subframe.html

  • dom/Document.cpp:

(WebCore::Document::domTimerAlignmentInterval):
(WebCore::Document::updateLastHandledUserGestureTimestamp):

  • page/DOMTimer.h:

LayoutTests:

Add layout test coverage.

  • http/tests/frame-throttling/resources/timer-throttling-frame.html: Added.
  • http/tests/frame-throttling/timer-throttle-in-cross-origin-subframe-expected.txt: Added.
  • http/tests/frame-throttling/timer-throttle-in-cross-origin-subframe.html: Added.
Location:
trunk
Files:
3 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r215098 r215116  
     12017-04-07  Chris Dumez  <cdumez@apple.com>
     2
     3        Throttle / Align DOM Timers in cross-origin iframes to 30fps
     4        https://bugs.webkit.org/show_bug.cgi?id=170613
     5        <rdar://problem/31506444>
     6
     7        Reviewed by Simon Fraser.
     8
     9        Add layout test coverage.
     10
     11        * http/tests/frame-throttling/resources/timer-throttling-frame.html: Added.
     12        * http/tests/frame-throttling/timer-throttle-in-cross-origin-subframe-expected.txt: Added.
     13        * http/tests/frame-throttling/timer-throttle-in-cross-origin-subframe.html: Added.
     14
    1152017-04-07  Brent Fulgham  <bfulgham@apple.com>
    216
  • trunk/LayoutTests/platform/ios/TestExpectations

    r215066 r215116  
    146146fast/shadow-dom/touch-event-ios.html [ Skip ]
    147147fast/shadow-dom/touch-event-on-text-assigned-to-slot.html [ Skip ]
     148http/tests/frame-throttling/raf-throttle-in-cross-origin-subframe.html [ Skip ]
     149http/tests/frame-throttling/timer-throttle-in-cross-origin-subframe.html [ Skip ]
    148150http/tests/quicklook/at-import-stylesheet-blocked.html [ Skip ]
    149151http/tests/quicklook/base-url-blocked.html [ Skip ]
  • trunk/Source/WebCore/ChangeLog

    r215115 r215116  
     12017-04-07  Chris Dumez  <cdumez@apple.com>
     2
     3        Throttle / Align DOM Timers in cross-origin iframes to 30fps
     4        https://bugs.webkit.org/show_bug.cgi?id=170613
     5        <rdar://problem/31506444>
     6
     7        Reviewed by Simon Fraser.
     8
     9        Throttle / Align DOM Timers in cross-origin iframes to 30fps unless the user
     10        has interacted with them, in order to reduce power use.
     11
     12        Test: http/tests/frame-throttling/timer-throttle-in-cross-origin-subframe.html
     13
     14        * dom/Document.cpp:
     15        (WebCore::Document::domTimerAlignmentInterval):
     16        (WebCore::Document::updateLastHandledUserGestureTimestamp):
     17        * page/DOMTimer.h:
     18
    1192017-04-07  John Wilander  <wilander@apple.com>
    220
  • trunk/Source/WebCore/dom/Document.cpp

    r215070 r215116  
    28132813        alignmentInterval = std::max(alignmentInterval, page->domTimerAlignmentInterval());
    28142814
     2815    if (!topOrigin().canAccess(securityOrigin()) && !hasHadUserInteraction())
     2816        alignmentInterval = std::max(alignmentInterval, DOMTimer::nonInteractedCrossOriginFrameAlignmentInterval());
     2817
    28152818    return alignmentInterval;
    28162819}
     
    63276330        m_scriptedAnimationController->removeThrottlingReason(ScriptedAnimationController::ThrottlingReason::NonInteractedCrossOriginFrame);
    63286331    }
     6332
     6333    // DOM Timer alignment may depend on the user having interacted with the document.
     6334    didChangeTimerAlignmentInterval();
    63296335   
    63306336    if (HTMLFrameOwnerElement* element = ownerElement())
  • trunk/Source/WebCore/page/DOMTimer.h

    r213589 r215116  
    4949    static Seconds defaultAlignmentInterval() { return 0_s; }
    5050    static Seconds defaultAlignmentIntervalInLowPowerMode() { return 30_ms; }
     51    static Seconds nonInteractedCrossOriginFrameAlignmentInterval() { return 30_ms; }
    5152    static Seconds hiddenPageAlignmentInterval() { return 1_s; }
    5253
Note: See TracChangeset for help on using the changeset viewer.