Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(448)

Side by Side Diff: third_party/WebKit/Source/core/loader/ImageLoader.cpp

Issue 1686483002: Oilpan: Remove most WillBe types from the code base (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * Copyright (C) 2004, 2005, 2006, 2007, 2009, 2010 Apple Inc. All rights reserv ed. 4 * Copyright (C) 2004, 2005, 2006, 2007, 2009, 2010 Apple Inc. All rights reserv ed.
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 #include "platform/Logging.h" 47 #include "platform/Logging.h"
48 #include "platform/RuntimeEnabledFeatures.h" 48 #include "platform/RuntimeEnabledFeatures.h"
49 #include "platform/weborigin/SecurityOrigin.h" 49 #include "platform/weborigin/SecurityOrigin.h"
50 #include "platform/weborigin/SecurityPolicy.h" 50 #include "platform/weborigin/SecurityPolicy.h"
51 #include "public/platform/WebURLRequest.h" 51 #include "public/platform/WebURLRequest.h"
52 52
53 namespace blink { 53 namespace blink {
54 54
55 static ImageEventSender& loadEventSender() 55 static ImageEventSender& loadEventSender()
56 { 56 {
57 DEFINE_STATIC_LOCAL(OwnPtrWillBePersistent<ImageEventSender>, sender, (Image EventSender::create(EventTypeNames::load))); 57 DEFINE_STATIC_LOCAL(Persistent<ImageEventSender>, sender, (ImageEventSender: :create(EventTypeNames::load)));
58 return *sender; 58 return *sender;
59 } 59 }
60 60
61 static ImageEventSender& errorEventSender() 61 static ImageEventSender& errorEventSender()
62 { 62 {
63 DEFINE_STATIC_LOCAL(OwnPtrWillBePersistent<ImageEventSender>, sender, (Image EventSender::create(EventTypeNames::error))); 63 DEFINE_STATIC_LOCAL(Persistent<ImageEventSender>, sender, (ImageEventSender: :create(EventTypeNames::error)));
64 return *sender; 64 return *sender;
65 } 65 }
66 66
67 static inline bool pageIsBeingDismissed(Document* document) 67 static inline bool pageIsBeingDismissed(Document* document)
68 { 68 {
69 return document->pageDismissalEventBeingDispatched() != Document::NoDismissa l; 69 return document->pageDismissalEventBeingDispatched() != Document::NoDismissa l;
70 } 70 }
71 71
72 static ImageLoader::BypassMainWorldBehavior shouldBypassMainWorldCSP(ImageLoader * loader) 72 static ImageLoader::BypassMainWorldBehavior shouldBypassMainWorldCSP(ImageLoader * loader)
73 { 73 {
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 m_loader = nullptr; 125 m_loader = nullptr;
126 m_scriptState.clear(); 126 m_scriptState.clear();
127 } 127 }
128 128
129 WeakPtr<Task> createWeakPtr() 129 WeakPtr<Task> createWeakPtr()
130 { 130 {
131 return m_weakFactory.createWeakPtr(); 131 return m_weakFactory.createWeakPtr();
132 } 132 }
133 133
134 private: 134 private:
135 RawPtrWillBeWeakPersistent<ImageLoader> m_loader; 135 WeakPersistent<ImageLoader> m_loader;
136 BypassMainWorldBehavior m_shouldBypassMainWorldCSP; 136 BypassMainWorldBehavior m_shouldBypassMainWorldCSP;
137 UpdateFromElementBehavior m_updateBehavior; 137 UpdateFromElementBehavior m_updateBehavior;
138 RefPtr<ScriptState> m_scriptState; 138 RefPtr<ScriptState> m_scriptState;
139 WeakPtrFactory<Task> m_weakFactory; 139 WeakPtrFactory<Task> m_weakFactory;
140 ReferrerPolicy m_referrerPolicy; 140 ReferrerPolicy m_referrerPolicy;
141 }; 141 };
142 142
143 ImageLoader::ImageLoader(Element* element) 143 ImageLoader::ImageLoader(Element* element)
144 : m_element(element) 144 : m_element(element)
145 , m_derefElementTimer(this, &ImageLoader::timerFired) 145 , m_derefElementTimer(this, &ImageLoader::timerFired)
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 // Make sure to only decrement the count when we exit this function 305 // Make sure to only decrement the count when we exit this function
306 OwnPtr<IncrementLoadEventDelayCount> loadDelayCounter; 306 OwnPtr<IncrementLoadEventDelayCount> loadDelayCounter;
307 loadDelayCounter.swap(m_loadDelayCounter); 307 loadDelayCounter.swap(m_loadDelayCounter);
308 308
309 Document& document = m_element->document(); 309 Document& document = m_element->document();
310 if (!document.isActive()) 310 if (!document.isActive())
311 return; 311 return;
312 312
313 AtomicString imageSourceURL = m_element->imageSourceURL(); 313 AtomicString imageSourceURL = m_element->imageSourceURL();
314 KURL url = imageSourceToKURL(imageSourceURL); 314 KURL url = imageSourceToKURL(imageSourceURL);
315 RefPtrWillBeRawPtr<ImageResource> newImage = nullptr; 315 RawPtr<ImageResource> newImage = nullptr;
316 RefPtrWillBeRawPtr<Element> protectElement(m_element.get()); 316 RawPtr<Element> protectElement(m_element.get());
317 if (!url.isNull()) { 317 if (!url.isNull()) {
318 // Unlike raw <img>, we block mixed content inside of <picture> or <img srcset>. 318 // Unlike raw <img>, we block mixed content inside of <picture> or <img srcset>.
319 ResourceLoaderOptions resourceLoaderOptions = ResourceFetcher::defaultRe sourceOptions(); 319 ResourceLoaderOptions resourceLoaderOptions = ResourceFetcher::defaultRe sourceOptions();
320 ResourceRequest resourceRequest(url); 320 ResourceRequest resourceRequest(url);
321 resourceRequest.setFetchCredentialsMode(WebURLRequest::FetchCredentialsM odeSameOrigin); 321 resourceRequest.setFetchCredentialsMode(WebURLRequest::FetchCredentialsM odeSameOrigin);
322 if (updateBehavior == UpdateForcedReload) { 322 if (updateBehavior == UpdateForcedReload) {
323 resourceRequest.setCachePolicy(ResourceRequestCachePolicy::ReloadByp assingCache); 323 resourceRequest.setCachePolicy(ResourceRequestCachePolicy::ReloadByp assingCache);
324 resourceRequest.setLoFiState(WebURLRequest::LoFiOff); 324 resourceRequest.setLoFiState(WebURLRequest::LoFiOff);
325 // ImageLoader defers the load of images when in an ImageDocument. 325 // ImageLoader defers the load of images when in an ImageDocument.
326 // Don't defer this load on a forced reload. 326 // Don't defer this load on a forced reload.
(...skipping 28 matching lines...) Expand all
355 clearFailedLoadURL(); 355 clearFailedLoadURL();
356 } 356 }
357 } else { 357 } else {
358 if (!imageSourceURL.isNull()) { 358 if (!imageSourceURL.isNull()) {
359 // Fire an error event if the url string is not empty, but the KURL is. 359 // Fire an error event if the url string is not empty, but the KURL is.
360 dispatchErrorEvent(); 360 dispatchErrorEvent();
361 } 361 }
362 noImageResourceToLoad(); 362 noImageResourceToLoad();
363 } 363 }
364 364
365 RefPtrWillBeRawPtr<ImageResource> oldImage = m_image.get(); 365 RawPtr<ImageResource> oldImage = m_image.get();
366 if (updateBehavior == UpdateSizeChanged && m_element->layoutObject() && m_el ement->layoutObject()->isImage() && newImage == oldImage) { 366 if (updateBehavior == UpdateSizeChanged && m_element->layoutObject() && m_el ement->layoutObject()->isImage() && newImage == oldImage) {
367 toLayoutImage(m_element->layoutObject())->intrinsicSizeChanged(); 367 toLayoutImage(m_element->layoutObject())->intrinsicSizeChanged();
368 } else { 368 } else {
369 if (newImage != oldImage) 369 if (newImage != oldImage)
370 sourceImageChanged(); 370 sourceImageChanged();
371 371
372 if (m_hasPendingLoadEvent) { 372 if (m_hasPendingLoadEvent) {
373 loadEventSender().cancelEvent(this); 373 loadEventSender().cancelEvent(this);
374 m_hasPendingLoadEvent = false; 374 m_hasPendingLoadEvent = false;
375 } 375 }
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
682 682
683 void ImageLoader::sourceImageChanged() 683 void ImageLoader::sourceImageChanged()
684 { 684 {
685 for (auto& client : m_clients) { 685 for (auto& client : m_clients) {
686 ImageLoaderClient* handle = client; 686 ImageLoaderClient* handle = client;
687 handle->notifyImageSourceChanged(); 687 handle->notifyImageSourceChanged();
688 } 688 }
689 } 689 }
690 690
691 } // namespace blink 691 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698