Changeset 102843 in webkit


Ignore:
Timestamp:
Dec 14, 2011 4:16:33 PM (12 years ago)
Author:
commit-queue@webkit.org
Message:

[BlackBerry] Refactor code and add some debug messages in backing store
https://bugs.webkit.org/show_bug.cgi?id=74539

Patch by Jacky Jiang <zhajiang@rim.com> on 2011-12-14
Reviewed by Antonio Gomes.

Refactor and get rid of the confusing and unnecessary
'renderContentOnly' flag from the family of render methods in the
backing store.
Remove the overload of the render method that takes a list of rects from
the backing store since it is just a for loop and only one place calls it.
Add a debug message to illustrate when we start showing checkerboard and
when we stop.
Fix the debug messages in the DEBUG_BACKINGSTORE so that they actually compile
and add a new message for debugging WebCore invalidation requests.
The original author is Adam Treat <atreat@rim.com>

  • blackberry/Api/BackingStore.cpp:

(BlackBerry::WebKit::BackingStorePrivate::resumeScreenAndBackingStoreUpdates):
(BlackBerry::WebKit::BackingStorePrivate::repaint):
(BlackBerry::WebKit::BackingStorePrivate::slowScroll):
(BlackBerry::WebKit::BackingStorePrivate::renderDirectToWindow):
(BlackBerry::WebKit::BackingStorePrivate::render):
(BlackBerry::WebKit::BackingStorePrivate::renderVisibleContents):
(BlackBerry::WebKit::BackingStorePrivate::renderBackingStore):
(BlackBerry::WebKit::BackingStorePrivate::blitVisibleContents):
(BlackBerry::WebKit::BackingStorePrivate::blitContents):
(BlackBerry::WebKit::BackingStorePrivate::updateTile):
(BlackBerry::WebKit::BackingStorePrivate::invalidateWindow):

  • blackberry/Api/BackingStore_p.h:
Location:
trunk/Source/WebKit
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r102754 r102843  
     12011-12-14  Jacky Jiang  <zhajiang@rim.com>
     2
     3        [BlackBerry] Refactor code and add some debug messages in backing store
     4        https://bugs.webkit.org/show_bug.cgi?id=74539
     5
     6        Reviewed by Antonio Gomes.
     7
     8        Refactor and get rid of the confusing and unnecessary
     9        'renderContentOnly' flag from the family of render methods in the
     10        backing store.
     11        Remove the overload of the render method that takes a list of rects from
     12        the backing store since it is just a for loop and only one place calls it.
     13        Add a debug message to illustrate when we start showing checkerboard and
     14        when we stop.
     15        Fix the debug messages in the DEBUG_BACKINGSTORE so that they actually compile
     16        and add a new message for debugging WebCore invalidation requests.
     17        The original author is Adam Treat <atreat@rim.com>
     18
     19        * blackberry/Api/BackingStore.cpp:
     20        (BlackBerry::WebKit::BackingStorePrivate::resumeScreenAndBackingStoreUpdates):
     21        (BlackBerry::WebKit::BackingStorePrivate::repaint):
     22        (BlackBerry::WebKit::BackingStorePrivate::slowScroll):
     23        (BlackBerry::WebKit::BackingStorePrivate::renderDirectToWindow):
     24        (BlackBerry::WebKit::BackingStorePrivate::render):
     25        (BlackBerry::WebKit::BackingStorePrivate::renderVisibleContents):
     26        (BlackBerry::WebKit::BackingStorePrivate::renderBackingStore):
     27        (BlackBerry::WebKit::BackingStorePrivate::blitVisibleContents):
     28        (BlackBerry::WebKit::BackingStorePrivate::blitContents):
     29        (BlackBerry::WebKit::BackingStorePrivate::updateTile):
     30        (BlackBerry::WebKit::BackingStorePrivate::invalidateWindow):
     31        * blackberry/Api/BackingStore_p.h:
     32
    1332011-12-14  Robin Qiu  <robin.qiu@torchmobile.com.cn>
    234
  • trunk/Source/WebKit/blackberry/Api/BackingStore.cpp

    r102713 r102843  
    4949#define ENABLE_REPAINTONSCROLL 1
    5050#define DEBUG_BACKINGSTORE 0
     51#define DEBUG_CHECKERBOARD 0
     52#define DEBUG_WEBCORE_REQUESTS 0
    5153#define DEBUG_VISUALIZE 0
    5254#define DEBUG_TILEMATRIX 0
     
    265267    // Do some rendering if necessary.
    266268    if (op == BackingStore::RenderAndBlit)
    267         renderVisibleContents(true /*renderContentOnly*/);
     269        renderVisibleContents();
    268270
    269271    // Make sure the user interface thread gets the message before we proceed
     
    307309            return;
    308310
    309         if (immediate)
    310             render(rect, false /*renderContentOnly*/);
    311         else
     311#if DEBUG_WEBCORE_REQUESTS
     312        BlackBerry::Platform::log(BlackBerry::Platform::LogLevelCritical,
     313                                  "BackingStorePrivate::repaint rect=%d,%d %dx%d contentChanged=%s immediate=%s",
     314                                  rect.x(), rect.y(), rect.width(), rect.height(),
     315                                  (contentChanged ? "true" : "false"),
     316                                  (immediate ? "true" : "false"));
     317#endif
     318
     319        if (immediate) {
     320            render(rect);
     321            blitVisibleContents();
     322        } else
    312323            m_renderQueue->addToQueue(RenderQueue::RegularRender, rect);
    313324    }
     
    327338    Platform::IntRect rect = m_webPage->d->mapToTransformed(m_client->mapFromViewportToContents(windowRect));
    328339
    329     if (immediate)
    330         render(rect, false /*renderContentOnly*/);
    331     else {
     340    if (immediate) {
     341        render(rect);
     342        blitVisibleContents();
     343    } else {
    332344        m_renderQueue->addToQueue(RenderQueue::VisibleScroll, rect);
    333345        // We only blit here if the client did not generate the scroll as the client
     
    904916}
    905917
    906 bool BackingStorePrivate::render(const IntRectList& rectList, bool renderContentOnly)
    907 {
    908     // FIXME: We cycle through one by one and only blit the contents at the end.
    909     // This can be improved upon if we had a mapFromTransformedContentsToTiles that
    910     // took a set of rects and decomposed them appropriately.
    911     bool rendered = false;
    912     for (size_t i = 0; i < rectList.size(); ++i)
    913         rendered = render(rectList.at(i), true) ? true : rendered;
    914 
    915     if (rendered && !renderContentOnly) {
    916         if (!shouldDirectRenderingToWindow())
    917             blitVisibleContents();
    918         else
    919             invalidateWindow();
    920     }
    921 
    922     return rendered;
    923 }
    924 
    925 bool BackingStorePrivate::renderDirectToWindow(const Platform::IntRect& rect, bool renderContentOnly)
     918bool BackingStorePrivate::renderDirectToWindow(const Platform::IntRect& rect)
    926919{
    927920    requestLayoutIfNeeded();
     
    951944#endif
    952945
    953     bool shouldInvalidate = !m_suspendScreenUpdates && !renderContentOnly;
    954     if (!shouldInvalidate)
    955         return true;
    956 
    957946    invalidateWindow(screenRect);
    958947    return true;
    959948}
    960949
    961 bool BackingStorePrivate::render(const Platform::IntRect& rect, bool renderContentOnly)
     950bool BackingStorePrivate::render(const Platform::IntRect& rect)
    962951{
    963952    if (!m_webPage->isVisible())
     
    967956
    968957    if (shouldDirectRenderingToWindow())
    969         return renderDirectToWindow(rect, renderContentOnly);
     958        return renderDirectToWindow(rect);
    970959
    971960    TileRectList tileRectList = mapFromTransformedContentsToTiles(rect);
     
    975964#if DEBUG_BACKINGSTORE
    976965    BlackBerry::Platform::log(BlackBerry::Platform::LogLevelCritical,
    977                            "BackingStorePrivate::render rect=(%d,%d %dx%d), renderContentOnly=%s, m_suspendBackingStoreUpdates = %s",
     966                           "BackingStorePrivate::render rect=(%d,%d %dx%d), m_suspendBackingStoreUpdates = %s",
    978967                           rect.x(), rect.y(), rect.width(), rect.height(),
    979                            renderContentOnly ? "true" : "false",
    980968                           m_suspendBackingStoreUpdates ? "true" : "false");
    981969#endif
     
    987975
    988976    Platform::IntRect dirtyContentsRect;
    989     bool shouldBlit = !m_suspendBackingStoreUpdates && !renderContentOnly;
    990977    const Platform::IntRect contentsRect = Platform::IntRect(Platform::IntPoint(0, 0), m_client->transformedContentsSize());
    991978    const Platform::IntRect viewportRect = Platform::IntRect(Platform::IntPoint(0, 0), m_client->transformedViewportSize());
     
    10771064    }
    10781065
    1079     // Clip to the visible content including overscroll.
    1080     dirtyContentsRect.intersect(unclippedVisibleContentsRect());
    1081     if (dirtyContentsRect.isEmpty())
    1082         return true;
    1083 
    1084     if (!shouldBlit)
    1085         return true;
    1086 
    1087     blitVisibleContents();
    10881066    return true;
    10891067}
     
    10941072}
    10951073
    1096 void BackingStorePrivate::renderVisibleContents(bool renderContentOnly)
     1074void BackingStorePrivate::renderVisibleContents()
    10971075{
    10981076    Platform::IntRect renderRect = shouldDirectRenderingToWindow() ? visibleContentsRect() : visibleTilesRect();
    1099 
    1100     render(renderRect, renderContentOnly);
     1077    render(renderRect);
    11011078    m_renderQueue->clear(renderRect, true /*clearRegularRenderJobs*/);
    11021079}
    11031080
    1104 void BackingStorePrivate::renderBackingStore(bool renderContentOnly)
    1105 {
    1106     render(frontState()->backingStoreRect(), renderContentOnly);
     1081void BackingStorePrivate::renderBackingStore()
     1082{
     1083    render(frontState()->backingStoreRect());
    11071084}
    11081085
     
    11111088    // Blitting must never happen for direct rendering case.
    11121089    ASSERT(!shouldDirectRenderingToWindow());
     1090    if (shouldDirectRenderingToWindow())
     1091        return;
    11131092
    11141093    if (m_suspendScreenUpdates) {
     
    11991178    // Use invalidateWindow() instead.
    12001179    ASSERT(!shouldDirectRenderingToWindow());
     1180    if (shouldDirectRenderingToWindow())
     1181        return;
    12011182
    12021183    if (!m_webPage->isVisible() || m_suspendScreenUpdates || !isActive()) {
     
    12681249    TileMap currentMap = currentState->tileMap();
    12691250
     1251#if DEBUG_CHECKERBOARD
     1252    bool blitCheckered = false;
     1253#endif
     1254
    12701255    // Don't clip to contents if it is empty so we can still paint default background.
    12711256    if (!contentsRect.isEmpty()) {
     
    12871272                Platform::IntPoint(checkeredRects.at(i).x() - origin.x(), checkeredRects.at(i).y() - origin.y()),
    12881273                                   checkeredRects.at(i).size()));
     1274#if DEBUG_CHECKERBOARD
     1275            blitCheckered = true;
     1276#endif
    12891277            checkerWindow(dstRect, checkeredRects.at(i).location(), transformation.a());
    12901278        }
     
    13471335            }
    13481336            const Platform::IntPoint contentsOrigin(dirtyRect.x() + origin.x(), dirtyRect.y() + origin.y());
     1337#if DEBUG_CHECKERBOARD
     1338            blitCheckered = true;
     1339#endif
    13491340            checkerWindow(dirtyRectT, contentsOrigin, transformation.a());
    13501341        }
     
    14541445    delete bufferPlatformGraphicsContext;
    14551446    releaseBufferDrawable(windowBuffer);
     1447#endif
     1448
     1449#if DEBUG_CHECKERBOARD
     1450    static double lastCheckeredTime = 0;
     1451
     1452    if (blitCheckered && !lastCheckeredTime) {
     1453        lastCheckeredTime = WTF::currentTime();
     1454        BlackBerry::Platform::log(BlackBerry::Platform::LogLevelCritical,
     1455            "Blitting checkered pattern at %f\n", lastCheckeredTime);
     1456    } else if (blitCheckered && lastCheckeredTime) {
     1457        BlackBerry::Platform::log(BlackBerry::Platform::LogLevelCritical,
     1458            "Blitting checkered pattern at %f\n", WTF::currentTime());
     1459    } else if (!blitCheckered && lastCheckeredTime) {
     1460        double time = WTF::currentTime();
     1461        BlackBerry::Platform::log(BlackBerry::Platform::LogLevelCritical,
     1462            "Blitting over checkered pattern at %f took %f\n", time, time - lastCheckeredTime);
     1463        lastCheckeredTime = 0;
     1464    }
    14561465#endif
    14571466
     
    17781787    RenderQueue::JobType jobType = isTileVisible(index) ? RenderQueue::VisibleScroll : RenderQueue::NonVisibleScroll;
    17791788    if (immediate)
    1780         render(updateRect, true /*renderContentOnly*/);
     1789        render(updateRect);
    17811790    else
    17821791        m_renderQueue->addToQueue(jobType, updateRect);
     
    17911800    RenderQueue::JobType jobType = isTileVisible(origin) ? RenderQueue::VisibleScroll : RenderQueue::NonVisibleScroll;
    17921801    if (immediate)
    1793         render(updateRect, true /*renderContentOnly*/);
     1802        render(updateRect);
    17941803    else
    17951804        m_renderQueue->addToQueue(jobType, updateRect);
     
    22942303
    22952304#if DEBUG_BACKINGSTORE
    2296     BlackBerry::Platform::log(BlackBerry::Platform::LogLevelCritical, "BackingStorePrivate::invalidateWindow dst = %s", dst.toString().utf8().data());
     2305    BlackBerry::Platform::log(BlackBerry::Platform::LogLevelCritical, "BackingStorePrivate::invalidateWindow dst = %s", dst.toString().c_str());
    22972306#endif
    22982307
     
    23142323
    23152324#if DEBUG_BACKINGSTORE
    2316     BlackBerry::Platform::log(BlackBerry::Platform::LogLevelCritical, "BackingStorePrivate::invalidateWindow posting = %s", dstRect.toString().utf8().data());
     2325    BlackBerry::Platform::log(BlackBerry::Platform::LogLevelCritical, "BackingStorePrivate::invalidateWindow posting = %s", dstRect.toString().c_str());
    23172326#endif
    23182327
  • trunk/Source/WebKit/blackberry/Api/BackingStore_p.h

    r102514 r102843  
    168168    void scrollBackingStore(int deltaX, int deltaY);
    169169
    170     // Render the tiles dirty rects and blit to the screen.
    171     bool renderDirectToWindow(const Platform::IntRect&, bool renderContentOnly);
    172     bool render(const Platform::IntRect&, bool renderContentOnly);
    173     bool render(const IntRectList&, bool renderContentOnly);
     170    // Render the tiles dirty rect and invalidate the screen.
     171    bool renderDirectToWindow(const Platform::IntRect&);
     172
     173    // Render the tiles dirty rect.
     174    // NOTE: This will not update the screen. To do that you should call
     175    // blitVisibleContents() after this method.
     176    bool render(const Platform::IntRect&);
    174177
    175178    // Called by the render queue to ensure that the queue is in a
     
    178181
    179182    // Helper render methods.
    180     void renderVisibleContents(bool renderContentOnly = false);
    181     void renderBackingStore(bool renderContentOnly = false);
     183    void renderVisibleContents();
     184    void renderBackingStore();
    182185    void blitVisibleContents(bool force = false);
    183186
Note: See TracChangeset for help on using the changeset viewer.