Changeset 206903 in webkit


Ignore:
Timestamp:
Oct 7, 2016 12:02:02 AM (7 years ago)
Author:
commit-queue@webkit.org
Message:

Refactor CachedResourceClient::notifyFinished
https://bugs.webkit.org/show_bug.cgi?id=162060

Patch by Youenn Fablet <youenn@apple.com> on 2016-10-07
Reviewed by Darin Adler.

No change of behavior.

Making CachedResourceClient and CachedRawResourceClient callbacks take CachedResource references and not pointers.
In most cases, the CachedResource parameter is only used for assertions.
Removing that parameter might be contemplated in the future.
The only real case is in RenderImage.

Removed the CachedResource parameter from ContentFilter methods as code was calling these methods with null values.

  • dom/LoadableClassicScript.cpp:

(WebCore::LoadableClassicScript::notifyFinished):

  • dom/LoadableClassicScript.h:
  • html/HTMLImageLoader.cpp:

(WebCore::HTMLImageLoader::notifyFinished):

  • html/HTMLImageLoader.h:
  • loader/ContentFilter.cpp:

(WebCore::ContentFilter::continueAfterResponseReceived):
(WebCore::ContentFilter::continueAfterDataReceived):
(WebCore::ContentFilter::continueAfterNotifyFinished):
(WebCore::ContentFilter::deliverResourceData):

  • loader/ContentFilter.h:
  • loader/CrossOriginPreflightChecker.cpp:

(WebCore::CrossOriginPreflightChecker::notifyFinished):

  • loader/CrossOriginPreflightChecker.h:
  • loader/DocumentLoader.cpp:

(WebCore::DocumentLoader::notifyFinished):
(WebCore::DocumentLoader::handleSubstituteDataLoadNow):
(WebCore::DocumentLoader::redirectReceived):
(WebCore::DocumentLoader::responseReceived):
(WebCore::DocumentLoader::continueAfterContentPolicy):
(WebCore::DocumentLoader::dataReceived):

  • loader/DocumentLoader.h:
  • loader/DocumentThreadableLoader.cpp:

(WebCore::DocumentThreadableLoader::redirectReceived):
(WebCore::DocumentThreadableLoader::dataSent):
(WebCore::DocumentThreadableLoader::responseReceived):
(WebCore::DocumentThreadableLoader::dataReceived):
(WebCore::DocumentThreadableLoader::notifyFinished):

  • loader/DocumentThreadableLoader.h:
  • loader/ImageLoader.cpp:

(WebCore::ImageLoader::notifyFinished):

  • loader/ImageLoader.h:
  • loader/LinkLoader.cpp:

(WebCore::LinkLoader::triggerEvents):
(WebCore::LinkLoader::notifyFinished):

  • loader/LinkLoader.h:
  • loader/LinkPreloadResourceClients.cpp:

(WebCore::LinkPreloadResourceClient::triggerEvents):

  • loader/LinkPreloadResourceClients.h:
  • loader/MediaResourceLoader.cpp:

(WebCore::MediaResource::responseReceived):
(WebCore::MediaResource::shouldCacheResponse):
(WebCore::MediaResource::redirectReceived):
(WebCore::MediaResource::dataSent):
(WebCore::MediaResource::dataReceived):
(WebCore::MediaResource::notifyFinished):
(WebCore::MediaResource::getOrCreateReadBuffer):

  • loader/MediaResourceLoader.h:
  • loader/TextTrackLoader.cpp:

(WebCore::TextTrackLoader::processNewCueData):
(WebCore::TextTrackLoader::deprecatedDidReceiveCachedResource):
(WebCore::TextTrackLoader::notifyFinished):

  • loader/TextTrackLoader.h:
  • loader/cache/CachedRawResource.cpp:

(WebCore::CachedRawResource::notifyClientsDataWasReceived):
(WebCore::CachedRawResource::didAddClient):
(WebCore::CachedRawResource::redirectReceived):
(WebCore::CachedRawResource::responseReceived):
(WebCore::CachedRawResource::shouldCacheResponse):
(WebCore::CachedRawResource::didSendData):

  • loader/cache/CachedRawResourceClient.h:

(WebCore::CachedRawResourceClient::dataSent):
(WebCore::CachedRawResourceClient::responseReceived):
(WebCore::CachedRawResourceClient::shouldCacheResponse):
(WebCore::CachedRawResourceClient::dataReceived):
(WebCore::CachedRawResourceClient::redirectReceived):
(WebCore::CachedRawResourceClient::getOrCreateReadBuffer):

  • loader/cache/CachedResource.cpp:

(WebCore::CachedResource::checkNotify):
(WebCore::CachedResource::didAddClient):

  • loader/cache/CachedResourceClient.h:

(WebCore::CachedResourceClient::notifyFinished):
(WebCore::CachedResourceClient::deprecatedDidReceiveCachedResource):

  • loader/cache/CachedTextTrack.cpp:

(WebCore::CachedTextTrack::updateData):

  • loader/icon/IconLoader.cpp:

(WebCore::IconLoader::notifyFinished):

  • loader/icon/IconLoader.h:
  • loader/soup/CachedRawResourceSoup.cpp:
  • platform/graphics/avfoundation/cf/WebCoreAVCFResourceLoader.cpp:

(WebCore::WebCoreAVCFResourceLoader::responseReceived):
(WebCore::WebCoreAVCFResourceLoader::dataReceived):
(WebCore::WebCoreAVCFResourceLoader::notifyFinished):
(WebCore::WebCoreAVCFResourceLoader::fulfillRequestWithResource):

  • platform/graphics/avfoundation/cf/WebCoreAVCFResourceLoader.h:
  • platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.h:
  • platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.mm:

(WebCore::WebCoreAVFResourceLoader::responseReceived):
(WebCore::WebCoreAVFResourceLoader::dataReceived):
(WebCore::WebCoreAVFResourceLoader::notifyFinished):
(WebCore::WebCoreAVFResourceLoader::fulfillRequestWithResource):

  • rendering/RenderImage.cpp:

(WebCore::RenderImage::notifyFinished):

  • rendering/RenderImage.h:
  • rendering/RenderLayerFilterInfo.cpp:

(WebCore::RenderLayer::FilterInfo::setRenderer):
(WebCore::RenderLayer::FilterInfo::notifyFinished):

  • rendering/RenderLayerFilterInfo.h:
  • svg/SVGFEImageElement.cpp:

(WebCore::SVGFEImageElement::notifyFinished):

  • svg/SVGFEImageElement.h:
  • svg/SVGUseElement.cpp:

(WebCore::SVGUseElement::notifyFinished):

  • svg/SVGUseElement.h:
  • xml/parser/XMLDocumentParser.cpp:

(WebCore::XMLDocumentParser::notifyFinished):

  • xml/parser/XMLDocumentParser.h:
