| OLD | NEW | 
|    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 16 matching lines...) Expand all  Loading... | 
|   27 #include "bindings/core/v8/V8Binding.h" |   27 #include "bindings/core/v8/V8Binding.h" | 
|   28 #include "bindings/core/v8/V8PerIsolateData.h" |   28 #include "bindings/core/v8/V8PerIsolateData.h" | 
|   29 #include "core/dom/Document.h" |   29 #include "core/dom/Document.h" | 
|   30 #include "core/dom/Element.h" |   30 #include "core/dom/Element.h" | 
|   31 #include "core/dom/IncrementLoadEventDelayCount.h" |   31 #include "core/dom/IncrementLoadEventDelayCount.h" | 
|   32 #include "core/events/Event.h" |   32 #include "core/events/Event.h" | 
|   33 #include "core/events/EventSender.h" |   33 #include "core/events/EventSender.h" | 
|   34 #include "core/fetch/FetchRequest.h" |   34 #include "core/fetch/FetchRequest.h" | 
|   35 #include "core/fetch/MemoryCache.h" |   35 #include "core/fetch/MemoryCache.h" | 
|   36 #include "core/fetch/ResourceFetcher.h" |   36 #include "core/fetch/ResourceFetcher.h" | 
 |   37 #include "core/fetch/ResourceLoadingLog.h" | 
