WebCore:
authorhyatt <hyatt@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 14 Mar 2007 08:07:59 +0000 (08:07 +0000)
committerhyatt <hyatt@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 14 Mar 2007 08:07:59 +0000 (08:07 +0000)
commit1bbd4af072a99c728fe36074a1337a4a3f5acbc1
tree0db12162fc9feabade5833ff332efb8ed7349c97
parentb57d87a0f6683f6e1ed6815d7a40c14cdba6d123
WebCore:

        Fix for bugzilla bug 13050 and also radar p1 5050645.

        This patch reworks resource loading to avoid having redundant buffers in the icon database and in cached
        images in the WebCore cache.  It also avoids overcopying in top-level image documents and in the icon
        database.

        There is now only one SharedBuffer for a resource and everybody observes that buffer now instead of ever
        making their own.  Even ImageIO uses the SharedBuffer while decoding.

        The page in 13050 dropped from 145mb down to 45mb of memory use with this change for a stunning savings
        of 100mb.

        Reviewed by olliej, mjs

        * WebCore.exp:
        * loader/CachedCSSStyleSheet.cpp:
        (WebCore::CachedCSSStyleSheet::data):
        * loader/CachedCSSStyleSheet.h:
        * loader/CachedImage.cpp:
        (WebCore::CachedImage::data):
        * loader/CachedImage.h:
        * loader/CachedResource.cpp:
        (WebCore::CachedResource::CachedResource):
        (WebCore::CachedResource::~CachedResource):
        * loader/CachedResource.h:
        (WebCore::CachedResource::data):
        * loader/CachedScript.cpp:
        (WebCore::CachedScript::data):
        * loader/CachedScript.h:
        * loader/CachedXSLStyleSheet.cpp:
        (WebCore::CachedXSLStyleSheet::data):
        * loader/CachedXSLStyleSheet.h:
        * loader/DocLoader.cpp:
        (WebCore::DocLoader::checkCacheObjectStatus):
        * loader/ImageDocument.cpp:
        (WebCore::ImageTokenizer::writeRawData):
        (WebCore::ImageTokenizer::finish):
        * loader/icon/IconDataCache.cpp:
        (WebCore::IconDataCache::setImageData):
        (WebCore::IconDataCache::writeToDatabase):
        * loader/icon/IconDataCache.h:
        * loader/icon/IconDatabase.cpp:
        (WebCore::IconDatabase::imageDataForIconURL):
        (WebCore::IconDatabase::iconForPageURL):
        (WebCore::IconDatabase::setIconDataForIconURL):
        (WebCore::IconDatabase::setHaveNoIconForIconURL):
        (WebCore::IconDatabase::imageDataForIconURLQuery):
        * loader/icon/IconDatabase.h:
        * loader/icon/IconLoader.cpp:
        (WebCore::IconLoader::startLoading):
        (WebCore::IconLoader::didReceiveResponse):
        (WebCore::IconLoader::didReceiveData):
        (WebCore::IconLoader::didFail):
        (WebCore::IconLoader::finishLoading):
        (WebCore::IconLoader::clearLoadingState):
        * loader/icon/IconLoader.h:
        * loader/icon/SQLStatement.cpp:
        (WebCore::SQLStatement::getColumnBlobAsVector):
        (WebCore::SQLStatement::isExpired):
        * loader/icon/SQLStatement.h:
        * loader/loader.cpp:
        (WebCore::Loader::didFinishLoading):
        (WebCore::Loader::didReceiveData):
        * page/mac/WebCoreFrameBridge.mm:
        (-[WebCoreFrameBridge getData:andResponse:forURL:]):
        (-[WebCoreFrameBridge getAllResourceDatas:andResponses:]):
        * platform/SharedBuffer.h:
        (WebCore::SharedBuffer::isEmpty):
        * platform/graphics/BitmapImage.cpp:
        (WebCore::BitmapImage::destroyDecodedData):
        (WebCore::BitmapImage::dataChanged):
        * platform/graphics/BitmapImage.h:
        * platform/graphics/Image.cpp:
        (WebCore::Image::setData):
        * platform/graphics/Image.h:
        (WebCore::Image::dataChanged):
        (WebCore::Image::data):
        * platform/graphics/ImageSource.h:
        * platform/graphics/cg/ImageSourceCG.cpp:
        (WebCore::ImageSource::setData):
        * platform/graphics/cg/PDFDocumentImage.cpp:
        (WebCore::PDFDocumentImage::dataChanged):
        * platform/graphics/cg/PDFDocumentImage.h:
        * platform/graphics/mac/ImageMac.mm:
        (WebCore::Image::loadPlatformResource):
        * platform/graphics/svg/SVGImage.cpp:
        (WebCore::SVGImage::setData):
        * platform/mac/PasteboardMac.mm:
        (WebCore::fileWrapperForImage):

WebKit:

        Fixes to ensure that the resource loader's shared buffer can always be used.

        Reviewed by olliej, mjs

        * Misc/WebIconDatabase.mm:
        (-[WebIconDatabase _convertToWebCoreFormat]):
        * WebCoreSupport/WebFrameLoaderClient.mm:
        (WebFrameLoaderClient::deliverArchivedResources):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@20182 268f45cc-cd09-0410-ab3c-d52691b4dbfc
40 files changed:
WebCore/ChangeLog
WebCore/WebCore.exp
WebCore/loader/CachedCSSStyleSheet.cpp
WebCore/loader/CachedCSSStyleSheet.h
WebCore/loader/CachedImage.cpp
WebCore/loader/CachedImage.h
WebCore/loader/CachedResource.cpp
WebCore/loader/CachedResource.h
WebCore/loader/CachedScript.cpp
WebCore/loader/CachedScript.h
WebCore/loader/CachedXSLStyleSheet.cpp
WebCore/loader/CachedXSLStyleSheet.h
WebCore/loader/DocLoader.cpp
WebCore/loader/ImageDocument.cpp
WebCore/loader/icon/IconDataCache.cpp
WebCore/loader/icon/IconDataCache.h
WebCore/loader/icon/IconDatabase.cpp
WebCore/loader/icon/IconDatabase.h
WebCore/loader/icon/IconLoader.cpp
WebCore/loader/icon/IconLoader.h
WebCore/loader/icon/SQLStatement.cpp
WebCore/loader/icon/SQLStatement.h
WebCore/loader/loader.cpp
WebCore/page/mac/WebCoreFrameBridge.mm
WebCore/platform/SharedBuffer.h
WebCore/platform/graphics/BitmapImage.cpp
WebCore/platform/graphics/BitmapImage.h
WebCore/platform/graphics/Image.cpp
WebCore/platform/graphics/Image.h
WebCore/platform/graphics/ImageSource.h
WebCore/platform/graphics/cg/ImageSourceCG.cpp
WebCore/platform/graphics/cg/PDFDocumentImage.cpp
WebCore/platform/graphics/cg/PDFDocumentImage.h
WebCore/platform/graphics/mac/ImageMac.mm
WebCore/platform/graphics/svg/SVGImage.cpp
WebCore/platform/graphics/svg/SVGImage.h
WebCore/platform/mac/PasteboardMac.mm
WebKit/ChangeLog
WebKit/Misc/WebIconDatabase.mm
WebKit/WebCoreSupport/WebFrameLoaderClient.mm