Location:
trunk/Source/WebCore
Files:
45 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r206902 r206903  
     12016-10-07  Youenn Fablet  <youenn@apple.com>
     2
     3        Refactor CachedResourceClient::notifyFinished
     4        https://bugs.webkit.org/show_bug.cgi?id=162060
     5
     6        Reviewed by Darin Adler.
     7
     8        No change of behavior.
     9
     10        Making CachedResourceClient and CachedRawResourceClient callbacks take CachedResource references and not pointers.
     11        In most cases, the CachedResource parameter is only used for assertions.
     12        Removing that parameter might be contemplated in the future.
     13        The only real case is in RenderImage.
     14
     15        Removed the CachedResource parameter from ContentFilter methods as code was calling these methods with null values.
     16
     17        * dom/LoadableClassicScript.cpp:
     18        (WebCore::LoadableClassicScript::notifyFinished):
     19        * dom/LoadableClassicScript.h:
     20        * html/HTMLImageLoader.cpp:
     21        (WebCore::HTMLImageLoader::notifyFinished):
     22        * html/HTMLImageLoader.h:
     23        * loader/ContentFilter.cpp:
     24        (WebCore::ContentFilter::continueAfterResponseReceived):
     25        (WebCore::ContentFilter::continueAfterDataReceived):
     26        (WebCore::ContentFilter::continueAfterNotifyFinished):
     27        (WebCore::ContentFilter::deliverResourceData):
     28        * loader/ContentFilter.h:
     29        * loader/CrossOriginPreflightChecker.cpp:
     30        (WebCore::CrossOriginPreflightChecker::notifyFinished):
     31        * loader/CrossOriginPreflightChecker.h:
     32        * loader/DocumentLoader.cpp:
     33        (WebCore::DocumentLoader::notifyFinished):
     34        (WebCore::DocumentLoader::handleSubstituteDataLoadNow):
     35        (WebCore::DocumentLoader::redirectReceived):
     36        (WebCore::DocumentLoader::responseReceived):
     37        (WebCore::DocumentLoader::continueAfterContentPolicy):
     38        (WebCore::DocumentLoader::dataReceived):
     39        * loader/DocumentLoader.h:
     40        * loader/DocumentThreadableLoader.cpp:
     41        (WebCore::DocumentThreadableLoader::redirectReceived):
     42        (WebCore::DocumentThreadableLoader::dataSent):
     43        (WebCore::DocumentThreadableLoader::responseReceived):
     44        (WebCore::DocumentThreadableLoader::dataReceived):
     45        (WebCore::DocumentThreadableLoader::notifyFinished):
     46        * loader/DocumentThreadableLoader.h:
     47        * loader/ImageLoader.cpp:
     48        (WebCore::ImageLoader::notifyFinished):
     49        * loader/ImageLoader.h:
     50        * loader/LinkLoader.cpp:
     51        (WebCore::LinkLoader::triggerEvents):
     52        (WebCore::LinkLoader::notifyFinished):
     53        * loader/LinkLoader.h:
     54        * loader/LinkPreloadResourceClients.cpp:
     55        (WebCore::LinkPreloadResourceClient::triggerEvents):
     56        * loader/LinkPreloadResourceClients.h:
     57        * loader/MediaResourceLoader.cpp:
     58        (WebCore::MediaResource::responseReceived):
     59        (WebCore::MediaResource::shouldCacheResponse):
     60        (WebCore::MediaResource::redirectReceived):
     61        (WebCore::MediaResource::dataSent):
     62        (WebCore::MediaResource::dataReceived):
     63        (WebCore::MediaResource::notifyFinished):
     64        (WebCore::MediaResource::getOrCreateReadBuffer):
     65        * loader/MediaResourceLoader.h:
     66        * loader/TextTrackLoader.cpp:
     67        (WebCore::TextTrackLoader::processNewCueData):
     68        (WebCore::TextTrackLoader::deprecatedDidReceiveCachedResource):
     69        (WebCore::TextTrackLoader::notifyFinished):
     70        * loader/TextTrackLoader.h:
     71        * loader/cache/CachedRawResource.cpp:
     72        (WebCore::CachedRawResource::notifyClientsDataWasReceived):
     73        (WebCore::CachedRawResource::didAddClient):
     74        (WebCore::CachedRawResource::redirectReceived):
     75        (WebCore::CachedRawResource::responseReceived):
     76        (WebCore::CachedRawResource::shouldCacheResponse):
     77        (WebCore::CachedRawResource::didSendData):
     78        * loader/cache/CachedRawResourceClient.h:
     79        (WebCore::CachedRawResourceClient::dataSent):
     80        (WebCore::CachedRawResourceClient::responseReceived):
     81        (WebCore::CachedRawResourceClient::shouldCacheResponse):
     82        (WebCore::CachedRawResourceClient::dataReceived):
     83        (WebCore::CachedRawResourceClient::redirectReceived):
     84        (WebCore::CachedRawResourceClient::getOrCreateReadBuffer):
     85        * loader/cache/CachedResource.cpp:
     86        (WebCore::CachedResource::checkNotify):
     87        (WebCore::CachedResource::didAddClient):
     88        * loader/cache/CachedResourceClient.h:
     89        (WebCore::CachedResourceClient::notifyFinished):
     90        (WebCore::CachedResourceClient::deprecatedDidReceiveCachedResource):
     91        * loader/cache/CachedTextTrack.cpp:
     92        (WebCore::CachedTextTrack::updateData):
     93        * loader/icon/IconLoader.cpp:
     94        (WebCore::IconLoader::notifyFinished):
     95        * loader/icon/IconLoader.h:
     96        * loader/soup/CachedRawResourceSoup.cpp:
     97        * platform/graphics/avfoundation/cf/WebCoreAVCFResourceLoader.cpp:
     98        (WebCore::WebCoreAVCFResourceLoader::responseReceived):
     99        (WebCore::WebCoreAVCFResourceLoader::dataReceived):
     100        (WebCore::WebCoreAVCFResourceLoader::notifyFinished):
     101        (WebCore::WebCoreAVCFResourceLoader::fulfillRequestWithResource):
     102        * platform/graphics/avfoundation/cf/WebCoreAVCFResourceLoader.h:
     103        * platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.h:
     104        * platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.mm:
     105        (WebCore::WebCoreAVFResourceLoader::responseReceived):
     106        (WebCore::WebCoreAVFResourceLoader::dataReceived):
     107        (WebCore::WebCoreAVFResourceLoader::notifyFinished):
     108        (WebCore::WebCoreAVFResourceLoader::fulfillRequestWithResource):
     109        * rendering/RenderImage.cpp:
     110        (WebCore::RenderImage::notifyFinished):
     111        * rendering/RenderImage.h:
     112        * rendering/RenderLayerFilterInfo.cpp:
     113        (WebCore::RenderLayer::FilterInfo::setRenderer):
     114        (WebCore::RenderLayer::FilterInfo::notifyFinished):
     115        * rendering/RenderLayerFilterInfo.h:
     116        * svg/SVGFEImageElement.cpp:
     117        (WebCore::SVGFEImageElement::notifyFinished):
     118        * svg/SVGFEImageElement.h:
     119        * svg/SVGUseElement.cpp:
     120        (WebCore::SVGUseElement::notifyFinished):
     121        * svg/SVGUseElement.h:
     122        * xml/parser/XMLDocumentParser.cpp:
     123        (WebCore::XMLDocumentParser::notifyFinished):
     124        * xml/parser/XMLDocumentParser.h:
     125
    11262016-10-06  Youenn Fablet  <youenn@apple.com>
    2127
  • trunk/Source/WebCore/dom/LoadableClassicScript.cpp

    r206867 r206903  
    6868}
    6969
    70 void LoadableClassicScript::notifyFinished(CachedResource* resource)
     70void LoadableClassicScript::notifyFinished(CachedResource& resource)
    7171{
    72     ASSERT(resource);
    73     if (resource->resourceError().isAccessControl()) {
     72    if (resource.resourceError().isAccessControl()) {
    7473        static NeverDestroyed<String> consoleMessage(ASCIILiteral("Cross-origin script load denied by Cross-Origin Resource Sharing policy."));
    7574        m_error = Error {
  • trunk/Source/WebCore/dom/LoadableClassicScript.h

    r205854 r206903  
    5656    LoadableClassicScript(CachedResourceHandle<CachedScript>&& cachedScript) : m_cachedScript(WTFMove(cachedScript)) { }
    5757
    58     void notifyFinished(CachedResource*) override;
     58    void notifyFinished(CachedResource&) final;
    5959
    6060    CachedResourceHandle<CachedScript> m_cachedScript;
  • trunk/Source/WebCore/html/HTMLImageLoader.cpp

    r182266 r206903  
    7474}
    7575
    76 void HTMLImageLoader::notifyFinished(CachedResource*)
     76void HTMLImageLoader::notifyFinished(CachedResource&)
    7777{
    78     CachedImage* cachedImage = image();
     78    ASSERT(image());
     79    CachedImage& cachedImage = *image();
    7980
    8081    Ref<Element> protect(element());
    8182    ImageLoader::notifyFinished(cachedImage);
    8283
    83     bool loadError = cachedImage->errorOccurred() || cachedImage->response().httpStatusCode() >= 400;
     84    bool loadError = cachedImage.errorOccurred() || cachedImage.response().httpStatusCode() >= 400;
    8485    if (!loadError) {
    8586        if (!element().inDocument()) {
     
    8889            // FIXME: Adopt reportExtraMemoryVisited, and switch to reportExtraMemoryAllocated.
    8990            // https://bugs.webkit.org/show_bug.cgi?id=142595
    90             vm.heap.deprecatedReportExtraMemory(cachedImage->encodedSize());
     91            vm.heap.deprecatedReportExtraMemory(cachedImage.encodedSize());
    9192        }
    9293    }
  • trunk/Source/WebCore/html/HTMLImageLoader.h

    r197563 r206903  
    2121 */
    2222
    23 #ifndef HTMLImageLoader_h
    24 #define HTMLImageLoader_h
     23#pragma once
    2524
    2625#include "ImageLoader.h"
     
    3635    String sourceURI(const AtomicString&) const override;
    3736
    38     void notifyFinished(CachedResource*) override;
     37    void notifyFinished(CachedResource&) final;
    3938};
    4039
    4140}
    42 
    43 #endif
  • trunk/Source/WebCore/loader/ContentFilter.cpp

    r203003 r206903  
    134134}
    135135
    136 bool ContentFilter::continueAfterResponseReceived(CachedResource* resource, const ResourceResponse& response)
    137 {
    138     ASSERT_UNUSED(resource, resource == m_mainResource);
     136bool ContentFilter::continueAfterResponseReceived(const ResourceResponse& response)
     137{
    139138    Ref<DocumentLoader> protectedDocumentLoader { m_documentLoader };
    140139
     
    149148}
    150149
    151 bool ContentFilter::continueAfterDataReceived(CachedResource* resource, const char* data, int length)
    152 {
    153     ASSERT(resource == m_mainResource);
     150bool ContentFilter::continueAfterDataReceived(const char* data, int length)
     151{
    154152    Ref<DocumentLoader> protectedDocumentLoader { m_documentLoader };
    155153
    156154    if (m_state == State::Filtering) {
    157         LOG(ContentFiltering, "ContentFilter received %d bytes of data from <%s>.\n", length, resource->url().string().ascii().data());
     155        LOG(ContentFiltering, "ContentFilter received %d bytes of data from <%s>.\n", length, m_mainResource->url().string().ascii().data());
    158156        forEachContentFilterUntilBlocked([data, length](PlatformContentFilter& contentFilter) {
    159157            contentFilter.addData(data, length);
     
    161159
    162160        if (m_state == State::Allowed)
    163             deliverResourceData(*resource);
     161            deliverResourceData(*m_mainResource);
    164162        return false;
    165163    }
     
    168166}
    169167
    170 bool ContentFilter::continueAfterNotifyFinished(CachedResource* resource)
    171 {
    172     ASSERT(resource == m_mainResource);
     168bool ContentFilter::continueAfterNotifyFinished(CachedResource& resource)
     169{
     170    ASSERT_UNUSED(resource, &resource == m_mainResource);
    173171    Ref<DocumentLoader> protectedDocumentLoader { m_documentLoader };
    174172
    175     if (resource->errorOccurred())
     173    if (m_mainResource->errorOccurred())
    176174        return true;
    177175
    178176    if (m_state == State::Filtering) {
    179         LOG(ContentFiltering, "ContentFilter will finish filtering main resource at <%s>.\n", resource->url().string().ascii().data());
     177        LOG(ContentFiltering, "ContentFilter will finish filtering main resource at <%s>.\n", m_mainResource->url().string().ascii().data());
    180178        forEachContentFilterUntilBlocked([](PlatformContentFilter& contentFilter) {
    181179            contentFilter.finishedAddingData();
     
    184182        if (m_state != State::Blocked) {
    185183            m_state = State::Allowed;
    186             deliverResourceData(*resource);
     184            deliverResourceData(*m_mainResource);
    187185        }
    188186
     
    251249    ASSERT(resource.dataBufferingPolicy() == BufferData);
    252250    if (auto* resourceBuffer = resource.resourceBuffer())
    253         m_documentLoader.dataReceived(&resource, resourceBuffer->data(), resourceBuffer->size());
     251        m_documentLoader.dataReceived(resource, resourceBuffer->data(), resourceBuffer->size());
    254252}
    255253
  • trunk/Source/WebCore/loader/ContentFilter.h

    r203003 r206903  
    5858
    5959    bool continueAfterWillSendRequest(ResourceRequest&, const ResourceResponse&);
    60     bool continueAfterResponseReceived(CachedResource*, const ResourceResponse&);
    61     bool continueAfterDataReceived(CachedResource*, const char* data, int length);
    62     bool continueAfterNotifyFinished(CachedResource*);
     60    bool continueAfterResponseReceived(const ResourceResponse&);
     61    bool continueAfterDataReceived(const char* data, int length);
     62    bool continueAfterNotifyFinished(CachedResource&);
    6363
    6464    static bool continueAfterSubstituteDataRequest(const DocumentLoader& activeLoader, const SubstituteData&);
  • trunk/Source/WebCore/loader/CrossOriginPreflightChecker.cpp

    r206867 r206903  
    8787}
    8888
    89 void CrossOriginPreflightChecker::notifyFinished(CachedResource* resource)
     89void CrossOriginPreflightChecker::notifyFinished(CachedResource& resource)
    9090{
    91     ASSERT_UNUSED(resource, resource == m_resource);
     91    ASSERT_UNUSED(resource, &resource == m_resource);
    9292    if (m_resource->loadFailedOrCanceled()) {
    9393        ResourceError preflightError = m_resource->resourceError();
  • trunk/Source/WebCore/loader/CrossOriginPreflightChecker.h

    r202336 r206903  
    5454
    5555private:
    56     void notifyFinished(CachedResource*) final;
     56    void notifyFinished(CachedResource&) final;
    5757
    5858    static void handleLoadingFailure(DocumentThreadableLoader&, unsigned long, const ResourceError&);
  • trunk/Source/WebCore/loader/DocumentLoader.cpp

    r206867 r206903  
    374374}
    375375
    376 void DocumentLoader::notifyFinished(CachedResource* resource)
     376void DocumentLoader::notifyFinished(CachedResource& resource)
    377377{
    378378#if ENABLE(CONTENT_FILTERING)
     
    381381#endif
    382382
    383     ASSERT_UNUSED(resource, m_mainResource == resource);
     383    ASSERT_UNUSED(resource, m_mainResource == &resource);
    384384    ASSERT(m_mainResource);
    385385    if (!m_mainResource->errorOccurred() && !m_mainResource->wasCanceled()) {
     
    472472        response = ResourceResponse(m_request.url(), m_substituteData.mimeType(), m_substituteData.content()->size(), m_substituteData.textEncoding());
    473473
    474     responseReceived(0, response);
     474    responseReceived(response);
    475475}
    476476
     
    493493}
    494494
    495 void DocumentLoader::redirectReceived(CachedResource* resource, ResourceRequest& request, const ResourceResponse& redirectResponse)
    496 {
    497     ASSERT_UNUSED(resource, resource == m_mainResource);
     495void DocumentLoader::redirectReceived(CachedResource& resource, ResourceRequest& request, const ResourceResponse& redirectResponse)
     496{
     497    ASSERT_UNUSED(resource, &resource == m_mainResource);
    498498    willSendRequest(request, redirectResponse);
    499499}
     
    633633}
    634634
    635 void DocumentLoader::responseReceived(CachedResource* resource, const ResourceResponse& response)
     635void DocumentLoader::responseReceived(CachedResource& resource, const ResourceResponse& response)
     636{
     637    ASSERT_UNUSED(resource, m_mainResource == &resource);
     638    responseReceived(response);
     639}
     640
     641void DocumentLoader::responseReceived(const ResourceResponse& response)
    636642{
    637643#if ENABLE(CONTENT_FILTERING)
    638     if (m_contentFilter && !m_contentFilter->continueAfterResponseReceived(resource, response))
    639         return;
    640 #endif
    641 
    642     ASSERT_UNUSED(resource, m_mainResource == resource);
     644    if (m_contentFilter && !m_contentFilter->continueAfterResponseReceived(response))
     645        return;
     646#endif
     647
    643648    Ref<DocumentLoader> protectedThis(*this);
    644649    bool willLoadFallback = m_applicationCacheHost->maybeLoadFallbackForMainResponse(request(), response);
     
    822827        auto content = m_substituteData.content();
    823828        if (content && content->size())
    824             dataReceived(nullptr, content->data(), content->size());
     829            dataReceived(content->data(), content->size());
    825830        if (isLoadingMainResource())
    826831            finishedLoading(0);
     
    930935}
    931936
    932 void DocumentLoader::dataReceived(CachedResource* resource, const char* data, int length)
     937void DocumentLoader::dataReceived(CachedResource& resource, const char* data, int length)
     938{
     939    ASSERT_UNUSED(resource, &resource == m_mainResource);
     940    dataReceived(data, length);
     941}
     942
     943void DocumentLoader::dataReceived(const char* data, int length)
    933944{
    934945#if ENABLE(CONTENT_FILTERING)
    935     if (m_contentFilter && !m_contentFilter->continueAfterDataReceived(resource, data, length))
     946    if (m_contentFilter && !m_contentFilter->continueAfterDataReceived(data, length))
    936947        return;
    937948#endif
     
    939950    ASSERT(data);
    940951    ASSERT(length);
    941     ASSERT_UNUSED(resource, resource == m_mainResource);
    942952    ASSERT(!m_response.isNull());
    943953
  • trunk/Source/WebCore/loader/DocumentLoader.h

    r206189 r206903  
    317317        void finishedLoading(double finishTime);
    318318        void mainReceivedError(const ResourceError&);
    319         WEBCORE_EXPORT void redirectReceived(CachedResource*, ResourceRequest&, const ResourceResponse&) override;
    320         WEBCORE_EXPORT void responseReceived(CachedResource*, const ResourceResponse&) override;
    321         WEBCORE_EXPORT void dataReceived(CachedResource*, const char* data, int length) override;
    322         WEBCORE_EXPORT void notifyFinished(CachedResource*) override;
     319        WEBCORE_EXPORT void redirectReceived(CachedResource&, ResourceRequest&, const ResourceResponse&) override;
     320        WEBCORE_EXPORT void responseReceived(CachedResource&, const ResourceResponse&) override;
     321        WEBCORE_EXPORT void dataReceived(CachedResource&, const char* data, int length) override;
     322        WEBCORE_EXPORT void notifyFinished(CachedResource&) override;
     323
     324        void responseReceived(const ResourceResponse&);
     325        void dataReceived(const char* data, int length);
    323326
    324327        bool maybeLoadEmpty();
  • trunk/Source/WebCore/loader/DocumentThreadableLoader.cpp

    r206867 r206903  
    222222}
    223223
    224 void DocumentThreadableLoader::redirectReceived(CachedResource* resource, ResourceRequest& request, const ResourceResponse& redirectResponse)
    225 {
    226     ASSERT(m_client);
    227     ASSERT_UNUSED(resource, resource == m_resource);
     224void DocumentThreadableLoader::redirectReceived(CachedResource& resource, ResourceRequest& request, const ResourceResponse& redirectResponse)
     225{
     226    ASSERT(m_client);
     227    ASSERT_UNUSED(resource, &resource == m_resource);
    228228
    229229    Ref<DocumentThreadableLoader> protectedThis(*this);
     
    277277}
    278278
    279 void DocumentThreadableLoader::dataSent(CachedResource* resource, unsigned long long bytesSent, unsigned long long totalBytesToBeSent)
    280 {
    281     ASSERT(m_client);
    282     ASSERT_UNUSED(resource, resource == m_resource);
     279void DocumentThreadableLoader::dataSent(CachedResource& resource, unsigned long long bytesSent, unsigned long long totalBytesToBeSent)
     280{
     281    ASSERT(m_client);
     282    ASSERT_UNUSED(resource, &resource == m_resource);
    283283    m_client->didSendData(bytesSent, totalBytesToBeSent);
    284284}
    285285
    286 void DocumentThreadableLoader::responseReceived(CachedResource* resource, const ResourceResponse& response)
    287 {
    288     ASSERT_UNUSED(resource, resource == m_resource);
     286void DocumentThreadableLoader::responseReceived(CachedResource& resource, const ResourceResponse& response)
     287{
     288    ASSERT_UNUSED(resource, &resource == m_resource);
    289289    didReceiveResponse(m_resource->identifier(), response, m_resource->responseTainting());
    290290}
     
    308308}
    309309
    310 void DocumentThreadableLoader::dataReceived(CachedResource* resource, const char* data, int dataLength)
    311 {
    312     ASSERT_UNUSED(resource, resource == m_resource);
     310void DocumentThreadableLoader::dataReceived(CachedResource& resource, const char* data, int dataLength)
     311{
     312    ASSERT_UNUSED(resource, &resource == m_resource);
    313313    didReceiveData(m_resource->identifier(), data, dataLength);
    314314}
     
    321321}
    322322
    323 void DocumentThreadableLoader::notifyFinished(CachedResource* resource)
    324 {
    325     ASSERT(m_client);
    326     ASSERT_UNUSED(resource, resource == m_resource);
     323void DocumentThreadableLoader::notifyFinished(CachedResource& resource)
     324{
     325    ASSERT(m_client);
     326    ASSERT_UNUSED(resource, &resource == m_resource);
    327327
    328328    if (m_resource->errorOccurred())
  • trunk/Source/WebCore/loader/DocumentThreadableLoader.h

    r206254 r206903  
    7878
    7979        // CachedRawResourceClient
    80         void dataSent(CachedResource*, unsigned long long bytesSent, unsigned long long totalBytesToBeSent) override;
    81         void responseReceived(CachedResource*, const ResourceResponse&) override;
    82         void dataReceived(CachedResource*, const char* data, int dataLength) override;
    83         void redirectReceived(CachedResource*, ResourceRequest&, const ResourceResponse&) override;
    84         void notifyFinished(CachedResource*) override;
     80        void dataSent(CachedResource&, unsigned long long bytesSent, unsigned long long totalBytesToBeSent) override;
     81        void responseReceived(CachedResource&, const ResourceResponse&) override;
     82        void dataReceived(CachedResource&, const char* data, int dataLength) override;
     83        void redirectReceived(CachedResource&, ResourceRequest&, const ResourceResponse&) override;
     84        void notifyFinished(CachedResource&) override;
    8585
    8686        void didReceiveResponse(unsigned long identifier, const ResourceResponse&, ResourceResponse::Tainting);
  • trunk/Source/WebCore/loader/ImageLoader.cpp

    r206867 r206903  
    271271}
    272272
    273 void ImageLoader::notifyFinished(CachedResource* resource)
     273void ImageLoader::notifyFinished(CachedResource& resource)
    274274{
    275275    ASSERT(m_failedLoadURL.isEmpty());
    276     ASSERT(resource == m_image.get());
     276    ASSERT_UNUSED(resource, &resource == m_image.get());
    277277
    278278    m_imageComplete = true;
     
    283283        return;
    284284
    285     if (resource->resourceError().isAccessControl()) {
     285    if (m_image->resourceError().isAccessControl()) {
    286286        clearImageWithoutConsideringPendingLoadEvent();
    287287
     
    300300    }
    301301
    302     if (resource->wasCanceled()) {
     302    if (m_image->wasCanceled()) {
    303303        m_hasPendingLoadEvent = false;
    304304        // Only consider updating the protection ref-count of the Element immediately before returning
  • trunk/Source/WebCore/loader/ImageLoader.h

    r202278 r206903  
    2121 */
    2222
    23 #ifndef ImageLoader_h
    24 #define ImageLoader_h
     23#pragma once
    2524
    2625#include "CachedImageClient.h"
     
    7473protected:
    7574    explicit ImageLoader(Element&);
    76     void notifyFinished(CachedResource*) override;
     75    void notifyFinished(CachedResource&) override;
    7776
    7877private:
     
    108107
    109108}
    110 
    111 #endif
  • trunk/Source/WebCore/loader/LinkLoader.cpp

    r206900 r206903  
    6666}
    6767
    68 void LinkLoader::triggerEvents(const CachedResource* resource)
    69 {
    70     if (resource->errorOccurred())
     68void LinkLoader::triggerEvents(const CachedResource& resource)
     69{
     70    if (resource.errorOccurred())
    7171        m_client.linkLoadingErrored();
    7272    else
     
    7474}
    7575
    76 void LinkLoader::notifyFinished(CachedResource* resource)
    77 {
    78     ASSERT_UNUSED(resource, m_cachedLinkResource.get() == resource);
    79 
    80     triggerEvents(m_cachedLinkResource.get());
     76void LinkLoader::notifyFinished(CachedResource& resource)
     77{
     78    ASSERT_UNUSED(resource, m_cachedLinkResource.get() == &resource);
     79
     80    triggerEvents(*m_cachedLinkResource);
    8181
    8282    m_cachedLinkResource->removeClient(*this);
  • trunk/Source/WebCore/loader/LinkLoader.h

    r205269 r206903  
    3030 */
    3131
    32 #ifndef LinkLoader_h
    33 #define LinkLoader_h
     32#pragma once
    3433
    3534#include "CachedResource.h"
     
    5756
    5857    WeakPtr<LinkLoader> createWeakPtr() { return m_weakPtrFactory.createWeakPtr(); }
    59     void triggerEvents(const CachedResource*);
     58    void triggerEvents(const CachedResource&);
    6059
    6160private:
    62     void notifyFinished(CachedResource*) override;
     61    void notifyFinished(CachedResource&) override;
    6362    void preloadIfNeeded(const LinkRelAttribute&, const URL& href, Document&, const String& as, const String& crossOriginMode);
    6463
     
    6867    WeakPtrFactory<LinkLoader> m_weakPtrFactory;
    6968};
    70    
     69
    7170}
    72 
    73 #endif
  • trunk/Source/WebCore/loader/LinkPreloadResourceClients.cpp

    r205269 r206903  
    3838}
    3939
    40 void LinkPreloadResourceClient::triggerEvents(const CachedResource* resource)
     40void LinkPreloadResourceClient::triggerEvents(const CachedResource& resource)
    4141{
    4242    if (m_loader)
  • trunk/Source/WebCore/loader/LinkPreloadResourceClients.h

    r206867 r206903  
    4747    virtual ~LinkPreloadResourceClient() { }
    4848
    49     void triggerEvents(const CachedResource*);
     49    void triggerEvents(const CachedResource&);
    5050
    5151    virtual void clear() = 0;
     
    8484
    8585
    86     void notifyFinished(CachedResource* resource) override
    87     {
    88         ASSERT(ownedResource() == resource);
    89         triggerEvents(resource);
    90     }
     86    void notifyFinished(CachedResource& resource) override { triggerEvents(resource); }
    9187
    9288    void clear() override { clearResource(*this); }
     
    111107    void setCSSStyleSheet(const String&, const URL&, const String&, const CachedCSSStyleSheet* resource) override
    112108    {
     109        ASSERT(resource);
    113110        ASSERT(ownedResource() == resource);
    114         triggerEvents(resource);
     111        triggerEvents(*resource);
    115112    }
    116113
     
    134131    virtual ~LinkPreloadImageResourceClient() { }
    135132
    136     void notifyFinished(CachedResource* resource) override
    137     {
    138         ASSERT(ownedResource() == resource);
    139         triggerEvents(resource);
    140     }
     133    void notifyFinished(CachedResource& resource) override { triggerEvents(resource); }
    141134
    142135    void clear() override { clearResource(*this); }
     
    162155    {
    163156        ASSERT(ownedResource() == &resource);
    164         triggerEvents(&resource);
     157        triggerEvents(resource);
    165158    }
    166159
     
    184177    virtual ~LinkPreloadRawResourceClient() { }
    185178
    186     void notifyFinished(CachedResource* resource) override
    187     {
    188         ASSERT(ownedResource() == resource);
    189         triggerEvents(resource);
    190     }
     179    void notifyFinished(CachedResource& resource) override { triggerEvents(resource); }
    191180
    192181    void clear() override { clearResource(*this); }
  • trunk/Source/WebCore/loader/MediaResourceLoader.cpp

    r206867 r206903  
    130130}
    131131
    132 void MediaResource::responseReceived(CachedResource* resource, const ResourceResponse& response)
    133 {
    134     ASSERT_UNUSED(resource, resource == m_resource);
     132void MediaResource::responseReceived(CachedResource& resource, const ResourceResponse& response)
     133{
     134    ASSERT_UNUSED(resource, &resource == m_resource);
    135135
    136136    if (!m_loader->document())
     
    138138
    139139    RefPtr<MediaResource> protectedThis(this);
    140     if (!m_loader->crossOriginMode().isNull() && !resource->passesSameOriginPolicyCheck(*m_loader->document()->securityOrigin())) {
     140    if (!m_loader->crossOriginMode().isNull() && !m_resource->passesSameOriginPolicyCheck(*m_loader->document()->securityOrigin())) {
    141141        static NeverDestroyed<const String> consoleMessage("Cross-origin media resource load denied by Cross-Origin Resource Sharing policy.");
    142142        m_loader->document()->addConsoleMessage(MessageSource::Security, MessageLevel::Error, consoleMessage.get());
     
    153153}
    154154
    155 bool MediaResource::shouldCacheResponse(CachedResource* resource, const ResourceResponse& response)
    156 {
    157     ASSERT_UNUSED(resource, resource == m_resource);
     155bool MediaResource::shouldCacheResponse(CachedResource& resource, const ResourceResponse& response)
     156{
     157    ASSERT_UNUSED(resource, &resource == m_resource);
    158158
    159159    RefPtr<MediaResource> protectedThis(this);
     
    163163}
    164164
    165 void MediaResource::redirectReceived(CachedResource* resource, ResourceRequest& request, const ResourceResponse& response)
    166 {
    167     ASSERT_UNUSED(resource, resource == m_resource);
     165void MediaResource::redirectReceived(CachedResource& resource, ResourceRequest& request, const ResourceResponse& response)
     166{
     167    ASSERT_UNUSED(resource, &resource == m_resource);
    168168
    169169    RefPtr<MediaResource> protectedThis(this);
     
    172172}
    173173
    174 void MediaResource::dataSent(CachedResource* resource, unsigned long long bytesSent, unsigned long long totalBytesToBeSent)
    175 {
    176     ASSERT_UNUSED(resource, resource == m_resource);
     174void MediaResource::dataSent(CachedResource& resource, unsigned long long bytesSent, unsigned long long totalBytesToBeSent)
     175{
     176    ASSERT_UNUSED(resource, &resource == m_resource);
    177177
    178178    RefPtr<MediaResource> protectedThis(this);
     
    181181}
    182182
    183 void MediaResource::dataReceived(CachedResource* resource, const char* data, int dataLength)
    184 {
    185     ASSERT_UNUSED(resource, resource == m_resource);
     183void MediaResource::dataReceived(CachedResource& resource, const char* data, int dataLength)
     184{
     185    ASSERT_UNUSED(resource, &resource == m_resource);
    186186
    187187    RefPtr<MediaResource> protectedThis(this);
     
    190190}
    191191
    192 void MediaResource::notifyFinished(CachedResource* resource)
    193 {
    194     ASSERT(resource == m_resource);
     192void MediaResource::notifyFinished(CachedResource& resource)
     193{
     194    ASSERT_UNUSED(resource, &resource == m_resource);
    195195
    196196    RefPtr<MediaResource> protectedThis(this);
    197197    if (m_client) {
    198         if (resource->loadFailedOrCanceled())
    199             m_client->loadFailed(*this, resource->resourceError());
     198        if (m_resource->loadFailedOrCanceled())
     199            m_client->loadFailed(*this, m_resource->resourceError());
    200200        else
    201201            m_client->loadFinished(*this);
     
    205205
    206206#if USE(SOUP)
    207 char* MediaResource::getOrCreateReadBuffer(CachedResource* resource, size_t requestedSize, size_t& actualSize)
    208 {
    209     ASSERT_UNUSED(resource, resource == m_resource);
     207char* MediaResource::getOrCreateReadBuffer(CachedResource& resource, size_t requestedSize, size_t& actualSize)
     208{
     209    ASSERT_UNUSED(resource, &resource == m_resource);
    210210    return m_client ? m_client->getOrCreateReadBuffer(*this, requestedSize, actualSize) : nullptr;
    211211}
  • trunk/Source/WebCore/loader/MediaResourceLoader.h

    r198549 r206903  
    7171    bool didPassAccessControlCheck() const override { return m_didPassAccessControlCheck; }
    7272
    73     // CachedResourceClient
    74     void responseReceived(CachedResource*, const ResourceResponse&) override;
    75     void redirectReceived(CachedResource*, ResourceRequest&, const ResourceResponse&) override;
    76     bool shouldCacheResponse(CachedResource*, const ResourceResponse&) override;
    77     void dataSent(CachedResource*, unsigned long long, unsigned long long) override;
    78     void dataReceived(CachedResource*, const char*, int) override;
    79     void notifyFinished(CachedResource*) override;
     73    // CachedRawResourceClient
     74    void responseReceived(CachedResource&, const ResourceResponse&) override;
     75    void redirectReceived(CachedResource&, ResourceRequest&, const ResourceResponse&) override;
     76    bool shouldCacheResponse(CachedResource&, const ResourceResponse&) override;
     77    void dataSent(CachedResource&, unsigned long long, unsigned long long) override;
     78    void dataReceived(CachedResource&, const char*, int) override;
     79    void notifyFinished(CachedResource&) override;
    8080#if USE(SOUP)
    81     char* getOrCreateReadBuffer(CachedResource*, size_t /*requestedSize*/, size_t& /*actualSize*/) override;
     81    char* getOrCreateReadBuffer(CachedResource&, size_t /*requestedSize*/, size_t& /*actualSize*/) override;
    8282#endif
    8383
  • trunk/Source/WebCore/loader/TextTrackLoader.cpp

    r206867 r206903  
    7979}
    8080
    81 void TextTrackLoader::processNewCueData(CachedResource* resource)
    82 {
    83     ASSERT(m_resource == resource);
    84    
    85     if (m_state == Failed || !resource->resourceBuffer())
    86         return;
    87    
    88     auto* buffer = resource->resourceBuffer();
     81void TextTrackLoader::processNewCueData(CachedResource& resource)
     82{
     83    ASSERT_UNUSED(resource, m_resource == &resource);
     84
     85    if (m_state == Failed || !m_resource->resourceBuffer())
     86        return;
     87
     88    auto* buffer = m_resource->resourceBuffer();
    8989    if (m_parseOffset == buffer->size())
    9090        return;
     
    103103
    104104// FIXME: This is a very unusual pattern, no other CachedResourceClient does this. Refactor to use notifyFinished() instead.
    105 void TextTrackLoader::deprecatedDidReceiveCachedResource(CachedResource* resource)
    106 {
    107     ASSERT(m_resource == resource);
    108    
    109     if (!resource->resourceBuffer())
    110         return;
    111    
    112     processNewCueData(resource);
     105void TextTrackLoader::deprecatedDidReceiveCachedResource(CachedResource& resource)
     106{
     107    ASSERT_UNUSED(resource, m_resource == &resource);
     108
     109    if (!m_resource->resourceBuffer())
     110        return;
     111
     112    processNewCueData(*m_resource);
    113113}
    114114
     
    121121}
    122122
    123 void TextTrackLoader::notifyFinished(CachedResource* resource)
    124 {
    125     ASSERT(m_resource == resource);
    126 
    127     if (resource->resourceError().isAccessControl())
     123void TextTrackLoader::notifyFinished(CachedResource& resource)
     124{
     125    ASSERT_UNUSED(resource, m_resource == &resource);
     126
     127    if (m_resource->resourceError().isAccessControl())
    128128        corsPolicyPreventedLoad();
    129129
    130130    if (m_state != Failed) {
    131         processNewCueData(resource);
     131        processNewCueData(*m_resource);
    132132        if (m_cueParser)
    133133            m_cueParser->fileFinished();
    134134        if (m_state != Failed)
    135             m_state = resource->errorOccurred() ? Failed : Finished;
     135            m_state = m_resource->errorOccurred() ? Failed : Finished;
    136136    }
    137137
  • trunk/Source/WebCore/loader/TextTrackLoader.h

    r205750 r206903  
    6565
    6666    // CachedResourceClient
    67     void notifyFinished(CachedResource*) override;
    68     void deprecatedDidReceiveCachedResource(CachedResource*) override;
    69    
     67    void notifyFinished(CachedResource&) override;
     68    void deprecatedDidReceiveCachedResource(CachedResource&) override;
     69
    7070    // WebVTTParserClient
    7171    void newCuesParsed() override;
    7272    void newRegionsParsed() override;
    7373    void fileFailedToParse() override;
    74    
    75     void processNewCueData(CachedResource*);
     74
     75    void processNewCueData(CachedResource&);
    7676    void cueLoadTimerFired();
    7777    void corsPolicyPreventedLoad();
    7878
    7979    enum State { Idle, Loading, Finished, Failed };
    80    
     80
    8181    TextTrackLoaderClient& m_client;
    8282    std::unique_ptr<WebVTTParser> m_cueParser;
  • trunk/Source/WebCore/loader/cache/CachedRawResource.cpp

    r206867 r206903  
    116116    CachedResourceClientWalker<CachedRawResourceClient> w(m_clients);
    117117    while (CachedRawResourceClient* c = w.next())
    118         c->dataReceived(this, data, length);
     118        c->dataReceived(*this, data, length);
    119119}
    120120
     
    132132        RedirectPair redirect = m_redirectChain[i];
    133133        ResourceRequest request(redirect.m_request);
    134         client.redirectReceived(this, request, redirect.m_redirectResponse);
     134        client.redirectReceived(*this, request, redirect.m_redirectResponse);
    135135        if (!hasClient(c))
    136136            return;
     
    146146            response.setSource(ResourceResponse::Source::MemoryCache);
    147147        }
    148         client.responseReceived(this, response);
     148        client.responseReceived(*this, response);
    149149    }
    150150    if (!hasClient(c))
    151151        return;
    152152    if (m_data)
    153         client.dataReceived(this, m_data->data(), m_data->size());
     153        client.dataReceived(*this, m_data->data(), m_data->size());
    154154    if (!hasClient(c))
    155155       return;
     
    169169        CachedResourceClientWalker<CachedRawResourceClient> w(m_clients);
    170170        while (CachedRawResourceClient* c = w.next())
    171             c->redirectReceived(this, request, response);
     171            c->redirectReceived(*this, request, response);
    172172        m_redirectChain.append(RedirectPair(request, response));
    173173    }
     
    183183    CachedResourceClientWalker<CachedRawResourceClient> w(m_clients);
    184184    while (CachedRawResourceClient* c = w.next())
    185         c->responseReceived(this, m_response);
     185        c->responseReceived(*this, m_response);
    186186}
    187187
     
    190190    CachedResourceClientWalker<CachedRawResourceClient> w(m_clients);
    191191    while (CachedRawResourceClient* c = w.next()) {
    192         if (!c->shouldCacheResponse(this, response))
     192        if (!c->shouldCacheResponse(*this, response))
    193193            return false;
    194194    }
     
    200200    CachedResourceClientWalker<CachedRawResourceClient> w(m_clients);
    201201    while (CachedRawResourceClient* c = w.next())
    202         c->dataSent(this, bytesSent, totalBytesToBeSent);
     202        c->dataSent(*this, bytesSent, totalBytesToBeSent);
    203203}
    204204
  • trunk/Source/WebCore/loader/cache/CachedRawResourceClient.h

    r201761 r206903  
    3737    CachedResourceClientType resourceClientType() const override { return expectedType(); }
    3838
    39     virtual void dataSent(CachedResource*, unsigned long long /* bytesSent */, unsigned long long /* totalBytesToBeSent */) { }
    40     virtual void responseReceived(CachedResource*, const ResourceResponse&) { }
    41     virtual bool shouldCacheResponse(CachedResource*, const ResourceResponse&) { return true; }
    42     virtual void dataReceived(CachedResource*, const char* /* data */, int /* length */) { }
    43     virtual void redirectReceived(CachedResource*, ResourceRequest&, const ResourceResponse&) { }
     39    virtual void dataSent(CachedResource&, unsigned long long /* bytesSent */, unsigned long long /* totalBytesToBeSent */) { }
     40    virtual void responseReceived(CachedResource&, const ResourceResponse&) { }
     41    virtual bool shouldCacheResponse(CachedResource&, const ResourceResponse&) { return true; }
     42    virtual void dataReceived(CachedResource&, const char* /* data */, int /* length */) { }
     43    virtual void redirectReceived(CachedResource&, ResourceRequest&, const ResourceResponse&) { }
    4444#if USE(SOUP)
    45     virtual char* getOrCreateReadBuffer(CachedResource*, size_t /* requestedSize */, size_t& /* actualSize */) { return nullptr; }
     45    virtual char* getOrCreateReadBuffer(CachedResource&, size_t /* requestedSize */, size_t& /* actualSize */) { return nullptr; }
    4646#endif
    4747};
  • trunk/Source/WebCore/loader/cache/CachedResource.cpp

    r206902 r206903  
    374374    CachedResourceClientWalker<CachedResourceClient> walker(m_clients);
    375375    while (CachedResourceClient* client = walker.next())
    376         client->notifyFinished(this);
     376        client->notifyFinished(*this);
    377377}
    378378
     
    551551        m_clients.add(&client);
    552552    if (!isLoading() && !stillNeedsLoad())
    553         client.notifyFinished(this);
     553        client.notifyFinished(*this);
    554554}
    555555
  • trunk/Source/WebCore/loader/cache/CachedResourceClient.h

    r181480 r206903  
    2222    pages from the web. It has a memory cache for these objects.
    2323*/
    24 
    25 #ifndef CachedResourceClient_h
    26 #define CachedResourceClient_h
     24#pragma once
    2725
    2826namespace WebCore {
     
    4240
    4341    virtual ~CachedResourceClient() { }
    44     virtual void notifyFinished(CachedResource*) { }
    45     virtual void deprecatedDidReceiveCachedResource(CachedResource*) { }
     42    virtual void notifyFinished(CachedResource&) { }
     43    virtual void deprecatedDidReceiveCachedResource(CachedResource&) { }
    4644    virtual bool isXMLHttpRequest() const { return false; }
    4745
     
    5452
    5553}
    56 
    57 #endif
  • trunk/Source/WebCore/loader/cache/CachedTextTrack.cpp

    r206016 r206903  
    5151    CachedResourceClientWalker<CachedResourceClient> walker(m_clients);
    5252    while (CachedResourceClient* client = walker.next())
    53         client->deprecatedDidReceiveCachedResource(this);
     53        client->deprecatedDidReceiveCachedResource(*this);
    5454}
    5555
  • trunk/Source/WebCore/loader/icon/IconLoader.cpp

    r206867 r206903  
    8080}
    8181
    82 void IconLoader::notifyFinished(CachedResource* resource)
     82void IconLoader::notifyFinished(CachedResource& resource)
    8383{
    84     ASSERT(resource == m_resource);
     84    ASSERT_UNUSED(resource, &resource == m_resource);
    8585
    8686    // If we got a status code indicating an invalid response, then lets
    8787    // ignore the data and not try to decode the error page as an icon.
    88     auto* data = resource->resourceBuffer();
    89     int status = resource->response().httpStatusCode();
     88    auto* data = m_resource->resourceBuffer();
     89    int status = m_resource->response().httpStatusCode();
    9090    if (status && (status < 200 || status > 299))
    9191        data = nullptr;
     
    9494    static unsigned pdfMagicNumberLength = sizeof(pdfMagicNumber) - 1;
    9595    if (data && data->size() >= pdfMagicNumberLength && !memcmp(data->data(), pdfMagicNumber, pdfMagicNumberLength)) {
    96         LOG(IconDatabase, "IconLoader::finishLoading() - Ignoring icon at %s because it appears to be a PDF", resource->url().string().ascii().data());
     96        LOG(IconDatabase, "IconLoader::finishLoading() - Ignoring icon at %s because it appears to be a PDF", m_resource->url().string().ascii().data());
    9797        data = nullptr;
    9898    }
    9999
    100     LOG(IconDatabase, "IconLoader::finishLoading() - Committing iconURL %s to database", resource->url().string().ascii().data());
    101     m_frame.loader().icon().commitToDatabase(resource->url());
     100    LOG(IconDatabase, "IconLoader::finishLoading() - Committing iconURL %s to database", m_resource->url().string().ascii().data());
     101    m_frame.loader().icon().commitToDatabase(m_resource->url());
    102102    // Setting the icon data only after committing to the database ensures that the data is
    103103    // kept in memory (so it does not have to be read from the database asynchronously), since
    104104    // there is a page URL referencing it.
    105     iconDatabase().setIconDataForIconURL(data, resource->url().string());
     105    iconDatabase().setIconDataForIconURL(data, m_resource->url().string());
    106106    m_frame.loader().client().dispatchDidReceiveIcon();
    107107    stopLoading();
  • trunk/Source/WebCore/loader/icon/IconLoader.h

    r204466 r206903  
    2121 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
    2222 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
    23  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
     23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    2424 */
    2525
    26 #ifndef IconLoader_h
    27 #define IconLoader_h
     26#pragma once
    2827
    2928#include "CachedRawResourceClient.h"
     
    4746
    4847private:
    49     void notifyFinished(CachedResource*) override;
     48    void notifyFinished(CachedResource&) final;
    5049
    5150    Frame& m_frame;
     
    5453
    5554} // namespace WebCore
    56 
    57 #endif
  • trunk/Source/WebCore/loader/soup/CachedRawResourceSoup.cpp

    r191369 r206903  
    3232    CachedResourceClientWalker<CachedRawResourceClient> w(m_clients);
    3333    while (CachedRawResourceClient* c = w.next()) {
    34         if (char* bufferPtr = c->getOrCreateReadBuffer(this, requestedSize, actualSize))
     34        if (char* bufferPtr = c->getOrCreateReadBuffer(*this, requestedSize, actualSize))
    3535            return bufferPtr;
    3636    }
  • trunk/Source/WebCore/platform/graphics/avfoundation/cf/WebCoreAVCFResourceLoader.cpp

    r206867 r206903  
    110110}
    111111
    112 void WebCoreAVCFResourceLoader::responseReceived(CachedResource* resource, const ResourceResponse& response)
     112void WebCoreAVCFResourceLoader::responseReceived(CachedResource& resource, const ResourceResponse& response)
    113113{
    114     ASSERT(resource == m_resource);
    115     UNUSED_PARAM(resource);
     114    ASSERT_UNUSED(resource, &resource == m_resource);
    116115
    117116    int status = response.httpStatusCode();
     
    125124}
    126125
    127 void WebCoreAVCFResourceLoader::dataReceived(CachedResource* resource, const char*, int)
     126void WebCoreAVCFResourceLoader::dataReceived(CachedResource& resource, const char*, int)
    128127{
    129128    fulfillRequestWithResource(resource);
    130129}
    131130
    132 void WebCoreAVCFResourceLoader::notifyFinished(CachedResource* resource)
     131void WebCoreAVCFResourceLoader::notifyFinished(CachedResource& resource)
    133132{
    134     if (resource->loadFailedOrCanceled()) {
     133    if (resource.loadFailedOrCanceled()) {
    135134        // <rdar://problem/13987417> Set the contentType of the contentInformationRequest to an empty
    136135        // string to trigger AVAsset's playable value to complete loading.
     
    149148}
    150149
    151 void WebCoreAVCFResourceLoader::fulfillRequestWithResource(CachedResource* resource)
     150void WebCoreAVCFResourceLoader::fulfillRequestWithResource(CachedResource& resource)
    152151{
    153     ASSERT(resource == m_resource);
     152    ASSERT_UNUSED(resource, &resource == m_resource);
    154153    notImplemented();
    155154}
  • trunk/Source/WebCore/platform/graphics/avfoundation/cf/WebCoreAVCFResourceLoader.h

    r197563 r206903  
    2424 */
    2525
    26 #ifndef WebCoreAVCFResourceLoader_h
    27 #define WebCoreAVCFResourceLoader_h
     26#pragma once
    2827
    2928#if ENABLE(VIDEO) && USE(AVFOUNDATION) && HAVE(AVFOUNDATION_LOADER_DELEGATE)
     
    5756
    5857private:
    59     // CachedResourceClient
    60     void responseReceived(CachedResource*, const ResourceResponse&) override;
    61     void dataReceived(CachedResource*, const char*, int) override;
    62     void notifyFinished(CachedResource*) override;
     58    // CachedRawResourceClient
     59    void responseReceived(CachedResource&, const ResourceResponse&) override;
     60    void dataReceived(CachedResource&, const char*, int) override;
     61    void notifyFinished(CachedResource&) override;
    6362
    64     void fulfillRequestWithResource(CachedResource*);
     63    void fulfillRequestWithResource(CachedResource&);
    6564
    6665    WebCoreAVCFResourceLoader(MediaPlayerPrivateAVFoundationCF* parent, AVCFAssetResourceLoadingRequestRef);
     
    7271}
    7372
    74 #endif // ENABLE(VIDEO) && USE(AVFOUNDATION)
    75 
    76 #endif // WebCoreAVFResourceLoader_h
     73#endif // ENABLE(VIDEO) && USE(AVFOUNDATION)
  • trunk/Source/WebCore/platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.h

    r197563 r206903  
    2424 */
    2525
    26 #ifndef WebCoreAVFResourceLoader_h
    27 #define WebCoreAVFResourceLoader_h
     26#pragma once
    2827
    2928#if ENABLE(VIDEO) && USE(AVFOUNDATION) && HAVE(AVFOUNDATION_LOADER_DELEGATE)
     
    5857private:
    5958    // CachedResourceClient
    60     void responseReceived(CachedResource*, const ResourceResponse&) override;
    61     void dataReceived(CachedResource*, const char*, int) override;
    62     void notifyFinished(CachedResource*) override;
     59    void responseReceived(CachedResource&, const ResourceResponse&) override;
     60    void dataReceived(CachedResource&, const char*, int) override;
     61    void notifyFinished(CachedResource&) override;
    6362
    64     void fulfillRequestWithResource(CachedResource*);
     63    void fulfillRequestWithResource(CachedResource&);
    6564
    6665    WebCoreAVFResourceLoader(MediaPlayerPrivateAVFoundationObjC* parent, AVAssetResourceLoadingRequest *);
     
    7271}
    7372
    74 #endif // ENABLE(VIDEO) && USE(AVFOUNDATION)
    75 
    76 #endif // WebCoreAVFResourceLoader_h
     73#endif // ENABLE(VIDEO) && USE(AVFOUNDATION)
  • trunk/Source/WebCore/platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.mm

    r206867 r206903  
    107107}
    108108
    109 void WebCoreAVFResourceLoader::responseReceived(CachedResource* resource, const ResourceResponse& response)
    110 {
    111     ASSERT(resource);
    112     ASSERT(resource == m_resource);
     109void WebCoreAVFResourceLoader::responseReceived(CachedResource& resource, const ResourceResponse& response)
     110{
     111    ASSERT_UNUSED(resource, &resource == m_resource);
    113112
    114113    int status = response.httpStatusCode();
     
    123122        [contentInfo setContentType:uti];
    124123
    125         ParsedContentRange& contentRange = resource->response().contentRange();
     124        ParsedContentRange& contentRange = m_resource->response().contentRange();
    126125        [contentInfo setContentLength:contentRange.isValid() ? contentRange.instanceLength() : response.expectedContentLength()];
    127126        [contentInfo setByteRangeAccessSupported:YES];
     
    134133}
    135134
    136 void WebCoreAVFResourceLoader::dataReceived(CachedResource* resource, const char*, int)
     135void WebCoreAVFResourceLoader::dataReceived(CachedResource& resource, const char*, int)
    137136{
    138137    fulfillRequestWithResource(resource);
    139138}
    140139
    141 void WebCoreAVFResourceLoader::notifyFinished(CachedResource* resource)
    142 {
    143     if (resource->loadFailedOrCanceled()) {
     140void WebCoreAVFResourceLoader::notifyFinished(CachedResource& resource)
     141{
     142    if (resource.loadFailedOrCanceled()) {
    144143        // <rdar://problem/13987417> Set the contentType of the contentInformationRequest to an empty
    145144        // string to trigger AVAsset's playable value to complete loading.
     
    147146            [[m_avRequest.get() contentInformationRequest] setContentType:@""];
    148147
    149         NSError* error = resource->errorOccurred() ? resource->resourceError().nsError() : nil;
     148        NSError* error = resource.errorOccurred() ? resource.resourceError().nsError() : nil;
    150149        [m_avRequest.get() finishLoadingWithError:error];
    151150    } else {
     
    156155}
    157156
    158 void WebCoreAVFResourceLoader::fulfillRequestWithResource(CachedResource* resource)
    159 {
    160     ASSERT(resource);
    161     ASSERT(resource == m_resource);
     157void WebCoreAVFResourceLoader::fulfillRequestWithResource(CachedResource& resource)
     158{
     159    ASSERT_UNUSED(resource, &resource == m_resource);
    162160    AVAssetResourceLoadingDataRequest* dataRequest = [m_avRequest dataRequest];
    163161    if (!dataRequest)
    164162        return;
    165163
    166     SharedBuffer* data = resource->resourceBuffer();
     164    SharedBuffer* data = m_resource->resourceBuffer();
    167165    if (!data)
    168166        return;
    169167
    170168    NSUInteger responseOffset = 0;
    171     ParsedContentRange contentRange = resource->response().contentRange();
     169    ParsedContentRange contentRange = m_resource->response().contentRange();
    172170    if (contentRange.isValid())
    173171        responseOffset = static_cast<NSUInteger>(contentRange.firstBytePosition());
  • trunk/Source/WebCore/rendering/RenderImage.cpp

    r205818 r206903  
    339339}
    340340
    341 void RenderImage::notifyFinished(CachedResource* newImage)
     341void RenderImage::notifyFinished(CachedResource& newImage)
    342342{
    343343    if (documentBeingDestroyed())
     
    346346    invalidateBackgroundObscurationStatus();
    347347
    348     if (newImage == imageResource().cachedImage()) {
     348    if (&newImage == imageResource().cachedImage()) {
    349349        // tell any potential compositing layers
    350350        // that the image is done and they can reference it directly.
  • trunk/Source/WebCore/rendering/RenderImage.h

    r205701 r206903  
    2323 */
    2424
    25 #ifndef RenderImage_h
    26 #define RenderImage_h
     25#pragma once
    2726
    2827#include "RenderImageResource.h"
     
    106105    LayoutUnit minimumReplacedHeight() const override;
    107106
    108     void notifyFinished(CachedResource*) final;
     107    void notifyFinished(CachedResource&) final;
    109108    bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAction) final;
    110109
     
    138137
    139138SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT(RenderImage, isRenderImage())
    140 
    141 #endif // RenderImage_h
  • trunk/Source/WebCore/rendering/RenderLayerFilterInfo.cpp

    r206867 r206903  
    8484
    8585void RenderLayer::FilterInfo::setRenderer(RefPtr<FilterEffectRenderer>&& renderer)
    86 { 
    87     m_renderer = renderer; 
     86{
     87    m_renderer = renderer;
    8888}
    8989
    90 void RenderLayer::FilterInfo::notifyFinished(CachedResource*)
     90void RenderLayer::FilterInfo::notifyFinished(CachedResource&)
    9191{
    9292    m_layer.filterNeedsRepaint();
  • trunk/Source/WebCore/rendering/RenderLayerFilterInfo.h

    r197563 r206903  
    2929 */
    3030
    31 #ifndef RenderLayerFilterInfo_h
    32 #define RenderLayerFilterInfo_h
     31#pragma once
    3332
    3433#include "CachedResourceHandle.h"
     
    5655    void expandDirtySourceRect(const LayoutRect& rect) { m_dirtySourceRect.unite(rect); }
    5756    void resetDirtySourceRect() { m_dirtySourceRect = LayoutRect(); }
    58    
     57
    5958    FilterEffectRenderer* renderer() const { return m_renderer.get(); }
    6059    void setRenderer(RefPtr<FilterEffectRenderer>&&);
    61    
     60
    6261    void updateReferenceFilterClients(const FilterOperations&);
    6362    void removeReferenceFilterClients();
    6463
    6564private:
    66     void notifyFinished(CachedResource*) override;
     65    void notifyFinished(CachedResource&) final;
    6766
    6867    static HashMap<const RenderLayer*, std::unique_ptr<FilterInfo>>& map();
     
    7877
    7978} // namespace WebCore
    80 
    81 #endif // RenderLayerFilterInfo_h
  • trunk/Source/WebCore/svg/SVGFEImageElement.cpp

    r206867 r206903  
    170170}
    171171
    172 void SVGFEImageElement::notifyFinished(CachedResource*)
     172void SVGFEImageElement::notifyFinished(CachedResource&)
    173173{
    174174    if (!inDocument())
  • trunk/Source/WebCore/svg/SVGFEImageElement.h

    r197563 r206903  
    1919 */
    2020
    21 #ifndef SVGFEImageElement_h
    22 #define SVGFEImageElement_h
     21#pragma once
    2322
    2423#include "CachedImageClient.h"
     
    5251    void parseAttribute(const QualifiedName&, const AtomicString&) override;
    5352    void svgAttributeChanged(const QualifiedName&) override;
    54     void notifyFinished(CachedResource*) override;
     53    void notifyFinished(CachedResource&) final;
    5554
    5655    void addSubresourceAttributeURLs(ListHashSet<URL>&) const override;
     
    7473
    7574} // namespace WebCore
    76 
    77 #endif
  • trunk/Source/WebCore/svg/SVGUseElement.cpp

    r206867 r206903  
    536536}
    537537
    538 void SVGUseElement::notifyFinished(CachedResource* resource)
     538void SVGUseElement::notifyFinished(CachedResource& resource)
    539539{
    540540    invalidateShadowTree();
    541     if (resource->errorOccurred())
     541    if (resource.errorOccurred())
    542542        dispatchEvent(Event::create(eventNames().errorEvent, false, false));
    543     else if (!resource->wasCanceled())
     543    else if (!resource.wasCanceled())
    544544        SVGExternalResourcesRequired::dispatchLoadEvent(this);
    545545}
  • trunk/Source/WebCore/svg/SVGUseElement.h

    r200041 r206903  
    2020 */
    2121
    22 #ifndef SVGUseElement_h
    23 #define SVGUseElement_h
     22#pragma once
    2423
    2524#include "CachedResourceHandle.h"
     
    7372    bool haveFiredLoadEvent() const override;
    7473    Timer* svgLoadEventTimer() override;
    75     void notifyFinished(CachedResource*) override;
     74    void notifyFinished(CachedResource&) final;
    7675
    7776    Document* externalDocument() const;
     
    9998
    10099}
    101 
    102 #endif
  • trunk/Source/WebCore/xml/parser/XMLDocumentParser.cpp

    r206867 r206903  
    229229}
    230230
    231 void XMLDocumentParser::notifyFinished(CachedResource* unusedResource)
    232 {
    233     ASSERT_UNUSED(unusedResource, unusedResource == m_pendingScript);
     231void XMLDocumentParser::notifyFinished(CachedResource& unusedResource)
     232{
     233    ASSERT_UNUSED(unusedResource, &unusedResource == m_pendingScript);
    234234    ASSERT(m_pendingScript->accessCount() > 0);
    235235
  • trunk/Source/WebCore/xml/parser/XMLDocumentParser.h

    r197563 r206903  
    109109
    110110        // from CachedResourceClient
    111         void notifyFinished(CachedResource*) override;
     111        void notifyFinished(CachedResource&) final;
    112112
    113113        void end();
Note: See TracChangeset for help on using the changeset viewer.