|   37 #include "core/frame/LocalFrame.h" |   38 #include "core/frame/LocalFrame.h" | 
|   38 #include "core/frame/Settings.h" |   39 #include "core/frame/Settings.h" | 
|   39 #include "core/frame/UseCounter.h" |   40 #include "core/frame/UseCounter.h" | 
|   40 #include "core/html/CrossOriginAttribute.h" |   41 #include "core/html/CrossOriginAttribute.h" | 
|   41 #include "core/html/HTMLImageElement.h" |   42 #include "core/html/HTMLImageElement.h" | 
|   42 #include "core/html/parser/HTMLParserIdioms.h" |   43 #include "core/html/parser/HTMLParserIdioms.h" | 
|   43 #include "core/inspector/InspectorInstrumentation.h" |   44 #include "core/inspector/InspectorInstrumentation.h" | 
|   44 #include "core/layout/LayoutImage.h" |   45 #include "core/layout/LayoutImage.h" | 
|   45 #include "core/layout/LayoutVideo.h" |   46 #include "core/layout/LayoutVideo.h" | 
|   46 #include "core/layout/svg/LayoutSVGImage.h" |   47 #include "core/layout/svg/LayoutSVGImage.h" | 
|   47 #include "core/svg/graphics/SVGImage.h" |   48 #include "core/svg/graphics/SVGImage.h" | 
|   48 #include "platform/Logging.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/WebCachePolicy.h" |   51 #include "public/platform/WebCachePolicy.h" | 
|   52 #include "public/platform/WebURLRequest.h" |   52 #include "public/platform/WebURLRequest.h" | 
|   53 #include "wtf/PtrUtil.h" |   53 #include "wtf/PtrUtil.h" | 
|   54 #include <memory> |   54 #include <memory> | 
|   55  |   55  | 
|   56 namespace blink { |   56 namespace blink { | 
|   57  |   57  | 
|   58 static ImageEventSender& loadEventSender() |   58 static ImageEventSender& loadEventSender() | 
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  148 ImageLoader::ImageLoader(Element* element) |  148 ImageLoader::ImageLoader(Element* element) | 
|  149     : m_element(element) |  149     : m_element(element) | 
|  150     , m_derefElementTimer(this, &ImageLoader::timerFired) |  150     , m_derefElementTimer(this, &ImageLoader::timerFired) | 
|  151     , m_hasPendingLoadEvent(false) |  151     , m_hasPendingLoadEvent(false) | 
|  152     , m_hasPendingErrorEvent(false) |  152     , m_hasPendingErrorEvent(false) | 
|  153     , m_imageComplete(true) |  153     , m_imageComplete(true) | 
|  154     , m_loadingImageDocument(false) |  154     , m_loadingImageDocument(false) | 
|  155     , m_elementIsProtected(false) |  155     , m_elementIsProtected(false) | 
|  156     , m_suppressErrorEvents(false) |  156     , m_suppressErrorEvents(false) | 
|  157 { |  157 { | 
|  158     WTF_LOG(ResourceLoading, "new ImageLoader %p", this); |  158     RESOURCE_LOADING_DVLOG(1) << "new ImageLoader " << this; | 
|  159     ThreadState::current()->registerPreFinalizer(this); |  159     ThreadState::current()->registerPreFinalizer(this); | 
|  160 } |  160 } | 
|  161  |  161  | 
|  162 ImageLoader::~ImageLoader() |  162 ImageLoader::~ImageLoader() | 
|  163 { |  163 { | 
|  164 } |  164 } | 
|  165  |  165  | 
|  166 void ImageLoader::dispose() |  166 void ImageLoader::dispose() | 
|  167 { |  167 { | 
|  168     WTF_LOG(ResourceLoading, "~ImageLoader %p; m_hasPendingLoadEvent=%d, m_hasPe
     ndingErrorEvent=%d", |  168     RESOURCE_LOADING_DVLOG(1) << "~ImageLoader " << this | 
|  169         this, m_hasPendingLoadEvent, m_hasPendingErrorEvent); |  169         << "; m_hasPendingLoadEvent=" << m_hasPendingLoadEvent | 
 |  170         << ", m_hasPendingErrorEvent=" << m_hasPendingErrorEvent; | 
|  170  |  171  | 
|  171     if (m_image) { |  172     if (m_image) { | 
|  172         m_image->removeObserver(this); |  173         m_image->removeObserver(this); | 
|  173         m_image = nullptr; |  174         m_image = nullptr; | 
|  174     } |  175     } | 
|  175 } |  176 } | 
|  176  |  177  | 
|  177 DEFINE_TRACE(ImageLoader) |  178 DEFINE_TRACE(ImageLoader) | 
|  178 { |  179 { | 
|  179     visitor->trace(m_image); |  180     visitor->trace(m_image); | 
| (...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  426     if (!url.isNull()) { |  427     if (!url.isNull()) { | 
|  427         Resource* resource = memoryCache()->resourceForURL(url, m_element->docum
     ent().fetcher()->getCacheIdentifier()); |  428         Resource* resource = memoryCache()->resourceForURL(url, m_element->docum
     ent().fetcher()->getCacheIdentifier()); | 
|  428         if (resource && !resource->errorOccurred()) |  429         if (resource && !resource->errorOccurred()) | 
|  429             return true; |  430             return true; | 
|  430     } |  431     } | 
|  431     return (isHTMLObjectElement(m_element) || isHTMLEmbedElement(m_element) || u
     rl.protocolIsData()); |  432     return (isHTMLObjectElement(m_element) || isHTMLEmbedElement(m_element) || u
     rl.protocolIsData()); | 
|  432 } |  433 } | 
|  433  |  434  | 
|  434 void ImageLoader::imageNotifyFinished(ImageResource* resource) |  435 void ImageLoader::imageNotifyFinished(ImageResource* resource) | 
|  435 { |  436 { | 
|  436     WTF_LOG(ResourceLoading, "ImageLoader::imageNotifyFinished %p; m_hasPendingL
     oadEvent=%d", |  437     RESOURCE_LOADING_DVLOG(1) << "ImageLoader::imageNotifyFinished " << this | 
|  437         this, m_hasPendingLoadEvent); |  438         << "; m_hasPendingLoadEvent=" << m_hasPendingLoadEvent; | 
|  438  |  439  | 
|  439     ASSERT(m_failedLoadURL.isEmpty()); |  440     ASSERT(m_failedLoadURL.isEmpty()); | 
|  440     ASSERT(resource == m_image.get()); |  441     ASSERT(resource == m_image.get()); | 
|  441  |  442  | 
|  442     m_imageComplete = true; |  443     m_imageComplete = true; | 
|  443  |  444  | 
|  444     // Update ImageAnimationPolicy for m_image. |  445     // Update ImageAnimationPolicy for m_image. | 
|  445     if (m_image) |  446     if (m_image) | 
|  446         m_image->updateImageAnimationPolicy(); |  447         m_image->updateImageAnimationPolicy(); | 
|  447  |  448  | 
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  538     } |  539     } | 
|  539 } |  540 } | 
|  540  |  541  | 
|  541 void ImageLoader::timerFired(TimerBase*) |  542 void ImageLoader::timerFired(TimerBase*) | 
|  542 { |  543 { | 
|  543     m_keepAlive.clear(); |  544     m_keepAlive.clear(); | 
|  544 } |  545 } | 
|  545  |  546  | 
|  546 void ImageLoader::dispatchPendingEvent(ImageEventSender* eventSender) |  547 void ImageLoader::dispatchPendingEvent(ImageEventSender* eventSender) | 
|  547 { |  548 { | 
|  548     WTF_LOG(ResourceLoading, "ImageLoader::dispatchPendingEvent %p", this); |  549     RESOURCE_LOADING_DVLOG(1) << "ImageLoader::dispatchPendingEvent " << this; | 
|  549     ASSERT(eventSender == &loadEventSender() || eventSender == &errorEventSender
     ()); |  550     ASSERT(eventSender == &loadEventSender() || eventSender == &errorEventSender
     ()); | 
|  550     const AtomicString& eventType = eventSender->eventType(); |  551     const AtomicString& eventType = eventSender->eventType(); | 
|  551     if (eventType == EventTypeNames::load) |  552     if (eventType == EventTypeNames::load) | 
|  552         dispatchPendingLoadEvent(); |  553         dispatchPendingLoadEvent(); | 
|  553     if (eventType == EventTypeNames::error) |  554     if (eventType == EventTypeNames::error) | 
|  554         dispatchPendingErrorEvent(); |  555         dispatchPendingErrorEvent(); | 
|  555 } |  556 } | 
|  556  |  557  | 
|  557 void ImageLoader::dispatchPendingLoadEvent() |  558 void ImageLoader::dispatchPendingLoadEvent() | 
|  558 { |  559 { | 
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  604  |  605  | 
|  605 void ImageLoader::elementDidMoveToNewDocument() |  606 void ImageLoader::elementDidMoveToNewDocument() | 
|  606 { |  607 { | 
|  607     if (m_loadDelayCounter) |  608     if (m_loadDelayCounter) | 
|  608         m_loadDelayCounter->documentChanged(m_element->document()); |  609         m_loadDelayCounter->documentChanged(m_element->document()); | 
|  609     clearFailedLoadURL(); |  610     clearFailedLoadURL(); | 
|  610     setImage(0); |  611     setImage(0); | 
|  611 } |  612 } | 
|  612  |  613  | 
|  613 } // namespace blink |  614 } // namespace blink | 
| OLD | NEW |