Title: [206903] trunk/Source/WebCore
Revision
206903
Author
commit-qu...@webkit.org
Date
2016-10-07 00:02:02 -0700 (Fri, 07 Oct 2016)

Log Message

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

Patch by Youenn Fablet <you...@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:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (206902 => 206903)


--- trunk/Source/WebCore/ChangeLog	2016-10-07 06:18:37 UTC (rev 206902)
+++ trunk/Source/WebCore/ChangeLog	2016-10-07 07:02:02 UTC (rev 206903)
@@ -1,3 +1,128 @@
+2016-10-07  Youenn Fablet  <you...@apple.com>
+
+        Refactor CachedResourceClient::notifyFinished
+        https://bugs.webkit.org/show_bug.cgi?id=162060
+
+        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:
+
 2016-10-06  Youenn Fablet  <you...@apple.com>
 
         CachedXSLStylesheet does not need to be updated according Origin/Fetch mode

Modified: trunk/Source/WebCore/dom/LoadableClassicScript.cpp (206902 => 206903)


--- trunk/Source/WebCore/dom/LoadableClassicScript.cpp	2016-10-07 06:18:37 UTC (rev 206902)
+++ trunk/Source/WebCore/dom/LoadableClassicScript.cpp	2016-10-07 07:02:02 UTC (rev 206903)
@@ -67,10 +67,9 @@
     return m_cachedScript->wasCanceled();
 }
 
