Title: [97491] trunk/Source/WebCore
- Revision
- 97491
- Author
- [email protected]
- Date
- 2011-10-14 12:31:57 -0700 (Fri, 14 Oct 2011)
Log Message
Check CachedResourceClient types with ASSERTs rather
than if statements.
https://bugs.webkit.org/show_bug.cgi?id=70113
Reviewed by Adam Barth.
No new tests, no functionality change.
* loader/cache/CachedCSSStyleSheet.cpp:
* loader/cache/CachedFont.cpp:
* loader/cache/CachedImage.cpp:
* loader/cache/CachedResourceClientWalker.h:
* loader/cache/CachedXSLStyleSheet.cpp:
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (97490 => 97491)
--- trunk/Source/WebCore/ChangeLog 2011-10-14 19:18:30 UTC (rev 97490)
+++ trunk/Source/WebCore/ChangeLog 2011-10-14 19:31:57 UTC (rev 97491)
@@ -1,3 +1,19 @@
+2011-10-14 Nate Chapin <[email protected]>
+
+ Check CachedResourceClient types with ASSERTs rather
+ than if statements.
+ https://bugs.webkit.org/show_bug.cgi?id=70113
+
+ Reviewed by Adam Barth.
+
+ No new tests, no functionality change.
+
+ * loader/cache/CachedCSSStyleSheet.cpp:
+ * loader/cache/CachedFont.cpp:
+ * loader/cache/CachedImage.cpp:
+ * loader/cache/CachedResourceClientWalker.h:
+ * loader/cache/CachedXSLStyleSheet.cpp:
+
2011-10-14 Andreas Kling <[email protected]>
Don't assert that CSSRules are CSSRules.
Modified: trunk/Source/WebCore/loader/cache/CachedCSSStyleSheet.cpp (97490 => 97491)
--- trunk/Source/WebCore/loader/cache/CachedCSSStyleSheet.cpp 2011-10-14 19:18:30 UTC (rev 97490)
+++ trunk/Source/WebCore/loader/cache/CachedCSSStyleSheet.cpp 2011-10-14 19:31:57 UTC (rev 97491)
@@ -52,7 +52,8 @@
void CachedCSSStyleSheet::didAddClient(CachedResourceClient* c)
{
- if (!isLoading() && c->resourceClientType() == CachedStyleSheetClient::expectedType())
+ ASSERT(c->resourceClientType() == CachedStyleSheetClient::expectedType());
+ if (!isLoading())
static_cast<CachedStyleSheetClient*>(c)->setCSSStyleSheet(m_resourceRequest.url(), m_response.url(), m_decoder->encoding().name(), this);
}
Modified: trunk/Source/WebCore/loader/cache/CachedFont.cpp (97490 => 97491)
--- trunk/Source/WebCore/loader/cache/CachedFont.cpp 2011-10-14 19:18:30 UTC (rev 97490)
+++ trunk/Source/WebCore/loader/cache/CachedFont.cpp 2011-10-14 19:31:57 UTC (rev 97491)
@@ -79,7 +79,8 @@
void CachedFont::didAddClient(CachedResourceClient* c)
{
- if (!isLoading() && c->resourceClientType() == CachedFontClient::expectedType())
+ ASSERT(c->resourceClientType() == CachedFontClient::expectedType());
+ if (!isLoading())
static_cast<CachedFontClient*>(c)->fontLoaded(this);
}
Modified: trunk/Source/WebCore/loader/cache/CachedImage.cpp (97490 => 97491)
--- trunk/Source/WebCore/loader/cache/CachedImage.cpp 2011-10-14 19:18:30 UTC (rev 97490)
+++ trunk/Source/WebCore/loader/cache/CachedImage.cpp 2011-10-14 19:31:57 UTC (rev 97491)
@@ -98,8 +98,9 @@
createImage();
m_image->setData(m_data, true);
}
-
- if (m_image && !m_image->isNull() && c->resourceClientType() == CachedImageClient::expectedType())
+
+ ASSERT(c->resourceClientType() == CachedImageClient::expectedType());
+ if (m_image && !m_image->isNull())
static_cast<CachedImageClient*>(c)->imageChanged(this);
CachedResource::didAddClient(c);
Modified: trunk/Source/WebCore/loader/cache/CachedResourceClientWalker.h (97490 => 97491)
--- trunk/Source/WebCore/loader/cache/CachedResourceClientWalker.h 2011-10-14 19:18:30 UTC (rev 97490)
+++ trunk/Source/WebCore/loader/cache/CachedResourceClientWalker.h 2011-10-14 19:31:57 UTC (rev 97491)
@@ -50,8 +50,10 @@
size_t size = m_clientVector.size();
while (m_index < size) {
CachedResourceClient* next = m_clientVector[m_index++];
- if (m_clientSet.contains(next) && (T::expectedType() == CachedResourceClient::expectedType() || next->resourceClientType() == T::expectedType()))
+ if (m_clientSet.contains(next)) {
+ ASSERT(T::expectedType() == CachedResourceClient::expectedType() || next->resourceClientType() == T::expectedType());
return static_cast<T*>(next);
+ }
}
return 0;
Modified: trunk/Source/WebCore/loader/cache/CachedXSLStyleSheet.cpp (97490 => 97491)
--- trunk/Source/WebCore/loader/cache/CachedXSLStyleSheet.cpp 2011-10-14 19:18:30 UTC (rev 97490)
+++ trunk/Source/WebCore/loader/cache/CachedXSLStyleSheet.cpp 2011-10-14 19:31:57 UTC (rev 97491)
@@ -48,7 +48,8 @@
void CachedXSLStyleSheet::didAddClient(CachedResourceClient* c)
{
- if (!isLoading() && c->resourceClientType() == CachedStyleSheetClient::expectedType())
+ ASSERT(c->resourceClientType() == CachedStyleSheetClient::expectedType());
+ if (!isLoading())
static_cast<CachedStyleSheetClient*>(c)->setXSLStyleSheet(m_resourceRequest.url(), m_response.url(), m_sheet);
}
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes