Reviewed by Dave Hyatt.
authorggaren <ggaren@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 10 Aug 2007 02:30:30 +0000 (02:30 +0000)
committerggaren <ggaren@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 10 Aug 2007 02:30:30 +0000 (02:30 +0000)
commit424ce3d82e9e8f5cd9dc93041cbf27966e827a0b
treedb1e5ce00b5fd2d10d84c46d0accc05dd0c991f0
parent2093a5d3ac8864c3ac82d97e323eeadcc822609c
    Reviewed by Dave Hyatt.

        Refactored live decoded resource eviction to be more modular /
        encapsulated.

        This fixes one known place where we forgot to hook into the live
        decoded eviction mechanism -- canvas. There might be other, unknown
        places. In a canvas test page, which I broke off from the Safari
        pageout test, I saw an RPRVT reduction of ~10MB.

        A few renames:
        - "m_lastLiveAccessTime" => "m_lastDecodedAccessTime" because the data
        point we're recording is access to the resource in decoded form.

        - "liveResourceAccessed" => "didAccessDecodedData" for the same reason.

        - "pruneAllResources" => "pruneDeadResources" because this function
        does not prune live resources.

        And the fix:
        Instead of updating cache metadata at the call site whenver drawing an
        image, just have an image notify its observer whenever it draws. The
        observer, which is a CachedResource, can then update the metadata.

        * loader/Cache.cpp: Renames
        * loader/Cache.h: Removed stale declarations, updated comments
        * loader/CachedImage.cpp:
        (WebCore::CachedImage::didDraw): Implemented didDraw to update cache
        metadata whenever our image draws.
        * loader/CachedImage.h: Grouped parts of the ImageObserver interface.
        * loader/CachedResource.cpp:
        (WebCore::CachedResource::CachedResource):
        (WebCore::CachedResource::deref):
        (WebCore::CachedResource::didAccessDecodedData): Made this function
        slightly more modular by allowing the caller to provide a time stamp.
        In theory, not all CachedResources will necessarily want to use the
        current paint time stamp.
        * platform/graphics/cg/ImageCG.cpp:
        (WebCore::BitmapImage::draw): Notify our observer that we drew.
        (WebCore::Image::drawPattern): ditto
        * platform/graphics/cg/PDFDocumentImage.cpp:
        (WebCore::PDFDocumentImage::draw): ditto
        * platform/graphics/svg/SVGImage.cpp:
        (WebCore::SVGImage::draw): ditto

        Removed old code at image drawing call sites:

        * rendering/RenderBox.cpp:
        (WebCore::RenderBox::paintBackgroundExtended):
        * rendering/RenderImage.cpp:
        (WebCore::RenderImage::paint):
        * rendering/RenderListMarker.cpp:
        (WebCore::RenderListMarker::paint):
        * rendering/RenderObject.cpp:
        (WebCore::RenderObject::paintBorderImage):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@24970 268f45cc-cd09-0410-ab3c-d52691b4dbfc
16 files changed:
WebCore/ChangeLog
WebCore/html/CanvasPattern.cpp
WebCore/loader/Cache.cpp
WebCore/loader/Cache.h
WebCore/loader/CachedImage.cpp
WebCore/loader/CachedImage.h
WebCore/loader/CachedResource.cpp
WebCore/loader/CachedResource.h
WebCore/platform/graphics/ImageObserver.h
WebCore/platform/graphics/cg/ImageCG.cpp
WebCore/platform/graphics/cg/PDFDocumentImage.cpp
WebCore/platform/graphics/svg/SVGImage.cpp
WebCore/rendering/RenderBox.cpp
WebCore/rendering/RenderImage.cpp
WebCore/rendering/RenderListMarker.cpp
WebCore/rendering/RenderObject.cpp