-void LoadableClassicScript::notifyFinished(CachedResource* resource)
+void LoadableClassicScript::notifyFinished(CachedResource& resource)
 {
-    ASSERT(resource);
-    if (resource->resourceError().isAccessControl()) {
+    if (resource.resourceError().isAccessControl()) {
         static NeverDestroyed<String> consoleMessage(ASCIILiteral("Cross-origin script load denied by Cross-Origin Resource Sharing policy."));
         m_error = Error {
             ErrorType::CrossOriginLoad,

Modified: trunk/Source/WebCore/dom/LoadableClassicScript.h (206902 => 206903)


--- trunk/Source/WebCore/dom/LoadableClassicScript.h	2016-10-07 06:18:37 UTC (rev 206902)
+++ trunk/Source/WebCore/dom/LoadableClassicScript.h	2016-10-07 07:02:02 UTC (rev 206903)
@@ -55,7 +55,7 @@
 private:
     LoadableClassicScript(CachedResourceHandle<CachedScript>&& cachedScript) : m_cachedScript(WTFMove(cachedScript)) { }
 
-    void notifyFinished(CachedResource*) override;
+    void notifyFinished(CachedResource&) final;
 
     CachedResourceHandle<CachedScript> m_cachedScript;
     Optional<Error> m_error { Nullopt };

Modified: trunk/Source/WebCore/html/HTMLImageLoader.cpp (206902 => 206903)


--- trunk/Source/WebCore/html/HTMLImageLoader.cpp	2016-10-07 06:18:37 UTC (rev 206902)
+++ trunk/Source/WebCore/html/HTMLImageLoader.cpp	2016-10-07 07:02:02 UTC (rev 206903)
@@ -73,14 +73,15 @@
     return stripLeadingAndTrailingHTMLSpaces(attr);
 }
 
-void HTMLImageLoader::notifyFinished(CachedResource*)
+void HTMLImageLoader::notifyFinished(CachedResource&)
 {
-    CachedImage* cachedImage = image();
+    ASSERT(image());
+    CachedImage& cachedImage = *image();
 
     Ref<Element> protect(element());
     ImageLoader::notifyFinished(cachedImage);
 
-    bool loadError = cachedImage->errorOccurred() || cachedImage->response().httpStatusCode() >= 400;
+    bool loadError = cachedImage.errorOccurred() || cachedImage.response().httpStatusCode() >= 400;
     if (!loadError) {
         if (!element().inDocument()) {
             JSC::VM& vm = JSDOMWindowBase::commonVM();
@@ -87,7 +88,7 @@
             JSC::JSLockHolder lock(vm);
             // FIXME: Adopt reportExtraMemoryVisited, and switch to reportExtraMemoryAllocated.
             // https://bugs.webkit.org/show_bug.cgi?id=142595
-            vm.heap.deprecatedReportExtraMemory(cachedImage->encodedSize());
+            vm.heap.deprecatedReportExtraMemory(cachedImage.encodedSize());
         }
     }
 

Modified: trunk/Source/WebCore/html/HTMLImageLoader.h (206902 => 206903)


--- trunk/Source/WebCore/html/HTMLImageLoader.h	2016-10-07 06:18:37 UTC (rev 206902)
+++ trunk/Source/WebCore/html/HTMLImageLoader.h	2016-10-07 07:02:02 UTC (rev 206903)
@@ -20,8 +20,7 @@
  *
  */
 
-#ifndef HTMLImageLoader_h
-#define HTMLImageLoader_h
+#pragma once
 
 #include "ImageLoader.h"
 
@@ -35,9 +34,7 @@
     void dispatchLoadEvent() override;
     String sourceURI(const AtomicString&) const override;
 
-    void notifyFinished(CachedResource*) override;
+    void notifyFinished(CachedResource&) final;
 };
 
 }
-
-#endif

Modified: trunk/Source/WebCore/loader/ContentFilter.cpp (206902 => 206903)


--- trunk/Source/WebCore/loader/ContentFilter.cpp	2016-10-07 06:18:37 UTC (rev 206902)
+++ trunk/Source/WebCore/loader/ContentFilter.cpp	2016-10-07 07:02:02 UTC (rev 206903)
@@ -133,9 +133,8 @@
     m_mainResource = nullptr;
 }
 
-bool ContentFilter::continueAfterResponseReceived(CachedResource* resource, const ResourceResponse& response)
+bool ContentFilter::continueAfterResponseReceived(const ResourceResponse& response)
 {
-    ASSERT_UNUSED(resource, resource == m_mainResource);
     Ref<DocumentLoader> protectedDocumentLoader { m_documentLoader };
 
     if (m_state == State::Filtering) {
@@ -148,19 +147,18 @@
     return m_state != State::Blocked;
 }
 
-bool ContentFilter::continueAfterDataReceived(CachedResource* resource, const char* data, int length)
+bool ContentFilter::continueAfterDataReceived(const char* data, int length)
 {
-    ASSERT(resource == m_mainResource);
     Ref<DocumentLoader> protectedDocumentLoader { m_documentLoader };
 
     if (m_state == State::Filtering) {
-        LOG(ContentFiltering, "ContentFilter received %d bytes of data from <%s>.\n", length, resource->url().string().ascii().data());
+        LOG(ContentFiltering, "ContentFilter received %d bytes of data from <%s>.\n", length, m_mainResource->url().string().ascii().data());
         forEachContentFilterUntilBlocked([data, length](PlatformContentFilter& contentFilter) {
             contentFilter.addData(data, length);
         });
 
         if (m_state == State::Allowed)
-            deliverResourceData(*resource);
+            deliverResourceData(*m_mainResource);
         return false;
     }
 
@@ -167,16 +165,16 @@
     return m_state != State::Blocked;
 }
 
-bool ContentFilter::continueAfterNotifyFinished(CachedResource* resource)
+bool ContentFilter::continueAfterNotifyFinished(CachedResource& resource)
 {
-    ASSERT(resource == m_mainResource);
+    ASSERT_UNUSED(resource, &resource == m_mainResource);
     Ref<DocumentLoader> protectedDocumentLoader { m_documentLoader };
 
-    if (resource->errorOccurred())
+    if (m_mainResource->errorOccurred())
         return true;
 
     if (m_state == State::Filtering) {
-        LOG(ContentFiltering, "ContentFilter will finish filtering main resource at <%s>.\n", resource->url().string().ascii().data());
+        LOG(ContentFiltering, "ContentFilter will finish filtering main resource at <%s>.\n", m_mainResource->url().string().ascii().data());
         forEachContentFilterUntilBlocked([](PlatformContentFilter& contentFilter) {
             contentFilter.finishedAddingData();
         });
@@ -183,7 +181,7 @@
 
         if (m_state != State::Blocked) {
             m_state = State::Allowed;
-            deliverResourceData(*resource);
+            deliverResourceData(*m_mainResource);
         }
 
         if (m_state == State::Stopped)
@@ -250,7 +248,7 @@
     ASSERT(m_state == State::Allowed);
     ASSERT(resource.dataBufferingPolicy() == BufferData);
     if (auto* resourceBuffer = resource.resourceBuffer())
-        m_documentLoader.dataReceived(&resource, resourceBuffer->data(), resourceBuffer->size());
+        m_documentLoader.dataReceived(resource, resourceBuffer->data(), resourceBuffer->size());
 }
 
 static const URL& blockedPageURL()

Modified: trunk/Source/WebCore/loader/ContentFilter.h (206902 => 206903)


--- trunk/Source/WebCore/loader/ContentFilter.h	2016-10-07 06:18:37 UTC (rev 206902)
+++ trunk/Source/WebCore/loader/ContentFilter.h	2016-10-07 07:02:02 UTC (rev 206903)
@@ -57,9 +57,9 @@
     void stopFilteringMainResource();
 
     bool continueAfterWillSendRequest(ResourceRequest&, const ResourceResponse&);
-    bool continueAfterResponseReceived(CachedResource*, const ResourceResponse&);
-    bool continueAfterDataReceived(CachedResource*, const char* data, int length);
-    bool continueAfterNotifyFinished(CachedResource*);
+    bool continueAfterResponseReceived(const ResourceResponse&);
+    bool continueAfterDataReceived(const char* data, int length);
+    bool continueAfterNotifyFinished(CachedResource&);
 
     static bool continueAfterSubstituteDataRequest(const DocumentLoader& activeLoader, const SubstituteData&);
     void handleProvisionalLoadFailure(const ResourceError&);

Modified: trunk/Source/WebCore/loader/CrossOriginPreflightChecker.cpp (206902 => 206903)


--- trunk/Source/WebCore/loader/CrossOriginPreflightChecker.cpp	2016-10-07 06:18:37 UTC (rev 206902)
+++ trunk/Source/WebCore/loader/CrossOriginPreflightChecker.cpp	2016-10-07 07:02:02 UTC (rev 206903)
@@ -86,9 +86,9 @@
     loader.preflightSuccess(WTFMove(request));
 }
 
-void CrossOriginPreflightChecker::notifyFinished(CachedResource* resource)
+void CrossOriginPreflightChecker::notifyFinished(CachedResource& resource)
 {
-    ASSERT_UNUSED(resource, resource == m_resource);
+    ASSERT_UNUSED(resource, &resource == m_resource);
     if (m_resource->loadFailedOrCanceled()) {
         ResourceError preflightError = m_resource->resourceError();
         // If the preflight was cancelled by underlying code, it probably means the request was blocked due to some access control policy.

Modified: trunk/Source/WebCore/loader/CrossOriginPreflightChecker.h (206902 => 206903)


--- trunk/Source/WebCore/loader/CrossOriginPreflightChecker.h	2016-10-07 06:18:37 UTC (rev 206902)
+++ trunk/Source/WebCore/loader/CrossOriginPreflightChecker.h	2016-10-07 07:02:02 UTC (rev 206903)
@@ -53,7 +53,7 @@
     void setDefersLoading(bool);
 
 private:
-    void notifyFinished(CachedResource*) final;
+    void notifyFinished(CachedResource&) final;
 
     static void handleLoadingFailure(DocumentThreadableLoader&, unsigned long, const ResourceError&);
     static void validatePreflightResponse(DocumentThreadableLoader&, ResourceRequest&&, unsigned long, const ResourceResponse&);

Modified: trunk/Source/WebCore/loader/DocumentLoader.cpp (206902 => 206903)


--- trunk/Source/WebCore/loader/DocumentLoader.cpp	2016-10-07 06:18:37 UTC (rev 206902)
+++ trunk/Source/WebCore/loader/DocumentLoader.cpp	2016-10-07 07:02:02 UTC (rev 206903)
@@ -373,7 +373,7 @@
     return isLoadingMainResource() || !m_subresourceLoaders.isEmpty() || !m_plugInStreamLoaders.isEmpty();
 }
 
-void DocumentLoader::notifyFinished(CachedResource* resource)
+void DocumentLoader::notifyFinished(CachedResource& resource)
 {
 #if ENABLE(CONTENT_FILTERING)
     if (m_contentFilter && !m_contentFilter->continueAfterNotifyFinished(resource))
@@ -380,7 +380,7 @@
         return;
 #endif
 
-    ASSERT_UNUSED(resource, m_mainResource == resource);
+    ASSERT_UNUSED(resource, m_mainResource == &resource);
     ASSERT(m_mainResource);
     if (!m_mainResource->errorOccurred() && !m_mainResource->wasCanceled()) {
         finishedLoading(m_mainResource->loadFinishTime());
@@ -471,7 +471,7 @@
     if (response.url().isEmpty())
         response = ResourceResponse(m_request.url(), m_substituteData.mimeType(), m_substituteData.content()->size(), m_substituteData.textEncoding());
 
-    responseReceived(0, response);
+    responseReceived(response);
 }
 
 void DocumentLoader::startDataLoadTimer()
@@ -492,9 +492,9 @@
         startDataLoadTimer();
 }
 
-void DocumentLoader::redirectReceived(CachedResource* resource, ResourceRequest& request, const ResourceResponse& redirectResponse)
+void DocumentLoader::redirectReceived(CachedResource& resource, ResourceRequest& request, const ResourceResponse& redirectResponse)
 {
-    ASSERT_UNUSED(resource, resource == m_mainResource);
+    ASSERT_UNUSED(resource, &resource == m_mainResource);
     willSendRequest(request, redirectResponse);
 }
 
@@ -632,14 +632,19 @@
         cancelMainResourceLoad(frameLoader->cancelledError(m_request));
 }
 
-void DocumentLoader::responseReceived(CachedResource* resource, const ResourceResponse& response)
+void DocumentLoader::responseReceived(CachedResource& resource, const ResourceResponse& response)
 {
+    ASSERT_UNUSED(resource, m_mainResource == &resource);
+    responseReceived(response);
+}
+
+void DocumentLoader::responseReceived(const ResourceResponse& response)
+{
 #if ENABLE(CONTENT_FILTERING)
-    if (m_contentFilter && !m_contentFilter->continueAfterResponseReceived(resource, response))
+    if (m_contentFilter && !m_contentFilter->continueAfterResponseReceived(response))
         return;
 #endif
 
-    ASSERT_UNUSED(resource, m_mainResource == resource);
     Ref<DocumentLoader> protectedThis(*this);
     bool willLoadFallback = m_applicationCacheHost->maybeLoadFallbackForMainResponse(request(), response);
 
@@ -821,7 +826,7 @@
     if (!isStopping() && m_substituteData.isValid() && isLoadingMainResource()) {
         auto content = m_substituteData.content();
         if (content && content->size())
-            dataReceived(nullptr, content->data(), content->size());
+            dataReceived(content->data(), content->size());
         if (isLoadingMainResource())
             finishedLoading(0);
     }
@@ -929,16 +934,21 @@
     m_writer.addData(bytes, length);
 }
 
-void DocumentLoader::dataReceived(CachedResource* resource, const char* data, int length)
+void DocumentLoader::dataReceived(CachedResource& resource, const char* data, int length)
 {
+    ASSERT_UNUSED(resource, &resource == m_mainResource);
+    dataReceived(data, length);
+}
+
+void DocumentLoader::dataReceived(const char* data, int length)
+{
 #if ENABLE(CONTENT_FILTERING)
-    if (m_contentFilter && !m_contentFilter->continueAfterDataReceived(resource, data, length))
+    if (m_contentFilter && !m_contentFilter->continueAfterDataReceived(data, length))
         return;
 #endif
 
     ASSERT(data);
     ASSERT(length);
-    ASSERT_UNUSED(resource, resource == m_mainResource);
     ASSERT(!m_response.isNull());
 
     // There is a bug in CFNetwork where callbacks can be dispatched even when loads are deferred.

Modified: trunk/Source/WebCore/loader/DocumentLoader.h (206902 => 206903)


--- trunk/Source/WebCore/loader/DocumentLoader.h	2016-10-07 06:18:37 UTC (rev 206902)
+++ trunk/Source/WebCore/loader/DocumentLoader.h	2016-10-07 07:02:02 UTC (rev 206903)
@@ -316,11 +316,14 @@
         void willSendRequest(ResourceRequest&, const ResourceResponse&);
         void finishedLoading(double finishTime);
         void mainReceivedError(const ResourceError&);
-        WEBCORE_EXPORT void redirectReceived(CachedResource*, ResourceRequest&, const ResourceResponse&) override;
-        WEBCORE_EXPORT void responseReceived(CachedResource*, const ResourceResponse&) override;
-        WEBCORE_EXPORT void dataReceived(CachedResource*, const char* data, int length) override;
-        WEBCORE_EXPORT void notifyFinished(CachedResource*) override;
+        WEBCORE_EXPORT void redirectReceived(CachedResource&, ResourceRequest&, const ResourceResponse&) override;
+        WEBCORE_EXPORT void responseReceived(CachedResource&, const ResourceResponse&) override;
+        WEBCORE_EXPORT void dataReceived(CachedResource&, const char* data, int length) override;
+        WEBCORE_EXPORT void notifyFinished(CachedResource&) override;
 
+        void responseReceived(const ResourceResponse&);
+        void dataReceived(const char* data, int length);
+
         bool maybeLoadEmpty();
 
         bool isMultipartReplacingLoad() const;

Modified: trunk/Source/WebCore/loader/DocumentThreadableLoader.cpp (206902 => 206903)


--- trunk/Source/WebCore/loader/DocumentThreadableLoader.cpp	2016-10-07 06:18:37 UTC (rev 206902)
+++ trunk/Source/WebCore/loader/DocumentThreadableLoader.cpp	2016-10-07 07:02:02 UTC (rev 206903)
@@ -221,10 +221,10 @@
     client.didFail(ResourceError(errorDomainWebKitInternal, 0, url, "Redirection to URL with a scheme that is not HTTP(S).", ResourceError::Type::AccessControl));
 }
 
-void DocumentThreadableLoader::redirectReceived(CachedResource* resource, ResourceRequest& request, const ResourceResponse& redirectResponse)
+void DocumentThreadableLoader::redirectReceived(CachedResource& resource, ResourceRequest& request, const ResourceResponse& redirectResponse)
 {
     ASSERT(m_client);
-    ASSERT_UNUSED(resource, resource == m_resource);
+    ASSERT_UNUSED(resource, &resource == m_resource);
 
     Ref<DocumentThreadableLoader> protectedThis(*this);
 
@@ -276,16 +276,16 @@
     makeCrossOriginAccessRequest(ResourceRequest(request));
 }
 
-void DocumentThreadableLoader::dataSent(CachedResource* resource, unsigned long long bytesSent, unsigned long long totalBytesToBeSent)
+void DocumentThreadableLoader::dataSent(CachedResource& resource, unsigned long long bytesSent, unsigned long long totalBytesToBeSent)
 {
     ASSERT(m_client);
-    ASSERT_UNUSED(resource, resource == m_resource);
+    ASSERT_UNUSED(resource, &resource == m_resource);
     m_client->didSendData(bytesSent, totalBytesToBeSent);
 }
 
-void DocumentThreadableLoader::responseReceived(CachedResource* resource, const ResourceResponse& response)
+void DocumentThreadableLoader::responseReceived(CachedResource& resource, const ResourceResponse& response)
 {
-    ASSERT_UNUSED(resource, resource == m_resource);
+    ASSERT_UNUSED(resource, &resource == m_resource);
     didReceiveResponse(m_resource->identifier(), response, m_resource->responseTainting());
 }
 
@@ -307,9 +307,9 @@
     }
 }
 
-void DocumentThreadableLoader::dataReceived(CachedResource* resource, const char* data, int dataLength)
+void DocumentThreadableLoader::dataReceived(CachedResource& resource, const char* data, int dataLength)
 {
-    ASSERT_UNUSED(resource, resource == m_resource);
+    ASSERT_UNUSED(resource, &resource == m_resource);
     didReceiveData(m_resource->identifier(), data, dataLength);
 }
 
@@ -320,10 +320,10 @@
     m_client->didReceiveData(data, dataLength);
 }
 
-void DocumentThreadableLoader::notifyFinished(CachedResource* resource)
+void DocumentThreadableLoader::notifyFinished(CachedResource& resource)
 {
     ASSERT(m_client);
-    ASSERT_UNUSED(resource, resource == m_resource);
+    ASSERT_UNUSED(resource, &resource == m_resource);
 
     if (m_resource->errorOccurred())
         didFail(m_resource->identifier(), m_resource->resourceError());

Modified: trunk/Source/WebCore/loader/DocumentThreadableLoader.h (206902 => 206903)


--- trunk/Source/WebCore/loader/DocumentThreadableLoader.h	2016-10-07 06:18:37 UTC (rev 206902)
+++ trunk/Source/WebCore/loader/DocumentThreadableLoader.h	2016-10-07 07:02:02 UTC (rev 206903)
@@ -77,11 +77,11 @@
         void clearResource();
 
         // CachedRawResourceClient
-        void dataSent(CachedResource*, unsigned long long bytesSent, unsigned long long totalBytesToBeSent) override;
-        void responseReceived(CachedResource*, const ResourceResponse&) override;
-        void dataReceived(CachedResource*, const char* data, int dataLength) override;
-        void redirectReceived(CachedResource*, ResourceRequest&, const ResourceResponse&) override;
-        void notifyFinished(CachedResource*) override;
+        void dataSent(CachedResource&, unsigned long long bytesSent, unsigned long long totalBytesToBeSent) override;
+        void responseReceived(CachedResource&, const ResourceResponse&) override;
+        void dataReceived(CachedResource&, const char* data, int dataLength) override;
+        void redirectReceived(CachedResource&, ResourceRequest&, const ResourceResponse&) override;
+        void notifyFinished(CachedResource&) override;
 
         void didReceiveResponse(unsigned long identifier, const ResourceResponse&, ResourceResponse::Tainting);
         void didReceiveData(unsigned long identifier, const char* data, int dataLength);

Modified: trunk/Source/WebCore/loader/ImageLoader.cpp (206902 => 206903)


--- trunk/Source/WebCore/loader/ImageLoader.cpp	2016-10-07 06:18:37 UTC (rev 206902)
+++ trunk/Source/WebCore/loader/ImageLoader.cpp	2016-10-07 07:02:02 UTC (rev 206903)
@@ -270,10 +270,10 @@
     updateFromElement();
 }
 
-void ImageLoader::notifyFinished(CachedResource* resource)
+void ImageLoader::notifyFinished(CachedResource& resource)
 {
     ASSERT(m_failedLoadURL.isEmpty());
-    ASSERT(resource == m_image.get());
+    ASSERT_UNUSED(resource, &resource == m_image.get());
 
     m_imageComplete = true;
     if (!hasPendingBeforeLoadEvent())
@@ -282,7 +282,7 @@
     if (!m_hasPendingLoadEvent)
         return;
 
-    if (resource->resourceError().isAccessControl()) {
+    if (m_image->resourceError().isAccessControl()) {
         clearImageWithoutConsideringPendingLoadEvent();
 
         m_hasPendingErrorEvent = true;
@@ -299,7 +299,7 @@
         return;
     }
 
-    if (resource->wasCanceled()) {
+    if (m_image->wasCanceled()) {
         m_hasPendingLoadEvent = false;
         // Only consider updating the protection ref-count of the Element immediately before returning
         // from this function as doing so might result in the destruction of this ImageLoader.

Modified: trunk/Source/WebCore/loader/ImageLoader.h (206902 => 206903)


--- trunk/Source/WebCore/loader/ImageLoader.h	2016-10-07 06:18:37 UTC (rev 206902)
+++ trunk/Source/WebCore/loader/ImageLoader.h	2016-10-07 07:02:02 UTC (rev 206903)
@@ -20,8 +20,7 @@
  *
  */
 
-#ifndef ImageLoader_h
-#define ImageLoader_h
+#pragma once
 
 #include "CachedImageClient.h"
 #include "CachedResourceHandle.h"
@@ -73,7 +72,7 @@
 
 protected:
     explicit ImageLoader(Element&);
-    void notifyFinished(CachedResource*) override;
+    void notifyFinished(CachedResource&) override;
 
 private:
     virtual void dispatchLoadEvent() = 0;
@@ -107,5 +106,3 @@
 };
 
 }
-
-#endif

Modified: trunk/Source/WebCore/loader/LinkLoader.cpp (206902 => 206903)


--- trunk/Source/WebCore/loader/LinkLoader.cpp	2016-10-07 06:18:37 UTC (rev 206902)
+++ trunk/Source/WebCore/loader/LinkLoader.cpp	2016-10-07 07:02:02 UTC (rev 206903)
@@ -65,19 +65,19 @@
         m_preloadResourceClient->clear();
 }
 
-void LinkLoader::triggerEvents(const CachedResource* resource)
+void LinkLoader::triggerEvents(const CachedResource& resource)
 {
-    if (resource->errorOccurred())
+    if (resource.errorOccurred())
         m_client.linkLoadingErrored();
     else
         m_client.linkLoaded();
 }
 
-void LinkLoader::notifyFinished(CachedResource* resource)
+void LinkLoader::notifyFinished(CachedResource& resource)
 {
-    ASSERT_UNUSED(resource, m_cachedLinkResource.get() == resource);
+    ASSERT_UNUSED(resource, m_cachedLinkResource.get() == &resource);
 
-    triggerEvents(m_cachedLinkResource.get());
+    triggerEvents(*m_cachedLinkResource);
 
     m_cachedLinkResource->removeClient(*this);
     m_cachedLinkResource = nullptr;

Modified: trunk/Source/WebCore/loader/LinkLoader.h (206902 => 206903)


--- trunk/Source/WebCore/loader/LinkLoader.h	2016-10-07 06:18:37 UTC (rev 206902)
+++ trunk/Source/WebCore/loader/LinkLoader.h	2016-10-07 07:02:02 UTC (rev 206903)
@@ -29,8 +29,7 @@
  *
  */
 
-#ifndef LinkLoader_h
-#define LinkLoader_h
+#pragma once
 
 #include "CachedResource.h"
 #include "CachedResourceClient.h"
@@ -56,10 +55,10 @@
     static Optional<CachedResource::Type> resourceTypeFromAsAttribute(const String& as);
 
     WeakPtr<LinkLoader> createWeakPtr() { return m_weakPtrFactory.createWeakPtr(); }
-    void triggerEvents(const CachedResource*);
+    void triggerEvents(const CachedResource&);
 
 private:
-    void notifyFinished(CachedResource*) override;
+    void notifyFinished(CachedResource&) override;
     void preloadIfNeeded(const LinkRelAttribute&, const URL& href, Document&, const String& as, const String& crossOriginMode);
 
     LinkLoaderClient& m_client;
@@ -67,7 +66,5 @@
     std::unique_ptr<LinkPreloadResourceClient> m_preloadResourceClient;
     WeakPtrFactory<LinkLoader> m_weakPtrFactory;
 };
-    
+
 }
-
-#endif

Modified: trunk/Source/WebCore/loader/LinkPreloadResourceClients.cpp (206902 => 206903)


--- trunk/Source/WebCore/loader/LinkPreloadResourceClients.cpp	2016-10-07 06:18:37 UTC (rev 206902)
+++ trunk/Source/WebCore/loader/LinkPreloadResourceClients.cpp	2016-10-07 07:02:02 UTC (rev 206903)
@@ -37,7 +37,7 @@
     m_resource = &resource;
 }
 
-void LinkPreloadResourceClient::triggerEvents(const CachedResource* resource)
+void LinkPreloadResourceClient::triggerEvents(const CachedResource& resource)
 {
     if (m_loader)
         m_loader->triggerEvents(resource);

Modified: trunk/Source/WebCore/loader/LinkPreloadResourceClients.h (206902 => 206903)


--- trunk/Source/WebCore/loader/LinkPreloadResourceClients.h	2016-10-07 06:18:37 UTC (rev 206902)
+++ trunk/Source/WebCore/loader/LinkPreloadResourceClients.h	2016-10-07 07:02:02 UTC (rev 206903)
@@ -46,7 +46,7 @@
 public:
     virtual ~LinkPreloadResourceClient() { }
 
-    void triggerEvents(const CachedResource*);
+    void triggerEvents(const CachedResource&);
 
     virtual void clear() = 0;
 
@@ -83,11 +83,7 @@
     virtual ~LinkPreloadScriptResourceClient() { }
 
 
-    void notifyFinished(CachedResource* resource) override
-    {
-        ASSERT(ownedResource() == resource);
-        triggerEvents(resource);
-    }
+    void notifyFinished(CachedResource& resource) override { triggerEvents(resource); }
 
     void clear() override { clearResource(*this); }
 
@@ -110,8 +106,9 @@
 
     void setCSSStyleSheet(const String&, const URL&, const String&, const CachedCSSStyleSheet* resource) override
     {
+        ASSERT(resource);
         ASSERT(ownedResource() == resource);
-        triggerEvents(resource);
+        triggerEvents(*resource);
     }
 
     void clear() override { clearResource(*this); }
@@ -133,11 +130,7 @@
 
     virtual ~LinkPreloadImageResourceClient() { }
 
-    void notifyFinished(CachedResource* resource) override
-    {
-        ASSERT(ownedResource() == resource);
-        triggerEvents(resource);
-    }
+    void notifyFinished(CachedResource& resource) override { triggerEvents(resource); }
 
     void clear() override { clearResource(*this); }
 
@@ -161,7 +154,7 @@
     void fontLoaded(CachedFont& resource) override
     {
         ASSERT(ownedResource() == &resource);
-        triggerEvents(&resource);
+        triggerEvents(resource);
     }
 
     void clear() override { clearResource(*this); }
@@ -183,11 +176,7 @@
 
     virtual ~LinkPreloadRawResourceClient() { }
 
-    void notifyFinished(CachedResource* resource) override
-    {
-        ASSERT(ownedResource() == resource);
-        triggerEvents(resource);
-    }
+    void notifyFinished(CachedResource& resource) override { triggerEvents(resource); }
 
     void clear() override { clearResource(*this); }
 

Modified: trunk/Source/WebCore/loader/MediaResourceLoader.cpp (206902 => 206903)


--- trunk/Source/WebCore/loader/MediaResourceLoader.cpp	2016-10-07 06:18:37 UTC (rev 206902)
+++ trunk/Source/WebCore/loader/MediaResourceLoader.cpp	2016-10-07 07:02:02 UTC (rev 206903)
@@ -129,15 +129,15 @@
         m_resource->setDefersLoading(defersLoading);
 }
 
-void MediaResource::responseReceived(CachedResource* resource, const ResourceResponse& response)
+void MediaResource::responseReceived(CachedResource& resource, const ResourceResponse& response)
 {
-    ASSERT_UNUSED(resource, resource == m_resource);
+    ASSERT_UNUSED(resource, &resource == m_resource);
 
     if (!m_loader->document())
         return;
 
     RefPtr<MediaResource> protectedThis(this);
-    if (!m_loader->crossOriginMode().isNull() && !resource->passesSameOriginPolicyCheck(*m_loader->document()->securityOrigin())) {
+    if (!m_loader->crossOriginMode().isNull() && !m_resource->passesSameOriginPolicyCheck(*m_loader->document()->securityOrigin())) {
         static NeverDestroyed<const String> consoleMessage("Cross-origin media resource load denied by Cross-Origin Resource Sharing policy.");
         m_loader->document()->addConsoleMessage(MessageSource::Security, MessageLevel::Error, consoleMessage.get());
         m_didPassAccessControlCheck = false;
@@ -152,9 +152,9 @@
         m_client->responseReceived(*this, response);
 }
 
-bool MediaResource::shouldCacheResponse(CachedResource* resource, const ResourceResponse& response)
+bool MediaResource::shouldCacheResponse(CachedResource& resource, const ResourceResponse& response)
 {
-    ASSERT_UNUSED(resource, resource == m_resource);
+    ASSERT_UNUSED(resource, &resource == m_resource);
 
     RefPtr<MediaResource> protectedThis(this);
     if (m_client)
@@ -162,9 +162,9 @@
     return true;
 }
 
-void MediaResource::redirectReceived(CachedResource* resource, ResourceRequest& request, const ResourceResponse& response)
+void MediaResource::redirectReceived(CachedResource& resource, ResourceRequest& request, const ResourceResponse& response)
 {
-    ASSERT_UNUSED(resource, resource == m_resource);
+    ASSERT_UNUSED(resource, &resource == m_resource);
 
     RefPtr<MediaResource> protectedThis(this);
     if (m_client)
@@ -171,9 +171,9 @@
         m_client->redirectReceived(*this, request, response);
 }
 
-void MediaResource::dataSent(CachedResource* resource, unsigned long long bytesSent, unsigned long long totalBytesToBeSent)
+void MediaResource::dataSent(CachedResource& resource, unsigned long long bytesSent, unsigned long long totalBytesToBeSent)
 {
-    ASSERT_UNUSED(resource, resource == m_resource);
+    ASSERT_UNUSED(resource, &resource == m_resource);
 
     RefPtr<MediaResource> protectedThis(this);
     if (m_client)
@@ -180,9 +180,9 @@
         m_client->dataSent(*this, bytesSent, totalBytesToBeSent);
 }
 
-void MediaResource::dataReceived(CachedResource* resource, const char* data, int dataLength)
+void MediaResource::dataReceived(CachedResource& resource, const char* data, int dataLength)
 {
-    ASSERT_UNUSED(resource, resource == m_resource);
+    ASSERT_UNUSED(resource, &resource == m_resource);
 
     RefPtr<MediaResource> protectedThis(this);
     if (m_client)
@@ -189,14 +189,14 @@
         m_client->dataReceived(*this, data, dataLength);
 }
 
-void MediaResource::notifyFinished(CachedResource* resource)
+void MediaResource::notifyFinished(CachedResource& resource)
 {
-    ASSERT(resource == m_resource);
+    ASSERT_UNUSED(resource, &resource == m_resource);
 
     RefPtr<MediaResource> protectedThis(this);
     if (m_client) {
-        if (resource->loadFailedOrCanceled())
-            m_client->loadFailed(*this, resource->resourceError());
+        if (m_resource->loadFailedOrCanceled())
+            m_client->loadFailed(*this, m_resource->resourceError());
         else
             m_client->loadFinished(*this);
     }
@@ -204,9 +204,9 @@
 }
 
 #if USE(SOUP)
-char* MediaResource::getOrCreateReadBuffer(CachedResource* resource, size_t requestedSize, size_t& actualSize)
+char* MediaResource::getOrCreateReadBuffer(CachedResource& resource, size_t requestedSize, size_t& actualSize)
 {
-    ASSERT_UNUSED(resource, resource == m_resource);
+    ASSERT_UNUSED(resource, &resource == m_resource);
     return m_client ? m_client->getOrCreateReadBuffer(*this, requestedSize, actualSize) : nullptr;
 }
 #endif

Modified: trunk/Source/WebCore/loader/MediaResourceLoader.h (206902 => 206903)


--- trunk/Source/WebCore/loader/MediaResourceLoader.h	2016-10-07 06:18:37 UTC (rev 206902)
+++ trunk/Source/WebCore/loader/MediaResourceLoader.h	2016-10-07 07:02:02 UTC (rev 206903)
@@ -70,15 +70,15 @@
     void setDefersLoading(bool) override;
     bool didPassAccessControlCheck() const override { return m_didPassAccessControlCheck; }
 
-    // CachedResourceClient
-    void responseReceived(CachedResource*, const ResourceResponse&) override;
-    void redirectReceived(CachedResource*, ResourceRequest&, const ResourceResponse&) override;
-    bool shouldCacheResponse(CachedResource*, const ResourceResponse&) override;
-    void dataSent(CachedResource*, unsigned long long, unsigned long long) override;
-    void dataReceived(CachedResource*, const char*, int) override;
-    void notifyFinished(CachedResource*) override;
+    // CachedRawResourceClient
+    void responseReceived(CachedResource&, const ResourceResponse&) override;
+    void redirectReceived(CachedResource&, ResourceRequest&, const ResourceResponse&) override;
+    bool shouldCacheResponse(CachedResource&, const ResourceResponse&) override;
+    void dataSent(CachedResource&, unsigned long long, unsigned long long) override;
+    void dataReceived(CachedResource&, const char*, int) override;
+    void notifyFinished(CachedResource&) override;
 #if USE(SOUP)
-    char* getOrCreateReadBuffer(CachedResource*, size_t /*requestedSize*/, size_t& /*actualSize*/) override;
+    char* getOrCreateReadBuffer(CachedResource&, size_t /*requestedSize*/, size_t& /*actualSize*/) override;
 #endif
 
 private:

Modified: trunk/Source/WebCore/loader/TextTrackLoader.cpp (206902 => 206903)


--- trunk/Source/WebCore/loader/TextTrackLoader.cpp	2016-10-07 06:18:37 UTC (rev 206902)
+++ trunk/Source/WebCore/loader/TextTrackLoader.cpp	2016-10-07 07:02:02 UTC (rev 206903)
@@ -78,14 +78,14 @@
     }
 }
 
-void TextTrackLoader::processNewCueData(CachedResource* resource)
+void TextTrackLoader::processNewCueData(CachedResource& resource)
 {
-    ASSERT(m_resource == resource);
-    
-    if (m_state == Failed || !resource->resourceBuffer())
+    ASSERT_UNUSED(resource, m_resource == &resource);
+
+    if (m_state == Failed || !m_resource->resourceBuffer())
         return;
-    
-    auto* buffer = resource->resourceBuffer();
+
+    auto* buffer = m_resource->resourceBuffer();
     if (m_parseOffset == buffer->size())
         return;
 
@@ -102,14 +102,14 @@
 }
 
 // FIXME: This is a very unusual pattern, no other CachedResourceClient does this. Refactor to use notifyFinished() instead.
-void TextTrackLoader::deprecatedDidReceiveCachedResource(CachedResource* resource)
+void TextTrackLoader::deprecatedDidReceiveCachedResource(CachedResource& resource)
 {
-    ASSERT(m_resource == resource);
-    
-    if (!resource->resourceBuffer())
+    ASSERT_UNUSED(resource, m_resource == &resource);
+
+    if (!m_resource->resourceBuffer())
         return;
-    
-    processNewCueData(resource);
+
+    processNewCueData(*m_resource);
 }
 
 void TextTrackLoader::corsPolicyPreventedLoad()
@@ -120,19 +120,19 @@
     m_state = Failed;
 }
 
-void TextTrackLoader::notifyFinished(CachedResource* resource)
+void TextTrackLoader::notifyFinished(CachedResource& resource)
 {
-    ASSERT(m_resource == resource);
+    ASSERT_UNUSED(resource, m_resource == &resource);
 
-    if (resource->resourceError().isAccessControl())
+    if (m_resource->resourceError().isAccessControl())
         corsPolicyPreventedLoad();
 
     if (m_state != Failed) {
-        processNewCueData(resource);
+        processNewCueData(*m_resource);
         if (m_cueParser)
             m_cueParser->fileFinished();
         if (m_state != Failed)
-            m_state = resource->errorOccurred() ? Failed : Finished;
+            m_state = m_resource->errorOccurred() ? Failed : Finished;
     }
 
     if (m_state == Finished && m_cueParser)

Modified: trunk/Source/WebCore/loader/TextTrackLoader.h (206902 => 206903)


--- trunk/Source/WebCore/loader/TextTrackLoader.h	2016-10-07 06:18:37 UTC (rev 206902)
+++ trunk/Source/WebCore/loader/TextTrackLoader.h	2016-10-07 07:02:02 UTC (rev 206903)
@@ -64,20 +64,20 @@
 private:
 
     // CachedResourceClient
-    void notifyFinished(CachedResource*) override;
-    void deprecatedDidReceiveCachedResource(CachedResource*) override;
-    
+    void notifyFinished(CachedResource&) override;
+    void deprecatedDidReceiveCachedResource(CachedResource&) override;
+
     // WebVTTParserClient
     void newCuesParsed() override;
     void newRegionsParsed() override;
     void fileFailedToParse() override;
-    
-    void processNewCueData(CachedResource*);
+
+    void processNewCueData(CachedResource&);
     void cueLoadTimerFired();
     void corsPolicyPreventedLoad();
 
     enum State { Idle, Loading, Finished, Failed };
-    
+
     TextTrackLoaderClient& m_client;
     std::unique_ptr<WebVTTParser> m_cueParser;
     CachedResourceHandle<CachedTextTrack> m_resource;

Modified: trunk/Source/WebCore/loader/cache/CachedRawResource.cpp (206902 => 206903)


--- trunk/Source/WebCore/loader/cache/CachedRawResource.cpp	2016-10-07 06:18:37 UTC (rev 206902)
+++ trunk/Source/WebCore/loader/cache/CachedRawResource.cpp	2016-10-07 07:02:02 UTC (rev 206903)
@@ -115,7 +115,7 @@
     CachedResourceHandle<CachedRawResource> protectedThis(this);
     CachedResourceClientWalker<CachedRawResourceClient> w(m_clients);
     while (CachedRawResourceClient* c = w.next())
-        c->dataReceived(this, data, length);
+        c->dataReceived(*this, data, length);
 }
 
 void CachedRawResource::didAddClient(CachedResourceClient& c)
@@ -131,7 +131,7 @@
     for (size_t i = 0; i < redirectCount; i++) {
         RedirectPair redirect = m_redirectChain[i];
         ResourceRequest request(redirect.m_request);
-        client.redirectReceived(this, request, redirect.m_redirectResponse);
+        client.redirectReceived(*this, request, redirect.m_redirectResponse);
         if (!hasClient(c))
             return;
     }
@@ -145,12 +145,12 @@
             ASSERT(!validationInProgress());
             response.setSource(ResourceResponse::Source::MemoryCache);
         }
-        client.responseReceived(this, response);
+        client.responseReceived(*this, response);
     }
     if (!hasClient(c))
         return;
     if (m_data)
-        client.dataReceived(this, m_data->data(), m_data->size());
+        client.dataReceived(*this, m_data->data(), m_data->size());
     if (!hasClient(c))
        return;
     CachedResource::didAddClient(client);
@@ -168,7 +168,7 @@
     if (!response.isNull()) {
         CachedResourceClientWalker<CachedRawResourceClient> w(m_clients);
         while (CachedRawResourceClient* c = w.next())
-            c->redirectReceived(this, request, response);
+            c->redirectReceived(*this, request, response);
         m_redirectChain.append(RedirectPair(request, response));
     }
     CachedResource::redirectReceived(request, response);
@@ -182,7 +182,7 @@
     CachedResource::responseReceived(response);
     CachedResourceClientWalker<CachedRawResourceClient> w(m_clients);
     while (CachedRawResourceClient* c = w.next())
-        c->responseReceived(this, m_response);
+        c->responseReceived(*this, m_response);
 }
 
 bool CachedRawResource::shouldCacheResponse(const ResourceResponse& response)
@@ -189,7 +189,7 @@
 {
     CachedResourceClientWalker<CachedRawResourceClient> w(m_clients);
     while (CachedRawResourceClient* c = w.next()) {
-        if (!c->shouldCacheResponse(this, response))
+        if (!c->shouldCacheResponse(*this, response))
             return false;
     }
     return true;
@@ -199,7 +199,7 @@
 {
     CachedResourceClientWalker<CachedRawResourceClient> w(m_clients);
     while (CachedRawResourceClient* c = w.next())
-        c->dataSent(this, bytesSent, totalBytesToBeSent);
+        c->dataSent(*this, bytesSent, totalBytesToBeSent);
 }
 
 void CachedRawResource::switchClientsToRevalidatedResource()

Modified: trunk/Source/WebCore/loader/cache/CachedRawResourceClient.h (206902 => 206903)


--- trunk/Source/WebCore/loader/cache/CachedRawResourceClient.h	2016-10-07 06:18:37 UTC (rev 206902)
+++ trunk/Source/WebCore/loader/cache/CachedRawResourceClient.h	2016-10-07 07:02:02 UTC (rev 206903)
@@ -36,13 +36,13 @@
     static CachedResourceClientType expectedType() { return RawResourceType; }
     CachedResourceClientType resourceClientType() const override { return expectedType(); }
 
-    virtual void dataSent(CachedResource*, unsigned long long /* bytesSent */, unsigned long long /* totalBytesToBeSent */) { }
-    virtual void responseReceived(CachedResource*, const ResourceResponse&) { }
-    virtual bool shouldCacheResponse(CachedResource*, const ResourceResponse&) { return true; }
-    virtual void dataReceived(CachedResource*, const char* /* data */, int /* length */) { }
-    virtual void redirectReceived(CachedResource*, ResourceRequest&, const ResourceResponse&) { }
+    virtual void dataSent(CachedResource&, unsigned long long /* bytesSent */, unsigned long long /* totalBytesToBeSent */) { }
+    virtual void responseReceived(CachedResource&, const ResourceResponse&) { }
+    virtual bool shouldCacheResponse(CachedResource&, const ResourceResponse&) { return true; }
+    virtual void dataReceived(CachedResource&, const char* /* data */, int /* length */) { }
+    virtual void redirectReceived(CachedResource&, ResourceRequest&, const ResourceResponse&) { }
 #if USE(SOUP)
-    virtual char* getOrCreateReadBuffer(CachedResource*, size_t /* requestedSize */, size_t& /* actualSize */) { return nullptr; }
+    virtual char* getOrCreateReadBuffer(CachedResource&, size_t /* requestedSize */, size_t& /* actualSize */) { return nullptr; }
 #endif
 };
 

