Changeset 165279 in webkit


Ignore:
Timestamp:
Mar 7, 2014, 12:52:09 PM (11 years ago)
Author:
Simon Fraser
Message:

[iOS] Add an updateID to visibleContentRect updates which is passed back in layer transactions, so we know whether transactions are stale
https://bugs.webkit.org/show_bug.cgi?id=129897

Reviewed by Benjamin Poulain.

In WebKit2 on iOS we need to know when layer updates from the web process
are stale with respect to visible rect updates from the UI process. Do so
by adding an updateID to VisibleContentRectUpdateInfo, and storing it
on each side, returning it in RemoteLayerTreeTransaction.

Did some re-ordering of members and encoding order in RemoteLayerTreeTransaction
to group like data members together.

  • Shared/VisibleContentRectUpdateInfo.cpp:

(WebKit::VisibleContentRectUpdateInfo::encode):
(WebKit::VisibleContentRectUpdateInfo::decode):

  • Shared/VisibleContentRectUpdateInfo.h:

(WebKit::VisibleContentRectUpdateInfo::VisibleContentRectUpdateInfo):
(WebKit::VisibleContentRectUpdateInfo::updateID):
(WebKit::operator==):

  • Shared/mac/RemoteLayerTreeTransaction.h:

(WebKit::RemoteLayerTreeTransaction::setLastVisibleContentRectUpdateID):
(WebKit::RemoteLayerTreeTransaction::lastVisibleContentRectUpdateID):

  • Shared/mac/RemoteLayerTreeTransaction.mm:

(WebKit::RemoteLayerTreeTransaction::encode):
(WebKit::RemoteLayerTreeTransaction::decode):

  • UIProcess/WebPageProxy.h:

(WebKit::WebPageProxy::nextVisibleContentRectUpdateID):
(WebKit::WebPageProxy::lastVisibleContentRectUpdateID):

  • UIProcess/ios/WKContentView.mm:

(-[WKContentView didUpdateVisibleRect:unobscuredRect:scale:inStableState:]):

  • WebProcess/WebPage/WebPage.cpp:

(WebKit::WebPage::WebPage):
(WebKit::WebPage::willCommitLayerTree):

  • WebProcess/WebPage/WebPage.h:
  • WebProcess/WebPage/ios/WebPageIOS.mm:

(WebKit::WebPage::updateVisibleContentRects):

