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

Side by Side Diff: third_party/WebKit/Source/core/css/CSSCrossfadeValue.cpp

Issue 1667843003: Make Resource RefCountedWillBeGarbageCollectedFinalized, attempt #2 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase + address review comments 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) 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2011 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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 118
119 CSSCrossfadeValue::~CSSCrossfadeValue() 119 CSSCrossfadeValue::~CSSCrossfadeValue()
120 { 120 {
121 #if !ENABLE(OILPAN) 121 #if !ENABLE(OILPAN)
122 dispose(); 122 dispose();
123 #endif 123 #endif
124 } 124 }
125 125
126 void CSSCrossfadeValue::dispose() 126 void CSSCrossfadeValue::dispose()
127 { 127 {
128 if (m_cachedFromImage) 128 if (m_cachedFromImage) {
129 m_cachedFromImage->removeClient(&m_crossfadeSubimageObserver); 129 m_cachedFromImage->removeClient(&m_crossfadeSubimageObserver);
130 if (m_cachedToImage) 130 m_cachedFromImage = nullptr;
131 }
132 if (m_cachedToImage) {
131 m_cachedToImage->removeClient(&m_crossfadeSubimageObserver); 133 m_cachedToImage->removeClient(&m_crossfadeSubimageObserver);
134 m_cachedToImage = nullptr;
135 }
132 } 136 }
133 137
134 String CSSCrossfadeValue::customCSSText() const 138 String CSSCrossfadeValue::customCSSText() const
135 { 139 {
136 StringBuilder result; 140 StringBuilder result;
137 result.appendLiteral("-webkit-cross-fade("); 141 result.appendLiteral("-webkit-cross-fade(");
138 result.append(m_fromValue->cssText()); 142 result.append(m_fromValue->cssText());
139 result.appendLiteral(", "); 143 result.appendLiteral(", ");
140 result.append(m_toValue->cssText()); 144 result.append(m_toValue->cssText());
141 result.appendLiteral(", "); 145 result.appendLiteral(", ");
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 return subimageIsPending(m_fromValue.get()) || subimageIsPending(m_toValue.g et()); 187 return subimageIsPending(m_fromValue.get()) || subimageIsPending(m_toValue.g et());
184 } 188 }
185 189
186 bool CSSCrossfadeValue::knownToBeOpaque(const LayoutObject* layoutObject) const 190 bool CSSCrossfadeValue::knownToBeOpaque(const LayoutObject* layoutObject) const
187 { 191 {
188 return subimageKnownToBeOpaque(m_fromValue.get(), layoutObject) && subimageK nownToBeOpaque(m_toValue.get(), layoutObject); 192 return subimageKnownToBeOpaque(m_fromValue.get(), layoutObject) && subimageK nownToBeOpaque(m_toValue.get(), layoutObject);
189 } 193 }
190 194
191 void CSSCrossfadeValue::loadSubimages(Document* document) 195 void CSSCrossfadeValue::loadSubimages(Document* document)
192 { 196 {
193 ResourcePtr<ImageResource> oldCachedFromImage = m_cachedFromImage; 197 RefPtrWillBeRawPtr<ImageResource> oldCachedFromImage = m_cachedFromImage;
194 ResourcePtr<ImageResource> oldCachedToImage = m_cachedToImage; 198 RefPtrWillBeRawPtr<ImageResource> oldCachedToImage = m_cachedToImage;
195 199
196 m_cachedFromImage = cachedImageForCSSValue(m_fromValue.get(), document); 200 m_cachedFromImage = cachedImageForCSSValue(m_fromValue.get(), document);
197 m_cachedToImage = cachedImageForCSSValue(m_toValue.get(), document); 201 m_cachedToImage = cachedImageForCSSValue(m_toValue.get(), document);
198 202
199 if (m_cachedFromImage != oldCachedFromImage) { 203 if (m_cachedFromImage != oldCachedFromImage) {
200 if (oldCachedFromImage) 204 if (oldCachedFromImage)
201 oldCachedFromImage->removeClient(&m_crossfadeSubimageObserver); 205 oldCachedFromImage->removeClient(&m_crossfadeSubimageObserver);
202 if (m_cachedFromImage) 206 if (m_cachedFromImage)
203 m_cachedFromImage->addClient(&m_crossfadeSubimageObserver); 207 m_cachedFromImage->addClient(&m_crossfadeSubimageObserver);
204 } 208 }
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 return compareCSSValuePtr(m_fromValue, other.m_fromValue) 270 return compareCSSValuePtr(m_fromValue, other.m_fromValue)
267 && compareCSSValuePtr(m_toValue, other.m_toValue) 271 && compareCSSValuePtr(m_toValue, other.m_toValue)
268 && compareCSSValuePtr(m_percentageValue, other.m_percentageValue); 272 && compareCSSValuePtr(m_percentageValue, other.m_percentageValue);
269 } 273 }
270 274
271 DEFINE_TRACE_AFTER_DISPATCH(CSSCrossfadeValue) 275 DEFINE_TRACE_AFTER_DISPATCH(CSSCrossfadeValue)
272 { 276 {
273 visitor->trace(m_fromValue); 277 visitor->trace(m_fromValue);
274 visitor->trace(m_toValue); 278 visitor->trace(m_toValue);
275 visitor->trace(m_percentageValue); 279 visitor->trace(m_percentageValue);
280 visitor->trace(m_cachedFromImage);
281 visitor->trace(m_cachedToImage);
276 visitor->trace(m_crossfadeSubimageObserver); 282 visitor->trace(m_crossfadeSubimageObserver);
277 CSSImageGeneratorValue::traceAfterDispatch(visitor); 283 CSSImageGeneratorValue::traceAfterDispatch(visitor);
278 } 284 }
279 285
280 } // namespace blink 286 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/css/CSSCrossfadeValue.h ('k') | third_party/WebKit/Source/core/css/CSSFontFaceSrcValue.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698