Modified: trunk/Source/WebCore/loader/cache/CachedResource.cpp (206902 => 206903)


--- trunk/Source/WebCore/loader/cache/CachedResource.cpp	2016-10-07 06:18:37 UTC (rev 206902)
+++ trunk/Source/WebCore/loader/cache/CachedResource.cpp	2016-10-07 07:02:02 UTC (rev 206903)
@@ -373,7 +373,7 @@
 
     CachedResourceClientWalker<CachedResourceClient> walker(m_clients);
     while (CachedResourceClient* client = walker.next())
-        client->notifyFinished(this);
+        client->notifyFinished(*this);
 }
 
 void CachedResource::addDataBuffer(SharedBuffer&)
@@ -550,7 +550,7 @@
     if (m_clientsAwaitingCallback.remove(&client))
         m_clients.add(&client);
     if (!isLoading() && !stillNeedsLoad())
-        client.notifyFinished(this);
+        client.notifyFinished(*this);
 }
 
 bool CachedResource::addClientToSet(CachedResourceClient& client)

Modified: trunk/Source/WebCore/loader/cache/CachedResourceClient.h (206902 => 206903)


--- trunk/Source/WebCore/loader/cache/CachedResourceClient.h	2016-10-07 06:18:37 UTC (rev 206902)
+++ trunk/Source/WebCore/loader/cache/CachedResourceClient.h	2016-10-07 07:02:02 UTC (rev 206903)
@@ -21,10 +21,8 @@
     This class provides all functionality needed for loading images, style sheets and html
     pages from the web. It has a memory cache for these objects.
 */
+#pragma once
 
-#ifndef CachedResourceClient_h
-#define CachedResourceClient_h
-
 namespace WebCore {
 
 class CachedResource;
@@ -41,8 +39,8 @@
     };
 
     virtual ~CachedResourceClient() { }
-    virtual void notifyFinished(CachedResource*) { }
-    virtual void deprecatedDidReceiveCachedResource(CachedResource*) { }
+    virtual void notifyFinished(CachedResource&) { }
+    virtual void deprecatedDidReceiveCachedResource(CachedResource&) { }
     virtual bool isXMLHttpRequest() const { return false; }
 
     static CachedResourceClientType expectedType() { return BaseResourceType; }
@@ -53,5 +51,3 @@
 };
 
 }
-
-#endif

Modified: trunk/Source/WebCore/loader/cache/CachedTextTrack.cpp (206902 => 206903)


--- trunk/Source/WebCore/loader/cache/CachedTextTrack.cpp	2016-10-07 06:18:37 UTC (rev 206902)
+++ trunk/Source/WebCore/loader/cache/CachedTextTrack.cpp	2016-10-07 07:02:02 UTC (rev 206903)
@@ -50,7 +50,7 @@
 
     CachedResourceClientWalker<CachedResourceClient> walker(m_clients);
     while (CachedResourceClient* client = walker.next())
-        client->deprecatedDidReceiveCachedResource(this);
+        client->deprecatedDidReceiveCachedResource(*this);
 }
 
 void CachedTextTrack::addDataBuffer(SharedBuffer& data)

Modified: trunk/Source/WebCore/loader/icon/IconLoader.cpp (206902 => 206903)


--- trunk/Source/WebCore/loader/icon/IconLoader.cpp	2016-10-07 06:18:37 UTC (rev 206902)
+++ trunk/Source/WebCore/loader/icon/IconLoader.cpp	2016-10-07 07:02:02 UTC (rev 206903)
@@ -79,14 +79,14 @@
     }
 }
 
-void IconLoader::notifyFinished(CachedResource* resource)
+void IconLoader::notifyFinished(CachedResource& resource)
 {
-    ASSERT(resource == m_resource);
+    ASSERT_UNUSED(resource, &resource == m_resource);
 
     // If we got a status code indicating an invalid response, then lets
     // ignore the data and not try to decode the error page as an icon.
-    auto* data = ""
-    int status = resource->response().httpStatusCode();
+    auto* data = ""
+    int status = m_resource->response().httpStatusCode();
     if (status && (status < 200 || status > 299))
         data = ""
 
@@ -93,16 +93,16 @@
     static const char pdfMagicNumber[] = "%PDF";
     static unsigned pdfMagicNumberLength = sizeof(pdfMagicNumber) - 1;
     if (data && data->size() >= pdfMagicNumberLength && !memcmp(data->data(), pdfMagicNumber, pdfMagicNumberLength)) {
-        LOG(IconDatabase, "IconLoader::finishLoading() - Ignoring icon at %s because it appears to be a PDF", resource->url().string().ascii().data());
+        LOG(IconDatabase, "IconLoader::finishLoading() - Ignoring icon at %s because it appears to be a PDF", m_resource->url().string().ascii().data());
         data = ""
     }
 
-    LOG(IconDatabase, "IconLoader::finishLoading() - Committing iconURL %s to database", resource->url().string().ascii().data());
-    m_frame.loader().icon().commitToDatabase(resource->url());
+    LOG(IconDatabase, "IconLoader::finishLoading() - Committing iconURL %s to database", m_resource->url().string().ascii().data());
+    m_frame.loader().icon().commitToDatabase(m_resource->url());
     // Setting the icon data only after committing to the database ensures that the data is
     // kept in memory (so it does not have to be read from the database asynchronously), since
     // there is a page URL referencing it.
-    iconDatabase().setIconDataForIconURL(data, resource->url().string());
+    iconDatabase().setIconDataForIconURL(data, m_resource->url().string());
     m_frame.loader().client().dispatchDidReceiveIcon();
     stopLoading();
 }

Modified: trunk/Source/WebCore/loader/icon/IconLoader.h (206902 => 206903)


--- trunk/Source/WebCore/loader/icon/IconLoader.h	2016-10-07 06:18:37 UTC (rev 206902)
+++ trunk/Source/WebCore/loader/icon/IconLoader.h	2016-10-07 07:02:02 UTC (rev 206903)
@@ -20,11 +20,10 @@
  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifndef IconLoader_h
-#define IconLoader_h
+#pragma once
 
 #include "CachedRawResourceClient.h"
 #include "CachedResourceHandle.h"
@@ -46,7 +45,7 @@
     void stopLoading();
 
 private:
-    void notifyFinished(CachedResource*) override;
+    void notifyFinished(CachedResource&) final;
 
     Frame& m_frame;
     CachedResourceHandle<CachedRawResource> m_resource;
@@ -53,5 +52,3 @@
 };
 
 } // namespace WebCore
-
-#endif

Modified: trunk/Source/WebCore/loader/soup/CachedRawResourceSoup.cpp (206902 => 206903)


--- trunk/Source/WebCore/loader/soup/CachedRawResourceSoup.cpp	2016-10-07 06:18:37 UTC (rev 206902)
+++ trunk/Source/WebCore/loader/soup/CachedRawResourceSoup.cpp	2016-10-07 07:02:02 UTC (rev 206903)
@@ -31,7 +31,7 @@
 {
     CachedResourceClientWalker<CachedRawResourceClient> w(m_clients);
     while (CachedRawResourceClient* c = w.next()) {
-        if (char* bufferPtr = c->getOrCreateReadBuffer(this, requestedSize, actualSize))
+        if (char* bufferPtr = c->getOrCreateReadBuffer(*this, requestedSize, actualSize))
             return bufferPtr;
     }
 

Modified: trunk/Source/WebCore/platform/graphics/avfoundation/cf/WebCoreAVCFResourceLoader.cpp (206902 => 206903)


--- trunk/Source/WebCore/platform/graphics/avfoundation/cf/WebCoreAVCFResourceLoader.cpp	2016-10-07 06:18:37 UTC (rev 206902)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/cf/WebCoreAVCFResourceLoader.cpp	2016-10-07 07:02:02 UTC (rev 206903)
@@ -109,10 +109,9 @@
     });
 }
 
