Changeset 206867 in webkit
- Timestamp:
- Oct 6, 2016 9:53:58 AM (8 years ago)
- Location:
- trunk/Source
- Files:
-
- 46 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r206866 r206867 1 2016-10-06 Youenn Fablet <youenn@apple.com> 2 3 CachedResource client handling methods should take reference 4 https://bugs.webkit.org/show_bug.cgi?id=163014 5 6 Reviewed by Alex Christensen. 7 8 No change of behavior. 9 10 * bindings/js/CachedScriptSourceProvider.h: 11 (WebCore::CachedScriptSourceProvider::~CachedScriptSourceProvider): 12 (WebCore::CachedScriptSourceProvider::CachedScriptSourceProvider): 13 * css/CSSCrossfadeValue.cpp: 14 (WebCore::CSSCrossfadeValue::~CSSCrossfadeValue): 15 (WebCore::CSSCrossfadeValue::loadSubimages): 16 * css/CSSFilterImageValue.cpp: 17 (WebCore::CSSFilterImageValue::~CSSFilterImageValue): 18 (WebCore::CSSFilterImageValue::loadSubimages): 19 * css/CSSFontFaceSource.cpp: 20 (WebCore::CSSFontFaceSource::CSSFontFaceSource): 21 (WebCore::CSSFontFaceSource::~CSSFontFaceSource): 22 * css/StyleRuleImport.cpp: 23 (WebCore::StyleRuleImport::~StyleRuleImport): 24 (WebCore::StyleRuleImport::requestStyleSheet): 25 * dom/DataTransfer.cpp: 26 (WebCore::DragImageLoader::startLoading): 27 (WebCore::DragImageLoader::stopLoading): 28 * dom/LoadableClassicScript.cpp: 29 (WebCore::LoadableClassicScript::create): 30 (WebCore::LoadableClassicScript::~LoadableClassicScript): 31 * dom/ProcessingInstruction.cpp: 32 (WebCore::ProcessingInstruction::~ProcessingInstruction): 33 (WebCore::ProcessingInstruction::checkStyleSheet): 34 (WebCore::ProcessingInstruction::parseStyleSheet): 35 * html/HTMLLinkElement.cpp: 36 (WebCore::HTMLLinkElement::~HTMLLinkElement): 37 (WebCore::HTMLLinkElement::process): 38 * loader/CrossOriginPreflightChecker.cpp: 39 (WebCore::CrossOriginPreflightChecker::~CrossOriginPreflightChecker): 40 (WebCore::CrossOriginPreflightChecker::startPreflight): 41 * loader/DocumentLoader.cpp: 42 (WebCore::DocumentLoader::detachFromFrame): 43 (WebCore::DocumentLoader::clearMainResource): 44 (WebCore::DocumentLoader::becomeMainResourceClient): 45 * loader/DocumentThreadableLoader.cpp: 46 (WebCore::DocumentThreadableLoader::~DocumentThreadableLoader): 47 (WebCore::DocumentThreadableLoader::clearResource): 48 (WebCore::DocumentThreadableLoader::loadRequest): 49 * loader/ImageLoader.cpp: 50 (WebCore::ImageLoader::~ImageLoader): 51 (WebCore::ImageLoader::clearImageWithoutConsideringPendingLoadEvent): 52 (WebCore::ImageLoader::updateFromElement): 53 (WebCore::ImageLoader::dispatchPendingBeforeLoadEvent): 54 * loader/LinkLoader.cpp: 55 (WebCore::LinkLoader::~LinkLoader): 56 (WebCore::LinkLoader::notifyFinished): 57 (WebCore::LinkLoader::loadLink): 58 * loader/LinkPreloadResourceClients.h: 59 (WebCore::LinkPreloadResourceClient::addResource): 60 (WebCore::LinkPreloadResourceClient::clearResource): 61 * loader/MediaResourceLoader.cpp: 62 (WebCore::MediaResource::MediaResource): 63 (WebCore::MediaResource::stop): 64 * loader/TextTrackLoader.cpp: 65 (WebCore::TextTrackLoader::~TextTrackLoader): 66 (WebCore::TextTrackLoader::cancelLoad): 67 (WebCore::TextTrackLoader::load): 68 * loader/cache/CachedCSSStyleSheet.cpp: 69 (WebCore::CachedCSSStyleSheet::didAddClient): 70 * loader/cache/CachedCSSStyleSheet.h: 71 * loader/cache/CachedFont.cpp: 72 (WebCore::CachedFont::didAddClient): 73 * loader/cache/CachedFont.h: 74 * loader/cache/CachedImage.cpp: 75 (WebCore::CachedImage::didAddClient): 76 (WebCore::CachedImage::didRemoveClient): 77 * loader/cache/CachedImage.h: 78 * loader/cache/CachedRawResource.cpp: 79 (WebCore::CachedRawResource::didAddClient): 80 * loader/cache/CachedRawResource.h: 81 * loader/cache/CachedResource.cpp: 82 (WebCore::CachedResource::addClient): 83 (WebCore::CachedResource::didAddClient): 84 (WebCore::CachedResource::addClientToSet): 85 (WebCore::CachedResource::removeClient): 86 (WebCore::CachedResource::switchClientsToRevalidatedResource): 87 (WebCore::CachedResource::Callback::timerFired): 88 * loader/cache/CachedResource.h: 89 (WebCore::CachedResource::hasClient): 90 (WebCore::CachedResource::didRemoveClient): 91 * loader/cache/CachedSVGDocumentReference.cpp: 92 (WebCore::CachedSVGDocumentReference::~CachedSVGDocumentReference): 93 (WebCore::CachedSVGDocumentReference::load): 94 * loader/cache/CachedXSLStyleSheet.cpp: 95 (WebCore::CachedXSLStyleSheet::didAddClient): 96 * loader/cache/CachedXSLStyleSheet.h: 97 * loader/cache/MemoryCache.cpp: 98 (WebCore::MemoryCache::addImageToCache): 99 (WebCore::MemoryCache::removeImageFromCache): 100 * loader/icon/IconLoader.cpp: 101 (WebCore::IconLoader::startLoading): 102 (WebCore::IconLoader::stopLoading): 103 * platform/graphics/avfoundation/cf/WebCoreAVCFResourceLoader.cpp: 104 (WebCore::WebCoreAVCFResourceLoader::startLoading): 105 (WebCore::WebCoreAVCFResourceLoader::stopLoading): 106 * platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.mm: 107 (WebCore::WebCoreAVFResourceLoader::startLoading): 108 (WebCore::WebCoreAVFResourceLoader::stopLoading): 109 * rendering/RenderImageResource.cpp: 110 (WebCore::RenderImageResource::shutdown): 111 (WebCore::RenderImageResource::setCachedImage): 112 * rendering/RenderLayerFilterInfo.cpp: 113 (WebCore::RenderLayer::FilterInfo::updateReferenceFilterClients): 114 (WebCore::RenderLayer::FilterInfo::removeReferenceFilterClients): 115 * rendering/style/StyleCachedImage.cpp: 116 (WebCore::StyleCachedImage::addClient): 117 (WebCore::StyleCachedImage::removeClient): 118 * svg/SVGFEImageElement.cpp: 119 (WebCore::SVGFEImageElement::clearResourceReferences): 120 (WebCore::SVGFEImageElement::requestImageResource): 121 * svg/SVGFontFaceUriElement.cpp: 122 (WebCore::SVGFontFaceUriElement::~SVGFontFaceUriElement): 123 (WebCore::SVGFontFaceUriElement::loadFont): 124 * svg/SVGUseElement.cpp: 125 (WebCore::SVGUseElement::~SVGUseElement): 126 (WebCore::SVGUseElement::updateExternalDocument): 127 * xml/XSLImportRule.cpp: 128 (WebCore::XSLImportRule::~XSLImportRule): 129 (WebCore::XSLImportRule::setXSLStyleSheet): 130 (WebCore::XSLImportRule::loadSheet): 131 * xml/parser/XMLDocumentParser.cpp: 132 (WebCore::XMLDocumentParser::notifyFinished): 133 * xml/parser/XMLDocumentParserLibxml2.cpp: 134 (WebCore::XMLDocumentParser::~XMLDocumentParser): 135 (WebCore::XMLDocumentParser::endElementNs): 136 1 137 2016-10-05 Philippe Normand <pnormand@igalia.com> 2 138 -
trunk/Source/WebCore/bindings/js/CachedScriptSourceProvider.h
r206653 r206867 42 42 virtual ~CachedScriptSourceProvider() 43 43 { 44 m_cachedScript->removeClient( this);44 m_cachedScript->removeClient(*this); 45 45 } 46 46 … … 53 53 , m_cachedScript(cachedScript) 54 54 { 55 m_cachedScript->addClient( this);55 m_cachedScript->addClient(*this); 56 56 } 57 57 -
trunk/Source/WebCore/css/CSSCrossfadeValue.cpp
r205181 r206867 62 62 { 63 63 if (m_cachedFromImage) 64 m_cachedFromImage->removeClient( &m_crossfadeSubimageObserver);64 m_cachedFromImage->removeClient(m_crossfadeSubimageObserver); 65 65 if (m_cachedToImage) 66 m_cachedToImage->removeClient( &m_crossfadeSubimageObserver);66 m_cachedToImage->removeClient(m_crossfadeSubimageObserver); 67 67 } 68 68 … … 132 132 if (m_cachedFromImage != oldCachedFromImage) { 133 133 if (oldCachedFromImage) 134 oldCachedFromImage->removeClient( &m_crossfadeSubimageObserver);134 oldCachedFromImage->removeClient(m_crossfadeSubimageObserver); 135 135 if (m_cachedFromImage) 136 m_cachedFromImage->addClient( &m_crossfadeSubimageObserver);136 m_cachedFromImage->addClient(m_crossfadeSubimageObserver); 137 137 } 138 138 139 139 if (m_cachedToImage != oldCachedToImage) { 140 140 if (oldCachedToImage) 141 oldCachedToImage->removeClient( &m_crossfadeSubimageObserver);141 oldCachedToImage->removeClient(m_crossfadeSubimageObserver); 142 142 if (m_cachedToImage) 143 m_cachedToImage->addClient( &m_crossfadeSubimageObserver);143 m_cachedToImage->addClient(m_crossfadeSubimageObserver); 144 144 } 145 145 -
trunk/Source/WebCore/css/CSSFilterImageValue.cpp
r205421 r206867 46 46 { 47 47 if (m_cachedImage) 48 m_cachedImage->removeClient( &m_filterSubimageObserver);48 m_cachedImage->removeClient(m_filterSubimageObserver); 49 49 } 50 50 … … 93 93 if (m_cachedImage != oldCachedImage) { 94 94 if (oldCachedImage) 95 oldCachedImage->removeClient( &m_filterSubimageObserver);95 oldCachedImage->removeClient(m_filterSubimageObserver); 96 96 if (m_cachedImage) 97 m_cachedImage->addClient( &m_filterSubimageObserver);97 m_cachedImage->addClient(m_filterSubimageObserver); 98 98 } 99 99 -
trunk/Source/WebCore/css/CSSFontFaceSource.cpp
r206830 r206867 89 89 // This may synchronously call fontLoaded(). 90 90 if (m_font) 91 m_font->addClient( this);91 m_font->addClient(*this); 92 92 93 93 if (status() == Status::Pending && (!m_font || m_font->isLoaded())) { … … 103 103 { 104 104 if (m_font) 105 m_font->removeClient( this);105 m_font->removeClient(*this); 106 106 } 107 107 -
trunk/Source/WebCore/css/StyleRuleImport.cpp
r206016 r206867 59 59 m_styleSheet->clearOwnerRule(); 60 60 if (m_cachedSheet) 61 m_cachedSheet->removeClient( &m_styleSheetClient);61 m_cachedSheet->removeClient(m_styleSheetClient); 62 62 } 63 63 … … 119 119 request.setInitiator(cachedResourceRequestInitiators().css); 120 120 if (m_cachedSheet) 121 m_cachedSheet->removeClient( &m_styleSheetClient);121 m_cachedSheet->removeClient(m_styleSheetClient); 122 122 if (m_parentStyleSheet->isUserStyleSheet()) { 123 123 request.setOptions(ResourceLoaderOptions(DoNotSendCallbacks, SniffContent, BufferData, AllowStoredCredentials, ClientCredentialPolicy::MayAskClientForCredentials, FetchOptions::Credentials::Include, SkipSecurityCheck, FetchOptions::Mode::NoCors, DoNotIncludeCertificateInfo, ContentSecurityPolicyImposition::SkipPolicyCheck, DefersLoadingPolicy::AllowDefersLoading, CachingPolicy::AllowCaching)); … … 132 132 m_parentStyleSheet->startLoadingDynamicSheet(); 133 133 m_loading = true; 134 m_cachedSheet->addClient( &m_styleSheetClient);134 m_cachedSheet->addClient(m_styleSheetClient); 135 135 } 136 136 } -
trunk/Source/WebCore/dom/DataTransfer.cpp
r200192 r206867 312 312 { 313 313 // FIXME: Does this really trigger a load? Does it need to? 314 image->addClient( this);314 image->addClient(*this); 315 315 } 316 316 317 317 void DragImageLoader::stopLoading(CachedResourceHandle<WebCore::CachedImage>& image) 318 318 { 319 image->removeClient( this);319 image->removeClient(*this); 320 320 } 321 321 -
trunk/Source/WebCore/dom/LoadableClassicScript.cpp
r205854 r206867 38 38 ASSERT(cachedScript); 39 39 auto script = adoptRef(*new LoadableClassicScript(WTFMove(cachedScript))); 40 cachedScript->addClient(script. ptr());40 cachedScript->addClient(script.get()); 41 41 return script; 42 42 } … … 44 44 LoadableClassicScript::~LoadableClassicScript() 45 45 { 46 m_cachedScript->removeClient( this);46 m_cachedScript->removeClient(*this); 47 47 } 48 48 -
trunk/Source/WebCore/dom/ProcessingInstruction.cpp
r206361 r206867 57 57 58 58 if (m_cachedSheet) 59 m_cachedSheet->removeClient( this);59 m_cachedSheet->removeClient(*this); 60 60 61 61 if (inDocument()) … … 127 127 } else { 128 128 if (m_cachedSheet) { 129 m_cachedSheet->removeClient( this);129 m_cachedSheet->removeClient(*this); 130 130 m_cachedSheet = nullptr; 131 131 } … … 155 155 } 156 156 if (m_cachedSheet) 157 m_cachedSheet->addClient( this);157 m_cachedSheet->addClient(*this); 158 158 else { 159 159 // The request may have been denied if (for example) the stylesheet is local and the document is remote. … … 226 226 227 227 if (m_cachedSheet) 228 m_cachedSheet->removeClient( this);228 m_cachedSheet->removeClient(*this); 229 229 m_cachedSheet = nullptr; 230 230 -
trunk/Source/WebCore/html/HTMLLinkElement.cpp
r206616 r206867 100 100 101 101 if (m_cachedSheet) 102 m_cachedSheet->removeClient( this);102 m_cachedSheet->removeClient(*this); 103 103 104 104 if (inDocument()) … … 232 232 if (charset.isEmpty() && document().frame()) 233 233 charset = document().charset(); 234 234 235 235 if (m_cachedSheet) { 236 236 removePendingSheet(); 237 m_cachedSheet->removeClient( this);237 m_cachedSheet->removeClient(*this); 238 238 m_cachedSheet = nullptr; 239 239 } … … 275 275 276 276 if (m_cachedSheet) 277 m_cachedSheet->addClient( this);277 m_cachedSheet->addClient(*this); 278 278 else { 279 279 // The request may have been denied if (for example) the stylesheet is local and the document is remote. -
trunk/Source/WebCore/loader/CrossOriginPreflightChecker.cpp
r206524 r206867 54 54 { 55 55 if (m_resource) 56 m_resource->removeClient( this);56 m_resource->removeClient(*this); 57 57 } 58 58 … … 120 120 m_resource = m_loader.document().cachedResourceLoader().requestRawResource(WTFMove(preflightRequest)); 121 121 if (m_resource) 122 m_resource->addClient( this);122 m_resource->addClient(*this); 123 123 } 124 124 -
trunk/Source/WebCore/loader/DocumentLoader.cpp
r206224 r206867 1021 1021 // frame have any loads active, so kill all the loads. 1022 1022 stopLoading(); 1023 if (m_mainResource && m_mainResource->hasClient( this))1024 m_mainResource->removeClient( this);1023 if (m_mainResource && m_mainResource->hasClient(*this)) 1024 m_mainResource->removeClient(*this); 1025 1025 #if ENABLE(CONTENT_FILTERING) 1026 1026 if (m_contentFilter) … … 1596 1596 void DocumentLoader::clearMainResource() 1597 1597 { 1598 if (m_mainResource && m_mainResource->hasClient( this))1599 m_mainResource->removeClient( this);1598 if (m_mainResource && m_mainResource->hasClient(*this)) 1599 m_mainResource->removeClient(*this); 1600 1600 #if ENABLE(CONTENT_FILTERING) 1601 1601 if (m_contentFilter) … … 1700 1700 m_contentFilter->startFilteringMainResource(*m_mainResource); 1701 1701 #endif 1702 m_mainResource->addClient( this);1702 m_mainResource->addClient(*this); 1703 1703 } 1704 1704 -
trunk/Source/WebCore/loader/DocumentThreadableLoader.cpp
r206858 r206867 168 168 { 169 169 if (m_resource) 170 m_resource->removeClient( this);170 m_resource->removeClient(*this); 171 171 } 172 172 … … 201 201 if (CachedResourceHandle<CachedRawResource> resource = m_resource) { 202 202 m_resource = nullptr; 203 resource->removeClient( this);203 resource->removeClient(*this); 204 204 } 205 205 if (m_preflightChecker) … … 392 392 m_resource = m_document.cachedResourceLoader().requestRawResource(WTFMove(newRequest)); 393 393 if (m_resource) 394 m_resource->addClient( this);394 m_resource->addClient(*this); 395 395 else { 396 396 // FIXME: Since we receive a synchronous error, this is probably due to some AccessControl checks. We should try to retrieve the actual error. -
trunk/Source/WebCore/loader/ImageLoader.cpp
r206016 r206867 105 105 { 106 106 if (m_image) 107 m_image->removeClient( this);107 m_image->removeClient(*this); 108 108 109 109 ASSERT(m_hasPendingBeforeLoadEvent || !beforeLoadEventSender().hasPendingEvents(*this)); … … 149 149 m_imageComplete = true; 150 150 if (oldImage) 151 oldImage->removeClient( this);151 oldImage->removeClient(*this); 152 152 } 153 153 … … 249 249 // being queued to fire. Ensure this happens after beforeload is 250 250 // dispatched. 251 newImage->addClient( this);251 newImage->addClient(*this); 252 252 } 253 253 if (oldImage) { 254 oldImage->removeClient( this);254 oldImage->removeClient(*this); 255 255 updateRenderer(); 256 256 } … … 401 401 } 402 402 if (m_image) { 403 m_image->removeClient( this);403 m_image->removeClient(*this); 404 404 m_image = nullptr; 405 405 } -
trunk/Source/WebCore/loader/LinkLoader.cpp
r206203 r206867 61 61 { 62 62 if (m_cachedLinkResource) 63 m_cachedLinkResource->removeClient( this);63 m_cachedLinkResource->removeClient(*this); 64 64 if (m_preloadResourceClient) 65 65 m_preloadResourceClient->clear(); … … 80 80 triggerEvents(m_cachedLinkResource.get()); 81 81 82 m_cachedLinkResource->removeClient( this);82 m_cachedLinkResource->removeClient(*this); 83 83 m_cachedLinkResource = nullptr; 84 84 } … … 198 198 199 199 if (m_cachedLinkResource) { 200 m_cachedLinkResource->removeClient( this);200 m_cachedLinkResource->removeClient(*this); 201 201 m_cachedLinkResource = nullptr; 202 202 } … … 205 205 m_cachedLinkResource = document.cachedResourceLoader().requestLinkResource(type, CachedResourceRequest(ResourceRequest(document.completeURL(href)), options, priority)); 206 206 if (m_cachedLinkResource) 207 m_cachedLinkResource->addClient( this);207 m_cachedLinkResource->addClient(*this); 208 208 } 209 209 #endif -
trunk/Source/WebCore/loader/LinkPreloadResourceClients.h
r205269 r206867 55 55 LinkPreloadResourceClient(LinkLoader&, CachedResource&); 56 56 57 void addResource(CachedResourceClient *client)57 void addResource(CachedResourceClient& client) 58 58 { 59 59 m_resource->addClient(client); 60 60 } 61 61 62 void clearResource(CachedResourceClient *client)62 void clearResource(CachedResourceClient& client) 63 63 { 64 64 if (m_resource) … … 90 90 } 91 91 92 void clear() override { clearResource( this); }92 void clear() override { clearResource(*this); } 93 93 94 94 private: … … 96 96 : LinkPreloadResourceClient(loader, resource) 97 97 { 98 addResource( this);98 addResource(*this); 99 99 } 100 100 }; … … 115 115 } 116 116 117 void clear() override { clearResource( this); }117 void clear() override { clearResource(*this); } 118 118 119 119 private: … … 121 121 : LinkPreloadResourceClient(loader, resource) 122 122 { 123 addResource( this);123 addResource(*this); 124 124 } 125 125 }; … … 140 140 } 141 141 142 void clear() override { clearResource( this); }142 void clear() override { clearResource(*this); } 143 143 144 144 private: … … 146 146 : LinkPreloadResourceClient(loader, dynamic_cast<CachedResource&>(resource)) 147 147 { 148 addResource( this);148 addResource(*this); 149 149 } 150 150 }; … … 165 165 } 166 166 167 void clear() override { clearResource( this); }167 void clear() override { clearResource(*this); } 168 168 169 169 private: … … 171 171 : LinkPreloadResourceClient(loader, resource) 172 172 { 173 addResource( this);173 addResource(*this); 174 174 } 175 175 }; … … 190 190 } 191 191 192 void clear() override { clearResource( this); }192 void clear() override { clearResource(*this); } 193 193 194 194 private: … … 196 196 : LinkPreloadResourceClient(loader, resource) 197 197 { 198 addResource( this);198 addResource(*this); 199 199 } 200 200 }; -
trunk/Source/WebCore/loader/MediaResourceLoader.cpp
r206016 r206867 106 106 { 107 107 ASSERT(resource); 108 resource->addClient( this);108 resource->addClient(*this); 109 109 } 110 110 … … 120 120 return; 121 121 122 m_resource->removeClient( this);122 m_resource->removeClient(*this); 123 123 m_resource = nullptr; 124 124 } -
trunk/Source/WebCore/loader/TextTrackLoader.cpp
r206016 r206867 57 57 { 58 58 if (m_resource) 59 m_resource->removeClient( this);59 m_resource->removeClient(*this); 60 60 } 61 61 … … 74 74 { 75 75 if (m_resource) { 76 m_resource->removeClient( this);76 m_resource->removeClient(*this); 77 77 m_resource = nullptr; 78 78 } … … 162 162 return false; 163 163 164 m_resource->addClient( this);164 m_resource->addClient(*this); 165 165 166 166 return true; -
trunk/Source/WebCore/loader/cache/CachedCSSStyleSheet.cpp
r206206 r206867 54 54 } 55 55 56 void CachedCSSStyleSheet::didAddClient(CachedResourceClient * c)56 void CachedCSSStyleSheet::didAddClient(CachedResourceClient& client) 57 57 { 58 ASSERT(c ->resourceClientType() == CachedStyleSheetClient::expectedType());58 ASSERT(client.resourceClientType() == CachedStyleSheetClient::expectedType()); 59 59 // CachedResource::didAddClient() must be before setCSSStyleSheet(), 60 60 // because setCSSStyleSheet() may cause scripts to be executed, which could destroy 'c' if it is an instance of HTMLLinkElement. 61 61 // see the comment of HTMLLinkElement::setCSSStyleSheet. 62 CachedResource::didAddClient(c );62 CachedResource::didAddClient(client); 63 63 64 64 if (!isLoading()) 65 static_cast<CachedStyleSheetClient *>(c)->setCSSStyleSheet(m_resourceRequest.url(), m_response.url(), m_decoder->encoding().name(), this);65 static_cast<CachedStyleSheetClient&>(client).setCSSStyleSheet(m_resourceRequest.url(), m_response.url(), m_decoder->encoding().name(), this); 66 66 } 67 67 -
trunk/Source/WebCore/loader/cache/CachedCSSStyleSheet.h
r206016 r206867 51 51 bool mayTryReplaceEncodedData() const final { return true; } 52 52 53 void didAddClient(CachedResourceClient *) final;53 void didAddClient(CachedResourceClient&) final; 54 54 55 55 void setEncoding(const String&) final; -
trunk/Source/WebCore/loader/cache/CachedFont.cpp
r206830 r206867 64 64 } 65 65 66 void CachedFont::didAddClient(CachedResourceClient *client)66 void CachedFont::didAddClient(CachedResourceClient& client) 67 67 { 68 ASSERT(client ->resourceClientType() == CachedFontClient::expectedType());68 ASSERT(client.resourceClientType() == CachedFontClient::expectedType()); 69 69 if (!isLoading()) 70 static_cast<CachedFontClient *>(client)->fontLoaded(*this);70 static_cast<CachedFontClient&>(client).fontLoaded(*this); 71 71 } 72 72 -
trunk/Source/WebCore/loader/cache/CachedFont.h
r206664 r206867 70 70 NO_RETURN_DUE_TO_ASSERT void setBodyDataFrom(const CachedResource&) final { ASSERT_NOT_REACHED(); } 71 71 72 void didAddClient(CachedResourceClient *) override;72 void didAddClient(CachedResourceClient&) override; 73 73 void finishLoading(SharedBuffer*) override; 74 74 -
trunk/Source/WebCore/loader/cache/CachedImage.cpp
r206637 r206867 103 103 } 104 104 105 void CachedImage::didAddClient(CachedResourceClient *client)105 void CachedImage::didAddClient(CachedResourceClient& client) 106 106 { 107 107 if (m_data && !m_image && !errorOccurred()) { … … 110 110 } 111 111 112 ASSERT(client ->resourceClientType() == CachedImageClient::expectedType());112 ASSERT(client.resourceClientType() == CachedImageClient::expectedType()); 113 113 if (m_image && !m_image->isNull()) 114 static_cast<CachedImageClient *>(client)->imageChanged(this);114 static_cast<CachedImageClient&>(client).imageChanged(this); 115 115 116 116 CachedResource::didAddClient(client); 117 117 } 118 118 119 void CachedImage::didRemoveClient(CachedResourceClient* client) 120 { 121 ASSERT(client); 122 ASSERT(client->resourceClientType() == CachedImageClient::expectedType()); 123 124 m_pendingContainerSizeRequests.remove(static_cast<CachedImageClient*>(client)); 119 void CachedImage::didRemoveClient(CachedResourceClient& client) 120 { 121 ASSERT(client.resourceClientType() == CachedImageClient::expectedType()); 122 123 m_pendingContainerSizeRequests.remove(&static_cast<CachedImageClient&>(client)); 125 124 126 125 if (m_svgImageCache) 127 m_svgImageCache->removeClientFromCache( static_cast<CachedImageClient*>(client));126 m_svgImageCache->removeClientFromCache(&static_cast<CachedImageClient&>(client)); 128 127 129 128 CachedResource::didRemoveClient(client); -
trunk/Source/WebCore/loader/cache/CachedImage.h
r206635 r206867 100 100 void checkShouldPaintBrokenImage(); 101 101 102 void switchClientsToRevalidatedResource() override;103 bool mayTryReplaceEncodedData() const override{ return true; }102 void switchClientsToRevalidatedResource() final; 103 bool mayTryReplaceEncodedData() const final { return true; } 104 104 105 void didAddClient(CachedResourceClient *) override;106 void didRemoveClient(CachedResourceClient *) override;105 void didAddClient(CachedResourceClient&) final; 106 void didRemoveClient(CachedResourceClient&) final; 107 107 108 108 void allClientsRemoved() override; -
trunk/Source/WebCore/loader/cache/CachedRawResource.cpp
r206016 r206867 119 119 } 120 120 121 void CachedRawResource::didAddClient(CachedResourceClient *c)121 void CachedRawResource::didAddClient(CachedResourceClient& c) 122 122 { 123 123 if (!hasClient(c)) … … 127 127 // so a protector is necessary. 128 128 CachedResourceHandle<CachedRawResource> protectedThis(this); 129 CachedRawResourceClient * client = static_cast<CachedRawResourceClient*>(c);129 CachedRawResourceClient& client = static_cast<CachedRawResourceClient&>(c); 130 130 size_t redirectCount = m_redirectChain.size(); 131 131 for (size_t i = 0; i < redirectCount; i++) { 132 132 RedirectPair redirect = m_redirectChain[i]; 133 133 ResourceRequest request(redirect.m_request); 134 client ->redirectReceived(this, request, redirect.m_redirectResponse);134 client.redirectReceived(this, request, redirect.m_redirectResponse); 135 135 if (!hasClient(c)) 136 136 return; … … 146 146 response.setSource(ResourceResponse::Source::MemoryCache); 147 147 } 148 client ->responseReceived(this, response);148 client.responseReceived(this, response); 149 149 } 150 150 if (!hasClient(c)) 151 151 return; 152 152 if (m_data) 153 client ->dataReceived(this, m_data->data(), m_data->size());153 client.dataReceived(this, m_data->data(), m_data->size()); 154 154 if (!hasClient(c)) 155 155 return; -
trunk/Source/WebCore/loader/cache/CachedRawResource.h
r206016 r206867 52 52 53 53 private: 54 void didAddClient(CachedResourceClient *) override;55 void addDataBuffer(SharedBuffer&) override;56 void addData(const char* data, unsigned length) override;57 void finishLoading(SharedBuffer*) override;54 void didAddClient(CachedResourceClient&) final; 55 void addDataBuffer(SharedBuffer&) final; 56 void addData(const char* data, unsigned length) final; 57 void finishLoading(SharedBuffer*) final; 58 58 59 59 bool shouldIgnoreHTTPStatusCodeErrors() const override { return true; } -
trunk/Source/WebCore/loader/cache/CachedResource.cpp
r206635 r206867 530 530 } 531 531 532 void CachedResource::addClient(CachedResourceClient *client)532 void CachedResource::addClient(CachedResourceClient& client) 533 533 { 534 534 if (addClientToSet(client)) … … 536 536 } 537 537 538 void CachedResource::didAddClient(CachedResourceClient *client)538 void CachedResource::didAddClient(CachedResourceClient& client) 539 539 { 540 540 if (m_decodedDataDeletionTimer.isActive()) 541 541 m_decodedDataDeletionTimer.stop(); 542 542 543 if (m_clientsAwaitingCallback.remove( client))544 m_clients.add( client);543 if (m_clientsAwaitingCallback.remove(&client)) 544 m_clients.add(&client); 545 545 if (!isLoading() && !stillNeedsLoad()) 546 client ->notifyFinished(this);547 } 548 549 bool CachedResource::addClientToSet(CachedResourceClient *client)546 client.notifyFinished(this); 547 } 548 549 bool CachedResource::addClientToSet(CachedResourceClient& client) 550 550 { 551 551 if (m_preloadResult == PreloadNotReferenced) { … … 565 565 // Therefore, rather than immediately sending callbacks on a cache hit like other CachedResources, 566 566 // we schedule the callbacks and ensure we never finish synchronously. 567 ASSERT(!m_clientsAwaitingCallback.contains( client));568 m_clientsAwaitingCallback.add( client, std::make_unique<Callback>(*this, *client));567 ASSERT(!m_clientsAwaitingCallback.contains(&client)); 568 m_clientsAwaitingCallback.add(&client, std::make_unique<Callback>(*this, client)); 569 569 return false; 570 570 } 571 571 572 m_clients.add( client);572 m_clients.add(&client); 573 573 return true; 574 574 } 575 575 576 void CachedResource::removeClient(CachedResourceClient *client)577 { 578 auto callback = m_clientsAwaitingCallback.take( client);576 void CachedResource::removeClient(CachedResourceClient& client) 577 { 578 auto callback = m_clientsAwaitingCallback.take(&client); 579 579 if (callback) { 580 ASSERT(!m_clients.contains( client));580 ASSERT(!m_clients.contains(&client)); 581 581 callback->cancel(); 582 582 callback = nullptr; 583 583 } else { 584 ASSERT(m_clients.contains( client));585 m_clients.remove( client);584 ASSERT(m_clients.contains(&client)); 585 m_clients.remove(&client); 586 586 didRemoveClient(client); 587 587 } … … 776 776 777 777 for (auto& client : clientsToMove) 778 removeClient( client);778 removeClient(*client); 779 779 ASSERT(m_clients.isEmpty()); 780 780 781 781 for (auto& client : clientsToMove) 782 m_resourceToRevalidate->addClientToSet( client);782 m_resourceToRevalidate->addClientToSet(*client); 783 783 for (auto& client : clientsToMove) { 784 784 // Calling didAddClient may do anything, including trying to cancel revalidation. … … 787 787 // Calling didAddClient for a client may end up removing another client. In that case it won't be in the set anymore. 788 788 if (m_resourceToRevalidate->m_clients.contains(client)) 789 m_resourceToRevalidate->didAddClient( client);789 m_resourceToRevalidate->didAddClient(*client); 790 790 } 791 791 m_switchingClientsToRevalidatedResource = false; … … 912 912 void CachedResource::Callback::timerFired() 913 913 { 914 m_resource.didAddClient( &m_client);914 m_resource.didAddClient(m_client); 915 915 } 916 916 -
trunk/Source/WebCore/loader/cache/CachedResource.h
r206388 r206867 125 125 void setLoadPriority(const Optional<ResourceLoadPriority>&); 126 126 127 WEBCORE_EXPORT void addClient(CachedResourceClient *);128 WEBCORE_EXPORT void removeClient(CachedResourceClient *);127 WEBCORE_EXPORT void addClient(CachedResourceClient&); 128 WEBCORE_EXPORT void removeClient(CachedResourceClient&); 129 129 bool hasClients() const { return !m_clients.isEmpty() || !m_clientsAwaitingCallback.isEmpty(); } 130 bool hasClient(CachedResourceClient * client) { return m_clients.contains(client) || m_clientsAwaitingCallback.contains(client); }130 bool hasClient(CachedResourceClient& client) { return m_clients.contains(&client) || m_clientsAwaitingCallback.contains(&client); } 131 131 bool deleteIfPossible(); 132 132 … … 139 139 PreloadResult preloadResult() const { return static_cast<PreloadResult>(m_preloadResult); } 140 140 141 virtual void didAddClient(CachedResourceClient *);142 virtual void didRemoveClient(CachedResourceClient *) { }141 virtual void didAddClient(CachedResourceClient&); 142 virtual void didRemoveClient(CachedResourceClient&) { } 143 143 virtual void allClientsRemoved() { } 144 144 void destroyDecodedDataIfNeeded(); … … 304 304 void finishRequestInitialization(); 305 305 306 bool addClientToSet(CachedResourceClient *);306 bool addClientToSet(CachedResourceClient&); 307 307 308 308 void decodedDataDeletionTimerFired(); -
trunk/Source/WebCore/loader/cache/CachedSVGDocumentReference.cpp
r206203 r206867 45 45 { 46 46 if (m_document) 47 m_document->removeClient( this);47 m_document->removeClient(*this); 48 48 } 49 49 … … 59 59 m_document = loader.requestSVGDocument(WTFMove(request)); 60 60 if (m_document) 61 m_document->addClient( this);61 m_document->addClient(*this); 62 62 63 63 m_loadRequested = true; -
trunk/Source/WebCore/loader/cache/CachedXSLStyleSheet.cpp
r206206 r206867 47 47 } 48 48 49 void CachedXSLStyleSheet::didAddClient(CachedResourceClient * c)49 void CachedXSLStyleSheet::didAddClient(CachedResourceClient& client) 50 50 { 51 ASSERT(c ->resourceClientType() == CachedStyleSheetClient::expectedType());51 ASSERT(client.resourceClientType() == CachedStyleSheetClient::expectedType()); 52 52 if (!isLoading()) 53 static_cast<CachedStyleSheetClient *>(c)->setXSLStyleSheet(m_resourceRequest.url(), m_response.url(), m_sheet);53 static_cast<CachedStyleSheetClient&>(client).setXSLStyleSheet(m_resourceRequest.url(), m_response.url(), m_sheet); 54 54 } 55 55 -
trunk/Source/WebCore/loader/cache/CachedXSLStyleSheet.h
r206016 r206867 24 24 */ 25 25 26 #ifndef CachedXSLStyleSheet_h 27 #define CachedXSLStyleSheet_h 26 #pragma once 28 27 29 28 #if ENABLE(XSLT) … … 43 42 44 43 private: 45 void checkNotify() override;46 bool mayTryReplaceEncodedData() const override{ return true; }47 void didAddClient(CachedResourceClient *) override;48 void setEncoding(const String&) override;49 String encoding() const override;50 const TextResourceDecoder* textResourceDecoder() const override{ return m_decoder.get(); }51 void finishLoading(SharedBuffer*) override;44 void checkNotify() final; 45 bool mayTryReplaceEncodedData() const final { return true; } 46 void didAddClient(CachedResourceClient&) final; 47 void setEncoding(const String&) final; 48 String encoding() const final; 49 const TextResourceDecoder* textResourceDecoder() const final { return m_decoder.get(); } 50 void finishLoading(SharedBuffer*) final; 52 51 53 52 String m_sheet; … … 60 59 61 60 #endif // ENABLE(XSLT) 62 63 #endif // CachedXSLStyleSheet_h -
trunk/Source/WebCore/loader/cache/MemoryCache.cpp
r206635 r206867 224 224 auto cachedImage = std::make_unique<CachedImage>(url, bitmapImage.get(), sessionID); 225 225 226 cachedImage->addClient( &dummyCachedImageClient());226 cachedImage->addClient(dummyCachedImageClient()); 227 227 cachedImage->setDecodedSize(bitmapImage->decodedSize()); 228 228 #if ENABLE(CACHE_PARTITIONING) … … 259 259 // removing the last client triggers a MemoryCache::prune, so the 260 260 // resource may be deleted after this call. 261 downcast<CachedImage>(*resource).removeClient( &dummyCachedImageClient());261 downcast<CachedImage>(*resource).removeClient(dummyCachedImageClient()); 262 262 } 263 263 -
trunk/Source/WebCore/loader/icon/IconLoader.cpp
r206016 r206867 67 67 m_resource = m_frame.document()->cachedResourceLoader().requestRawResource(WTFMove(request)); 68 68 if (m_resource) 69 m_resource->addClient( this);69 m_resource->addClient(*this); 70 70 else 71 71 LOG_ERROR("Failed to start load for icon at url %s", m_frame.loader().icon().url().string().ascii().data()); … … 75 75 { 76 76 if (m_resource) { 77 m_resource->removeClient( this);77 m_resource->removeClient(*this); 78 78 m_resource = nullptr; 79 79 } -
trunk/Source/WebCore/platform/graphics/avfoundation/cf/WebCoreAVCFResourceLoader.cpp
r206016 r206867 78 78 m_resource = loader ? loader->requestRawResource(WTFMove(request)) : 0; 79 79 if (m_resource) 80 m_resource->addClient( this);80 m_resource->addClient(*this); 81 81 else { 82 82 LOG_ERROR("Failed to start load for media at url %s", URL(CFURLRequestGetURL(urlRequest.get())).string().ascii().data()); … … 91 91 return; 92 92 93 m_resource->removeClient( this);93 m_resource->removeClient(*this); 94 94 m_resource = 0; 95 95 -
trunk/Source/WebCore/platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.mm
r206185 r206867 76 76 77 77 if (m_resource) 78 m_resource->addClient( this);78 m_resource->addClient(*this); 79 79 else { 80 80 LOG_ERROR("Failed to start load for media at url %s", [[[nsRequest URL] absoluteString] UTF8String]); … … 88 88 return; 89 89 90 m_resource->removeClient( this);90 m_resource->removeClient(*this); 91 91 m_resource = 0; 92 92 -
trunk/Source/WebCore/rendering/RenderImageResource.cpp
r191083 r206867 58 58 59 59 if (m_cachedImage) 60 m_cachedImage->removeClient( m_renderer);60 m_cachedImage->removeClient(*m_renderer); 61 61 } 62 62 … … 69 69 70 70 if (m_cachedImage) 71 m_cachedImage->removeClient( m_renderer);71 m_cachedImage->removeClient(*m_renderer); 72 72 m_cachedImage = newImage; 73 73 if (m_cachedImage) { 74 m_cachedImage->addClient( m_renderer);74 m_cachedImage->addClient(*m_renderer); 75 75 if (m_cachedImage->errorOccurred()) 76 76 m_renderer->imageChanged(m_cachedImage.get()); -
trunk/Source/WebCore/rendering/RenderLayerFilterInfo.cpp
r201588 r206867 92 92 m_layer.filterNeedsRepaint(); 93 93 } 94 94 95 95 void RenderLayer::FilterInfo::updateReferenceFilterClients(const FilterOperations& operations) 96 96 { … … 103 103 if (auto* cachedSVGDocument = documentReference ? documentReference->document() : nullptr) { 104 104 // Reference is external; wait for notifyFinished(). 105 cachedSVGDocument->addClient( this);105 cachedSVGDocument->addClient(*this); 106 106 m_externalSVGReferences.append(cachedSVGDocument); 107 107 } else { … … 122 122 { 123 123 for (auto& resourceHandle : m_externalSVGReferences) 124 resourceHandle->removeClient( this);124 resourceHandle->removeClient(*this); 125 125 m_externalSVGReferences.clear(); 126 126 -
trunk/Source/WebCore/rendering/style/StyleCachedImage.cpp
r205997 r206867 177 177 if (!m_cachedImage) 178 178 return; 179 m_cachedImage->addClient(renderer); 179 ASSERT(renderer); 180 m_cachedImage->addClient(*renderer); 180 181 } 181 182 … … 185 186 if (!m_cachedImage) 186 187 return; 187 m_cachedImage->removeClient(renderer); 188 ASSERT(renderer); 189 m_cachedImage->removeClient(*renderer); 188 190 } 189 191 -
trunk/Source/WebCore/svg/SVGFEImageElement.cpp
r206016 r206867 77 77 { 78 78 if (m_cachedImage) { 79 m_cachedImage->removeClient( this);79 m_cachedImage->removeClient(*this); 80 80 m_cachedImage = nullptr; 81 81 } … … 94 94 95 95 if (m_cachedImage) 96 m_cachedImage->addClient( this);96 m_cachedImage->addClient(*this); 97 97 } 98 98 -
trunk/Source/WebCore/svg/SVGFontFaceUriElement.cpp
r206016 r206867 51 51 { 52 52 if (m_cachedFont) 53 m_cachedFont->removeClient( this);53 m_cachedFont->removeClient(*this); 54 54 } 55 55 … … 97 97 { 98 98 if (m_cachedFont) 99 m_cachedFont->removeClient( this);99 m_cachedFont->removeClient(*this); 100 100 101 101 const AtomicString& href = getAttribute(XLinkNames::hrefAttr); … … 109 109 m_cachedFont = cachedResourceLoader.requestFont(WTFMove(request), isSVGFontTarget(*this)); 110 110 if (m_cachedFont) { 111 m_cachedFont->addClient( this);111 m_cachedFont->addClient(*this); 112 112 m_cachedFont->beginLoadIfNeeded(cachedResourceLoader); 113 113 } -
trunk/Source/WebCore/svg/SVGUseElement.cpp
r206203 r206867 80 80 { 81 81 if (m_externalDocument) 82 m_externalDocument->removeClient( this);82 m_externalDocument->removeClient(*this); 83 83 } 84 84 … … 564 564 565 565 if (m_externalDocument) 566 m_externalDocument->removeClient( this);566 m_externalDocument->removeClient(*this); 567 567 568 568 if (externalDocumentURL.isNull()) … … 576 576 m_externalDocument = document().cachedResourceLoader().requestSVGDocument(WTFMove(request)); 577 577 if (m_externalDocument) 578 m_externalDocument->addClient( this);578 m_externalDocument->addClient(*this); 579 579 } 580 580 -
trunk/Source/WebCore/xml/XSLImportRule.cpp
r206203 r206867 44 44 if (m_styleSheet) 45 45 m_styleSheet->setParentStyleSheet(nullptr); 46 46 47 47 if (m_cachedSheet) 48 m_cachedSheet->removeClient( this);48 m_cachedSheet->removeClient(*this); 49 49 } 50 50 … … 62 62 m_styleSheet->parseString(sheet); 63 63 m_loading = false; 64 64 65 65 if (parent) 66 66 parent->checkLoaded(); … … 85 85 if (rootSheet) 86 86 cachedResourceLoader = rootSheet->cachedResourceLoader(); 87 87 88 88 String absHref = m_strHref; 89 89 XSLStyleSheet* parentSheet = parentStyleSheet(); … … 100 100 101 101 if (m_cachedSheet) 102 m_cachedSheet->removeClient( this);102 m_cachedSheet->removeClient(*this); 103 103 104 104 auto options = CachedResourceLoader::defaultCachedResourceOptions(); … … 107 107 108 108 if (m_cachedSheet) { 109 m_cachedSheet->addClient( this);109 m_cachedSheet->addClient(*this); 110 110 111 111 // If the imported sheet is in the cache, then setXSLStyleSheet gets called, -
trunk/Source/WebCore/xml/parser/XMLDocumentParser.cpp
r206361 r206867 238 238 bool wasCanceled = m_pendingScript->wasCanceled(); 239 239 240 m_pendingScript->removeClient( this);240 m_pendingScript->removeClient(*this); 241 241 m_pendingScript = nullptr; 242 242 -
trunk/Source/WebCore/xml/parser/XMLDocumentParserLibxml2.cpp
r206361 r206867 667 667 // FIXME: m_pendingScript handling should be moved into XMLDocumentParser.cpp! 668 668 if (m_pendingScript) 669 m_pendingScript->removeClient( this);669 m_pendingScript->removeClient(*this); 670 670 } 671 671 … … 928 928 m_pendingScript = &downcast<LoadableClassicScript>(*scriptElement->loadableScript()).cachedScript(); 929 929 m_scriptElement = &element; 930 m_pendingScript->addClient( this);930 m_pendingScript->addClient(*this); 931 931 932 932 // m_pendingScript will be 0 if script was already loaded and addClient() executed it. -
trunk/Source/WebKit/mac/ChangeLog
r206839 r206867 1 2016-10-06 Youenn Fablet <youenn@apple.com> 2 3 CachedResource client handling methods should take reference 4 https://bugs.webkit.org/show_bug.cgi?id=163014 5 6 Reviewed by Alex Christensen. 7 8 * WebView/WebHTMLView.mm: 9 (promisedDataClient): 10 1 11 2016-10-05 Myles C. Maxfield <mmaxfield@apple.com> 2 12 -
trunk/Source/WebKit/mac/WebView/WebHTMLView.mm
r206802 r206867 790 790 #if !PLATFORM(IOS) 791 791 // We need this to be able to safely reference the CachedImage for the promised drag data 792 static CachedImageClient *promisedDataClient()792 static CachedImageClient& promisedDataClient() 793 793 { 794 794 static CachedImageClient* staticCachedResourceClient = new CachedImageClient; 795 return staticCachedResourceClient;795 return *staticCachedResourceClient; 796 796 } 797 797 #endif
Note: See TracChangeset
for help on using the changeset viewer.