2010-05-15  Simon Fraser  <simon.fraser@apple.com>

        Reviewed by Maciej Stachowiak.

        Reduce the size of CachedResource
        https://bugs.webkit.org/show_bug.cgi?id=39171

        Make protected data members of CachedResource private, to allow for
        easier rearrangement, and hide the fact that enums are in bitfields.

        Rearrange the data members of CachedResource to save 32 bytes per instance
        in 64-bit. Also modernized the constructor code.

        * loader/CachedCSSStyleSheet.cpp:
        (WebCore::CachedCSSStyleSheet::didAddClient):
        (WebCore::CachedCSSStyleSheet::data):
        (WebCore::CachedCSSStyleSheet::checkNotify):
        (WebCore::CachedCSSStyleSheet::error):
        * loader/CachedFont.cpp:
        (WebCore::CachedFont::load):
        (WebCore::CachedFont::didAddClient):
        (WebCore::CachedFont::data):
        (WebCore::CachedFont::ensureCustomFontData):
        (WebCore::CachedFont::ensureSVGFontData):
        (WebCore::CachedFont::checkNotify):
        (WebCore::CachedFont::error):
        * loader/CachedImage.cpp:
        (WebCore::CachedImage::CachedImage):
        (WebCore::CachedImage::load):
        (WebCore::CachedImage::didAddClient):
        (WebCore::CachedImage::allClientsRemoved):
        (WebCore::CachedImage::image):
        (WebCore::CachedImage::data):
        (WebCore::CachedImage::error):
        (WebCore::CachedImage::checkNotify):
        (WebCore::CachedImage::destroyDecodedData):
        * loader/CachedImage.h:
        (WebCore::CachedImage::stillNeedsLoad):
        * loader/CachedResource.cpp:
        (WebCore::CachedResource::CachedResource):
        * loader/CachedResource.h:
        (WebCore::CachedResource::type):
        (WebCore::CachedResource::preloadResult):
        (WebCore::CachedResource::status):
        (WebCore::CachedResource::setStatus):
        (WebCore::CachedResource::isLoaded):
        (WebCore::CachedResource::isLoading):
        (WebCore::CachedResource::setErrorOccurred):
        * loader/CachedScript.cpp:
        (WebCore::CachedScript::didAddClient):
        (WebCore::CachedScript::data):
        (WebCore::CachedScript::checkNotify):
        (WebCore::CachedScript::error):
        * loader/CachedXSLStyleSheet.cpp:
        (WebCore::CachedXSLStyleSheet::didAddClient):
        (WebCore::CachedXSLStyleSheet::data):
        (WebCore::CachedXSLStyleSheet::checkNotify):
        (WebCore::CachedXSLStyleSheet::error):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@59576 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/loader/CachedFont.cpp b/WebCore/loader/CachedFont.cpp
index d893d30..e6a9e68 100644
--- a/WebCore/loader/CachedFont.cpp
+++ b/WebCore/loader/CachedFont.cpp
@@ -74,12 +74,12 @@
 void CachedFont::load(DocLoader*)
 {
     // Don't load the file yet.  Wait for an access before triggering the load.
-    m_loading = true;
+    setLoading(true);
 }
 
 void CachedFont::didAddClient(CachedResourceClient* c)
 {
-    if (!m_loading)
+    if (!isLoading())
         c->fontLoaded(this);
 }
 
@@ -90,7 +90,7 @@
 
     m_data = data;     
     setEncodedSize(m_data.get() ? m_data->size() : 0);
-    m_loading = false;
+    setLoading(false);
     checkNotify();
 }
 
@@ -108,10 +108,10 @@
 #if ENABLE(SVG_FONTS)
     ASSERT(!m_isSVGFont);
 #endif
-    if (!m_fontData && !m_errorOccurred && !m_loading && m_data) {
+    if (!m_fontData && !errorOccurred() && !isLoading() && m_data) {
         m_fontData = createFontCustomPlatformData(m_data.get());
         if (!m_fontData)
-            m_errorOccurred = true;
+            setErrorOccurred(true);
     }
 #endif
     return m_fontData;
@@ -135,7 +135,7 @@
 bool CachedFont::ensureSVGFontData()
 {
     ASSERT(m_isSVGFont);
-    if (!m_externalSVGDocument && !m_errorOccurred && !m_loading && m_data) {
+    if (!m_externalSVGDocument && !errorOccurred() && !isLoading() && m_data) {
         m_externalSVGDocument = SVGDocument::create(0);
         m_externalSVGDocument->open();
 
@@ -199,7 +199,7 @@
 
 void CachedFont::checkNotify()
 {
-    if (m_loading)
+    if (isLoading())
         return;
     
     CachedResourceClientWalker w(m_clients);
@@ -210,8 +210,8 @@
 
 void CachedFont::error()
 {
-    m_loading = false;
-    m_errorOccurred = true;
+    setLoading(false);
+    setErrorOccurred(true);
     checkNotify();
 }