-void WebCoreAVCFResourceLoader::responseReceived(CachedResource* resource, const ResourceResponse& response)
+void WebCoreAVCFResourceLoader::responseReceived(CachedResource& resource, const ResourceResponse& response)
 {
-    ASSERT(resource == m_resource);
-    UNUSED_PARAM(resource);
+    ASSERT_UNUSED(resource, &resource == m_resource);
 
     int status = response.httpStatusCode();
     if (status && (status < 200 || status > 299)) {
@@ -124,14 +123,14 @@
     notImplemented();
 }
 
-void WebCoreAVCFResourceLoader::dataReceived(CachedResource* resource, const char*, int)
+void WebCoreAVCFResourceLoader::dataReceived(CachedResource& resource, const char*, int)
 {
     fulfillRequestWithResource(resource);
 }
 
-void WebCoreAVCFResourceLoader::notifyFinished(CachedResource* resource)
+void WebCoreAVCFResourceLoader::notifyFinished(CachedResource& resource)
 {
-    if (resource->loadFailedOrCanceled()) {
+    if (resource.loadFailedOrCanceled()) {
         // <rdar://problem/13987417> Set the contentType of the contentInformationRequest to an empty
         // string to trigger AVAsset's playable value to complete loading.
         // FIXME: if ([m_avRequest.get() contentInformationRequest] && ![[m_avRequest.get() contentInformationRequest] contentType])
@@ -148,9 +147,9 @@
     stopLoading();
 }
 
-void WebCoreAVCFResourceLoader::fulfillRequestWithResource(CachedResource* resource)
+void WebCoreAVCFResourceLoader::fulfillRequestWithResource(CachedResource& resource)
 {
-    ASSERT(resource == m_resource);
+    ASSERT_UNUSED(resource, &resource == m_resource);
     notImplemented();
 }
 

Modified: trunk/Source/WebCore/platform/graphics/avfoundation/cf/WebCoreAVCFResourceLoader.h (206902 => 206903)


--- trunk/Source/WebCore/platform/graphics/avfoundation/cf/WebCoreAVCFResourceLoader.h	2016-10-07 06:18:37 UTC (rev 206902)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/cf/WebCoreAVCFResourceLoader.h	2016-10-07 07:02:02 UTC (rev 206903)
@@ -23,8 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifndef WebCoreAVCFResourceLoader_h
-#define WebCoreAVCFResourceLoader_h
+#pragma once
 
 #if ENABLE(VIDEO) && USE(AVFOUNDATION) && HAVE(AVFOUNDATION_LOADER_DELEGATE)
 
@@ -56,12 +55,12 @@
     CachedRawResource* resource();
 
 private:
-    // CachedResourceClient
-    void responseReceived(CachedResource*, const ResourceResponse&) override;
-    void dataReceived(CachedResource*, const char*, int) override;
-    void notifyFinished(CachedResource*) override;
+    // CachedRawResourceClient
+    void responseReceived(CachedResource&, const ResourceResponse&) override;
+    void dataReceived(CachedResource&, const char*, int) override;
+    void notifyFinished(CachedResource&) override;
 
-    void fulfillRequestWithResource(CachedResource*);
+    void fulfillRequestWithResource(CachedResource&);
 
     WebCoreAVCFResourceLoader(MediaPlayerPrivateAVFoundationCF* parent, AVCFAssetResourceLoadingRequestRef);
     MediaPlayerPrivateAVFoundationCF* m_parent;
@@ -71,6 +70,4 @@
 
 }
 
-#endif // ENABLE(VIDEO) && USE(AVFOUNDATION) 
-
-#endif // WebCoreAVFResourceLoader_h
+#endif // ENABLE(VIDEO) && USE(AVFOUNDATION)

Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.h (206902 => 206903)


--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.h	2016-10-07 06:18:37 UTC (rev 206902)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.h	2016-10-07 07:02:02 UTC (rev 206903)
@@ -23,8 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifndef WebCoreAVFResourceLoader_h
-#define WebCoreAVFResourceLoader_h
+#pragma once
 
 #if ENABLE(VIDEO) && USE(AVFOUNDATION) && HAVE(AVFOUNDATION_LOADER_DELEGATE)
 
@@ -57,11 +56,11 @@
 
 private:
     // CachedResourceClient
-    void responseReceived(CachedResource*, const ResourceResponse&) override;
-    void dataReceived(CachedResource*, const char*, int) override;
-    void notifyFinished(CachedResource*) override;
+    void responseReceived(CachedResource&, const ResourceResponse&) override;
+    void dataReceived(CachedResource&, const char*, int) override;
+    void notifyFinished(CachedResource&) override;
 
-    void fulfillRequestWithResource(CachedResource*);
+    void fulfillRequestWithResource(CachedResource&);
 
     WebCoreAVFResourceLoader(MediaPlayerPrivateAVFoundationObjC* parent, AVAssetResourceLoadingRequest *);
     MediaPlayerPrivateAVFoundationObjC* m_parent;
@@ -71,6 +70,4 @@
 
 }
 
-#endif // ENABLE(VIDEO) && USE(AVFOUNDATION) 
-
-#endif // WebCoreAVFResourceLoader_h
+#endif // ENABLE(VIDEO) && USE(AVFOUNDATION)

Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.mm (206902 => 206903)


--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.mm	2016-10-07 06:18:37 UTC (rev 206902)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.mm	2016-10-07 07:02:02 UTC (rev 206903)
@@ -106,10 +106,9 @@
     });
 }
 
-void WebCoreAVFResourceLoader::responseReceived(CachedResource* resource, const ResourceResponse& response)
+void WebCoreAVFResourceLoader::responseReceived(CachedResource& resource, const ResourceResponse& response)
 {
-    ASSERT(resource);
-    ASSERT(resource == m_resource);
+    ASSERT_UNUSED(resource, &resource == m_resource);
 
     int status = response.httpStatusCode();
     if (status && (status < 200 || status > 299)) {
@@ -122,7 +121,7 @@
 
         [contentInfo setContentType:uti];
 
-        ParsedContentRange& contentRange = resource->response().contentRange();
+        ParsedContentRange& contentRange = m_resource->response().contentRange();
         [contentInfo setContentLength:contentRange.isValid() ? contentRange.instanceLength() : response.expectedContentLength()];
         [contentInfo setByteRangeAccessSupported:YES];
 
@@ -133,20 +132,20 @@
     }
 }
 
-void WebCoreAVFResourceLoader::dataReceived(CachedResource* resource, const char*, int)
+void WebCoreAVFResourceLoader::dataReceived(CachedResource& resource, const char*, int)
 {
     fulfillRequestWithResource(resource);
 }
 
