| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Apple Inc. All rights reserved. | 2 * Copyright (C) 2012 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 | 34 |
| 35 StyleFetchedImageSet::StyleFetchedImageSet(ImageResource* image, | 35 StyleFetchedImageSet::StyleFetchedImageSet(ImageResource* image, |
| 36 float imageScaleFactor, | 36 float imageScaleFactor, |
| 37 CSSImageSetValue* value, | 37 CSSImageSetValue* value, |
| 38 const KURL& url) | 38 const KURL& url) |
| 39 : m_bestFitImage(image), | 39 : m_bestFitImage(image), |
| 40 m_imageScaleFactor(imageScaleFactor), | 40 m_imageScaleFactor(imageScaleFactor), |
| 41 m_imageSetValue(value), | 41 m_imageSetValue(value), |
| 42 m_url(url) { | 42 m_url(url) { |
| 43 m_isImageResourceSet = true; | 43 m_isImageResourceSet = true; |
| 44 m_bestFitImage->addClient(this); | |
| 45 ThreadState::current()->registerPreFinalizer(this); | |
| 46 } | 44 } |
| 47 | 45 |
| 48 StyleFetchedImageSet::~StyleFetchedImageSet() {} | 46 StyleFetchedImageSet::~StyleFetchedImageSet() {} |
| 49 | 47 |
| 50 void StyleFetchedImageSet::dispose() { | |
| 51 m_bestFitImage->removeClient(this); | |
| 52 m_bestFitImage = nullptr; | |
| 53 } | |
| 54 | |
| 55 WrappedImagePtr StyleFetchedImageSet::data() const { | 48 WrappedImagePtr StyleFetchedImageSet::data() const { |
| 56 return cachedImage(); | 49 return cachedImage(); |
| 57 } | 50 } |
| 58 | 51 |
| 59 ImageResource* StyleFetchedImageSet::cachedImage() const { | 52 ImageResource* StyleFetchedImageSet::cachedImage() const { |
| 60 return m_bestFitImage.get(); | 53 return m_bestFitImage.get(); |
| 61 } | 54 } |
| 62 | 55 |
| 63 CSSValue* StyleFetchedImageSet::cssValue() const { | 56 CSSValue* StyleFetchedImageSet::cssValue() const { |
| 64 return m_imageSetValue; | 57 return m_imageSetValue; |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 "data", | 125 "data", |
| 133 InspectorPaintImageEvent::data(&layoutObject, *cachedImage())); | 126 InspectorPaintImageEvent::data(&layoutObject, *cachedImage())); |
| 134 return cachedImage()->getImage()->currentFrameKnownToBeOpaque( | 127 return cachedImage()->getImage()->currentFrameKnownToBeOpaque( |
| 135 Image::PreCacheMetadata); | 128 Image::PreCacheMetadata); |
| 136 } | 129 } |
| 137 | 130 |
| 138 DEFINE_TRACE(StyleFetchedImageSet) { | 131 DEFINE_TRACE(StyleFetchedImageSet) { |
| 139 visitor->trace(m_bestFitImage); | 132 visitor->trace(m_bestFitImage); |
| 140 visitor->trace(m_imageSetValue); | 133 visitor->trace(m_imageSetValue); |
| 141 StyleImage::trace(visitor); | 134 StyleImage::trace(visitor); |
| 142 ResourceClient::trace(visitor); | |
| 143 } | 135 } |
| 144 | 136 |
| 145 } // namespace blink | 137 } // namespace blink |
| OLD | NEW |