Location:
trunk/Source/WebKit2
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r165276 r165279  
     12014-03-07  Simon Fraser  <simon.fraser@apple.com>
     2
     3        [iOS] Add an updateID to visibleContentRect updates which is passed back in layer transactions, so we know whether transactions are stale
     4        https://bugs.webkit.org/show_bug.cgi?id=129897
     5
     6        Reviewed by Benjamin Poulain.
     7
     8        In WebKit2 on iOS we need to know when layer updates from the web process
     9        are stale with respect to visible rect updates from the UI process. Do so
     10        by adding an updateID to VisibleContentRectUpdateInfo, and storing it
     11        on each side, returning it in RemoteLayerTreeTransaction.
     12       
     13        Did some re-ordering of members and encoding order in RemoteLayerTreeTransaction
     14        to group like data members together.
     15       
     16        * Shared/VisibleContentRectUpdateInfo.cpp:
     17        (WebKit::VisibleContentRectUpdateInfo::encode):
     18        (WebKit::VisibleContentRectUpdateInfo::decode):
     19        * Shared/VisibleContentRectUpdateInfo.h:
     20        (WebKit::VisibleContentRectUpdateInfo::VisibleContentRectUpdateInfo):
     21        (WebKit::VisibleContentRectUpdateInfo::updateID):
     22        (WebKit::operator==):
     23        * Shared/mac/RemoteLayerTreeTransaction.h:
     24        (WebKit::RemoteLayerTreeTransaction::setLastVisibleContentRectUpdateID):
     25        (WebKit::RemoteLayerTreeTransaction::lastVisibleContentRectUpdateID):
     26        * Shared/mac/RemoteLayerTreeTransaction.mm:
     27        (WebKit::RemoteLayerTreeTransaction::encode):
     28        (WebKit::RemoteLayerTreeTransaction::decode):
     29        * UIProcess/WebPageProxy.h:
     30        (WebKit::WebPageProxy::nextVisibleContentRectUpdateID):
     31        (WebKit::WebPageProxy::lastVisibleContentRectUpdateID):
     32        * UIProcess/ios/WKContentView.mm:
     33        (-[WKContentView didUpdateVisibleRect:unobscuredRect:scale:inStableState:]):
     34        * WebProcess/WebPage/WebPage.cpp:
     35        (WebKit::WebPage::WebPage):
     36        (WebKit::WebPage::willCommitLayerTree):
     37        * WebProcess/WebPage/WebPage.h:
     38        * WebProcess/WebPage/ios/WebPageIOS.mm:
     39        (WebKit::WebPage::updateVisibleContentRects):
     40
    1412014-03-07  Roger Fong  <roger_fong@apple.com>
    242
  • trunk/Source/WebKit2/Shared/VisibleContentRectUpdateInfo.cpp

    r165235 r165279  
    3737    encoder << m_customFixedPositionRect;
    3838    encoder << m_scale;
     39    encoder << m_updateID;
    3940    encoder << m_inStableState;
    4041}
     
    5051    if (!decoder.decode(result.m_scale))
    5152        return false;
     53    if (!decoder.decode(result.m_updateID))
     54        return false;
    5255    if (!decoder.decode(result.m_inStableState))
    5356        return false;
  • trunk/Source/WebKit2/Shared/VisibleContentRectUpdateInfo.h

    r165235 r165279  
    4040    VisibleContentRectUpdateInfo()
    4141        : m_scale(-1)
     42        , m_updateID(0)
     43        , m_inStableState(false)
    4244    {
    4345    }
    4446
    45     VisibleContentRectUpdateInfo(const WebCore::FloatRect& exposedRect, const WebCore::FloatRect& unobscuredRect, const WebCore::FloatRect& customFixedPositionRect, double scale, bool inStableState)
     47    VisibleContentRectUpdateInfo(uint64_t updateID, const WebCore::FloatRect& exposedRect, const WebCore::FloatRect& unobscuredRect, const WebCore::FloatRect& customFixedPositionRect, double scale, bool inStableState)
    4648        : m_exposedRect(exposedRect)
    4749        , m_unobscuredRect(unobscuredRect)
    4850        , m_customFixedPositionRect(customFixedPositionRect)
    4951        , m_scale(scale)
     52        , m_updateID(updateID)
    5053        , m_inStableState(inStableState)
    5154    {
     
    5659    const WebCore::FloatRect& customFixedPositionRect() const { return m_customFixedPositionRect; }
    5760    double scale() const { return m_scale; }
     61    uint64_t updateID() const { return m_updateID; }
    5862    bool inStableState() const { return m_inStableState; }
    5963
     
    6670    WebCore::FloatRect m_customFixedPositionRect;
    6771    double m_scale;
     72    uint64_t m_updateID;
    6873    bool m_inStableState;
    6974};
     
    7176inline bool operator==(const VisibleContentRectUpdateInfo& a, const VisibleContentRectUpdateInfo& b)
    7277{
     78    // Note: the comparison doesn't include updateID since we care about equality based on the other data.
    7379    return a.scale() == b.scale()
    7480        && a.exposedRect() == b.exposedRect()
  • trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.h

    r164702 r165279  
    165165    double pageScaleFactor() const { return m_pageScaleFactor; }
    166166    void setPageScaleFactor(double pageScaleFactor) { m_pageScaleFactor = pageScaleFactor; }
     167   
     168    void setLastVisibleContentRectUpdateID(uint64_t lastVisibleContentRectUpdateID) { m_lastVisibleContentRectUpdateID = lastVisibleContentRectUpdateID; }
     169    uint64_t lastVisibleContentRectUpdateID() const { return m_lastVisibleContentRectUpdateID; }
    167170
    168171    bool scaleWasSetByUIProcess() const { return m_scaleWasSetByUIProcess; }
     
    189192    Vector<LayerCreationProperties> m_createdLayers;
    190193    Vector<WebCore::GraphicsLayer::PlatformLayerID> m_destroyedLayerIDs;
     194    Vector<WebCore::GraphicsLayer::PlatformLayerID> m_videoLayerIDsPendingFullscreen;
     195
    191196    WebCore::IntSize m_contentsSize;
    192197    double m_pageScaleFactor;
    193     bool m_scaleWasSetByUIProcess;
    194     uint64_t m_renderTreeSize;
    195198    double m_minimumScaleFactor;
    196199    double m_maximumScaleFactor;
     200    uint64_t m_lastVisibleContentRectUpdateID;
     201    uint64_t m_renderTreeSize;
     202    bool m_scaleWasSetByUIProcess;
    197203    bool m_allowsUserScaling;
    198     Vector<WebCore::GraphicsLayer::PlatformLayerID> m_videoLayerIDsPendingFullscreen;
    199204};
    200205
  • trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.mm

    r164910 r165279  
    412412   
    413413    encoder << m_destroyedLayerIDs;
     414    encoder << m_videoLayerIDsPendingFullscreen;
     415
    414416    encoder << m_contentsSize;
    415417    encoder << m_pageScaleFactor;
    416     encoder << m_scaleWasSetByUIProcess;
    417418    encoder << m_minimumScaleFactor;
    418419    encoder << m_maximumScaleFactor;
     420
     421    encoder << m_lastVisibleContentRectUpdateID;
     422    encoder << m_renderTreeSize;
     423
     424    encoder << m_scaleWasSetByUIProcess;
    419425    encoder << m_allowsUserScaling;
    420     encoder << m_renderTreeSize;
    421     encoder << m_videoLayerIDsPendingFullscreen;
    422426}
    423427
     
    456460    }
    457461
     462    if (!decoder.decode(result.m_videoLayerIDsPendingFullscreen))
     463        return false;
     464
    458465    if (!decoder.decode(result.m_contentsSize))
    459466        return false;
     
    462469        return false;
    463470
     471    if (!decoder.decode(result.m_minimumScaleFactor))
     472        return false;
     473
     474    if (!decoder.decode(result.m_maximumScaleFactor))
     475        return false;
     476
     477    if (!decoder.decode(result.m_lastVisibleContentRectUpdateID))
     478        return false;
     479
     480    if (!decoder.decode(result.m_renderTreeSize))
     481        return false;
     482
    464483    if (!decoder.decode(result.m_scaleWasSetByUIProcess))
    465484        return false;
    466485
    467     if (!decoder.decode(result.m_minimumScaleFactor))
    468         return false;
    469 
    470     if (!decoder.decode(result.m_maximumScaleFactor))
    471         return false;
    472 
    473486    if (!decoder.decode(result.m_allowsUserScaling))
    474         return false;
    475    
    476     if (!decoder.decode(result.m_renderTreeSize))
    477         return false;
    478    
    479     if (!decoder.decode(result.m_videoLayerIDsPendingFullscreen))
    480487        return false;
    481488
  • trunk/Source/WebKit2/UIProcess/WebPageProxy.h

    r165276 r165279  
    460460
    461461    bool updateVisibleContentRects(const VisibleContentRectUpdateInfo&);
     462    uint64_t nextVisibleContentRectUpdateID() const { return m_lastVisibleContentRectUpdate.updateID() + 1; }
     463    uint64_t lastVisibleContentRectUpdateID() const { return m_lastVisibleContentRectUpdate.updateID(); }
     464   
    462465    void setViewportConfigurationMinimumLayoutSize(const WebCore::IntSize&);
    463466    void didCommitLayerTree(const WebKit::RemoteLayerTreeTransaction&);
  • trunk/Source/WebKit2/UIProcess/ios/WKContentView.mm

    r165235 r165279  
    174174
    175175    FloatRect fixedPosRect = [self fixedPositionRectFromExposedRect:unobscuredRect scale:scale];
    176     _page->updateVisibleContentRects(VisibleContentRectUpdateInfo(visibleRect, unobscuredRect, fixedPosRect, scale, isStableState));
     176    _page->updateVisibleContentRects(VisibleContentRectUpdateInfo(_page->nextVisibleContentRectUpdateID(), visibleRect, unobscuredRect, fixedPosRect, scale, isStableState));
    177177
    178178    RemoteScrollingCoordinatorProxy* scrollingCoordinator = _page->scrollingCoordinatorProxy();
  • trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp

    r165148 r165279  
    284284#if PLATFORM(IOS)
    285285    , m_shouldReturnWordAtSelection(false)
     286    , m_lastVisibleContentRectUpdateID(0)
    286287    , m_scaleWasSetByUIProcess(false)
    287288    , m_userHasChangedPageScaleFactor(false)
     
    26332634    layerTransaction.setRenderTreeSize(corePage()->renderTreeSize());
    26342635#if PLATFORM(IOS)
     2636    layerTransaction.setLastVisibleContentRectUpdateID(m_lastVisibleContentRectUpdateID);
    26352637    layerTransaction.setScaleWasSetByUIProcess(scaleWasSetByUIProcess());
    26362638    layerTransaction.setMinimumScaleFactor(minimumPageScaleFactor());
  • trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h

    r165148 r165279  
    11011101
    11021102    WebCore::ViewportConfiguration m_viewportConfiguration;
     1103    uint64_t m_lastVisibleContentRectUpdateID;
    11031104    bool m_scaleWasSetByUIProcess;
    11041105    bool m_userHasChangedPageScaleFactor;
  • trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm

    r165235 r165279  
    17301730void WebPage::updateVisibleContentRects(const VisibleContentRectUpdateInfo& visibleContentRectUpdateInfo)
    17311731{
     1732    m_lastVisibleContentRectUpdateID = visibleContentRectUpdateInfo.updateID();
     1733
    17321734    FloatRect exposedRect = visibleContentRectUpdateInfo.exposedRect();
    17331735    m_drawingArea->setExposedContentRect(enclosingIntRect(exposedRect));
Note: See TracChangeset for help on using the changeset viewer.