-void WebCoreAVFResourceLoader::notifyFinished(CachedResource* resource)
+void WebCoreAVFResourceLoader::notifyFinished(CachedResource& resource)
 {
-    if (resource->loadFailedOrCanceled()) {
+    if (resource.loadFailedOrCanceled()) {
         // <rdar://problem/13987417> Set the contentType of the contentInformationRequest to an empty
         // string to trigger AVAsset's playable value to complete loading.
         if ([m_avRequest.get() contentInformationRequest] && ![[m_avRequest.get() contentInformationRequest] contentType])
             [[m_avRequest.get() contentInformationRequest] setContentType:@""];
 
-        NSError* error = resource->errorOccurred() ? resource->resourceError().nsError() : nil;
+        NSError* error = resource.errorOccurred() ? resource.resourceError().nsError() : nil;
         [m_avRequest.get() finishLoadingWithError:error];
     } else {
         fulfillRequestWithResource(resource);
@@ -155,20 +154,19 @@
     stopLoading();
 }
 
-void WebCoreAVFResourceLoader::fulfillRequestWithResource(CachedResource* resource)
+void WebCoreAVFResourceLoader::fulfillRequestWithResource(CachedResource& resource)
 {
-    ASSERT(resource);
-    ASSERT(resource == m_resource);
+    ASSERT_UNUSED(resource, &resource == m_resource);
     AVAssetResourceLoadingDataRequest* dataRequest = [m_avRequest dataRequest];
     if (!dataRequest)
         return;
 
-    SharedBuffer* data = ""
+    SharedBuffer* data = ""
     if (!data)
         return;
 
     NSUInteger responseOffset = 0;
-    ParsedContentRange contentRange = resource->response().contentRange();
+    ParsedContentRange contentRange = m_resource->response().contentRange();
     if (contentRange.isValid())
         responseOffset = static_cast<NSUInteger>(contentRange.firstBytePosition());
 

Modified: trunk/Source/WebCore/rendering/RenderImage.cpp (206902 => 206903)


--- trunk/Source/WebCore/rendering/RenderImage.cpp	2016-10-07 06:18:37 UTC (rev 206902)
+++ trunk/Source/WebCore/rendering/RenderImage.cpp	2016-10-07 07:02:02 UTC (rev 206903)
@@ -338,7 +338,7 @@
     contentChanged(ImageChanged);
 }
 
-void RenderImage::notifyFinished(CachedResource* newImage)
+void RenderImage::notifyFinished(CachedResource& newImage)
 {
     if (documentBeingDestroyed())
         return;
@@ -345,7 +345,7 @@
 
     invalidateBackgroundObscurationStatus();
 
-    if (newImage == imageResource().cachedImage()) {
+    if (&newImage == imageResource().cachedImage()) {
         // tell any potential compositing layers
         // that the image is done and they can reference it directly.
         contentChanged(ImageChanged);

Modified: trunk/Source/WebCore/rendering/RenderImage.h (206902 => 206903)


--- trunk/Source/WebCore/rendering/RenderImage.h	2016-10-07 06:18:37 UTC (rev 206902)
+++ trunk/Source/WebCore/rendering/RenderImage.h	2016-10-07 07:02:02 UTC (rev 206903)
@@ -22,8 +22,7 @@
  *
  */
 
-#ifndef RenderImage_h
-#define RenderImage_h
+#pragma once
 
 #include "RenderImageResource.h"
 #include "RenderReplaced.h"
@@ -105,7 +104,7 @@
 
     LayoutUnit minimumReplacedHeight() const override;
 
-    void notifyFinished(CachedResource*) final;
+    void notifyFinished(CachedResource&) final;
     bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAction) final;
 
     bool boxShadowShouldBeAppliedToBackground(const LayoutPoint& paintOffset, BackgroundBleedAvoidance, InlineFlowBox*) const final;
@@ -137,5 +136,3 @@
 } // namespace WebCore
 
 SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT(RenderImage, isRenderImage())
-
-#endif // RenderImage_h

Modified: trunk/Source/WebCore/rendering/RenderLayerFilterInfo.cpp (206902 => 206903)


--- trunk/Source/WebCore/rendering/RenderLayerFilterInfo.cpp	2016-10-07 06:18:37 UTC (rev 206902)
+++ trunk/Source/WebCore/rendering/RenderLayerFilterInfo.cpp	2016-10-07 07:02:02 UTC (rev 206903)
@@ -83,11 +83,11 @@
 }
 
 void RenderLayer::FilterInfo::setRenderer(RefPtr<FilterEffectRenderer>&& renderer)
-{ 
-    m_renderer = renderer; 
+{
+    m_renderer = renderer;
 }
 
-void RenderLayer::FilterInfo::notifyFinished(CachedResource*)
+void RenderLayer::FilterInfo::notifyFinished(CachedResource&)
 {
     m_layer.filterNeedsRepaint();
 }

Modified: trunk/Source/WebCore/rendering/RenderLayerFilterInfo.h (206902 => 206903)


--- trunk/Source/WebCore/rendering/RenderLayerFilterInfo.h	2016-10-07 06:18:37 UTC (rev 206902)
+++ trunk/Source/WebCore/rendering/RenderLayerFilterInfo.h	2016-10-07 07:02:02 UTC (rev 206903)
@@ -28,8 +28,7 @@
  * SUCH DAMAGE.
  */
 
-#ifndef RenderLayerFilterInfo_h
-#define RenderLayerFilterInfo_h
+#pragma once
 
 #include "CachedResourceHandle.h"
 #include "CachedSVGDocumentClient.h"
@@ -55,15 +54,15 @@
     const LayoutRect& dirtySourceRect() const { return m_dirtySourceRect; }
     void expandDirtySourceRect(const LayoutRect& rect) { m_dirtySourceRect.unite(rect); }
     void resetDirtySourceRect() { m_dirtySourceRect = LayoutRect(); }
-    
+
     FilterEffectRenderer* renderer() const { return m_renderer.get(); }
     void setRenderer(RefPtr<FilterEffectRenderer>&&);
-    
+
     void updateReferenceFilterClients(const FilterOperations&);
     void removeReferenceFilterClients();
 
 private:
-    void notifyFinished(CachedResource*) override;
+    void notifyFinished(CachedResource&) final;
 
     static HashMap<const RenderLayer*, std::unique_ptr<FilterInfo>>& map();
 
@@ -77,5 +76,3 @@
 };
 
 } // namespace WebCore
-
-#endif // RenderLayerFilterInfo_h

Modified: trunk/Source/WebCore/svg/SVGFEImageElement.cpp (206902 => 206903)


--- trunk/Source/WebCore/svg/SVGFEImageElement.cpp	2016-10-07 06:18:37 UTC (rev 206902)
+++ trunk/Source/WebCore/svg/SVGFEImageElement.cpp	2016-10-07 07:02:02 UTC (rev 206903)
@@ -169,7 +169,7 @@
         clearResourceReferences();
 }
 
-void SVGFEImageElement::notifyFinished(CachedResource*)
+void SVGFEImageElement::notifyFinished(CachedResource&)
 {
     if (!inDocument())
         return;

Modified: trunk/Source/WebCore/svg/SVGFEImageElement.h (206902 => 206903)


--- trunk/Source/WebCore/svg/SVGFEImageElement.h	2016-10-07 06:18:37 UTC (rev 206902)
+++ trunk/Source/WebCore/svg/SVGFEImageElement.h	2016-10-07 07:02:02 UTC (rev 206903)
@@ -18,8 +18,7 @@
  * Boston, MA 02110-1301, USA.
  */
 
-#ifndef SVGFEImageElement_h
-#define SVGFEImageElement_h
+#pragma once
 
 #include "CachedImageClient.h"
 #include "CachedResourceHandle.h"
@@ -51,7 +50,7 @@
 
     void parseAttribute(const QualifiedName&, const AtomicString&) override;
     void svgAttributeChanged(const QualifiedName&) override;
-    void notifyFinished(CachedResource*) override;
+    void notifyFinished(CachedResource&) final;
 
     void addSubresourceAttributeURLs(ListHashSet<URL>&) const override;
     RefPtr<FilterEffect> build(SVGFilterBuilder*, Filter&) override;
@@ -73,5 +72,3 @@
 };
 
 } // namespace WebCore
-
-#endif

Modified: trunk/Source/WebCore/svg/SVGUseElement.cpp (206902 => 206903)


--- trunk/Source/WebCore/svg/SVGUseElement.cpp	2016-10-07 06:18:37 UTC (rev 206902)
+++ trunk/Source/WebCore/svg/SVGUseElement.cpp	2016-10-07 07:02:02 UTC (rev 206903)
@@ -535,12 +535,12 @@
     return targetClone && targetClone->hasRelativeLengths();
 }
 
-void SVGUseElement::notifyFinished(CachedResource* resource)
+void SVGUseElement::notifyFinished(CachedResource& resource)
 {
     invalidateShadowTree();
-    if (resource->errorOccurred())
+    if (resource.errorOccurred())
         dispatchEvent(Event::create(eventNames().errorEvent, false, false));
-    else if (!resource->wasCanceled())
+    else if (!resource.wasCanceled())
         SVGExternalResourcesRequired::dispatchLoadEvent(this);
 }
 

Modified: trunk/Source/WebCore/svg/SVGUseElement.h (206902 => 206903)


--- trunk/Source/WebCore/svg/SVGUseElement.h	2016-10-07 06:18:37 UTC (rev 206902)
+++ trunk/Source/WebCore/svg/SVGUseElement.h	2016-10-07 07:02:02 UTC (rev 206903)
@@ -19,8 +19,7 @@
  * Boston, MA 02110-1301, USA.
  */
 
-#ifndef SVGUseElement_h
-#define SVGUseElement_h
+#pragma once
 
 #include "CachedResourceHandle.h"
 #include "CachedSVGDocumentClient.h"
@@ -72,7 +71,7 @@
     void setHaveFiredLoadEvent(bool) override;
     bool haveFiredLoadEvent() const override;
     Timer* svgLoadEventTimer() override;
-    void notifyFinished(CachedResource*) override;
+    void notifyFinished(CachedResource&) final;
 
     Document* externalDocument() const;
     void updateExternalDocument();
@@ -98,5 +97,3 @@
 };
 
 }
-
-#endif

Modified: trunk/Source/WebCore/xml/parser/XMLDocumentParser.cpp (206902 => 206903)


--- trunk/Source/WebCore/xml/parser/XMLDocumentParser.cpp	2016-10-07 06:18:37 UTC (rev 206902)
+++ trunk/Source/WebCore/xml/parser/XMLDocumentParser.cpp	2016-10-07 07:02:02 UTC (rev 206903)
@@ -228,9 +228,9 @@
     m_xmlErrors->insertErrorMessageBlock();
 }
 
-void XMLDocumentParser::notifyFinished(CachedResource* unusedResource)
+void XMLDocumentParser::notifyFinished(CachedResource& unusedResource)
 {
-    ASSERT_UNUSED(unusedResource, unusedResource == m_pendingScript);
+    ASSERT_UNUSED(unusedResource, &unusedResource == m_pendingScript);
     ASSERT(m_pendingScript->accessCount() > 0);
 
     ScriptSourceCode sourceCode(m_pendingScript.get());

Modified: trunk/Source/WebCore/xml/parser/XMLDocumentParser.h (206902 => 206903)


--- trunk/Source/WebCore/xml/parser/XMLDocumentParser.h	2016-10-07 06:18:37 UTC (rev 206902)
+++ trunk/Source/WebCore/xml/parser/XMLDocumentParser.h	2016-10-07 07:02:02 UTC (rev 206903)
@@ -108,7 +108,7 @@
         bool shouldAssociateConsoleMessagesWithTextPosition() const override;
 
         // from CachedResourceClient
-        void notifyFinished(CachedResource*) override;
+        void notifyFinished(CachedResource&) final;
 
         void end();
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to