| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2009 Torch Mobile, Inc. | 3 * Copyright (C) 2009 Torch Mobile, Inc. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 m_options = options; | 68 m_options = options; |
| 69 } | 69 } |
| 70 | 70 |
| 71 void CachedFont::didAddClient(CachedResourceClient* c) | 71 void CachedFont::didAddClient(CachedResourceClient* c) |
| 72 { | 72 { |
| 73 ASSERT(c->resourceClientType() == CachedFontClient::expectedType()); | 73 ASSERT(c->resourceClientType() == CachedFontClient::expectedType()); |
| 74 if (!isLoading()) | 74 if (!isLoading()) |
| 75 static_cast<CachedFontClient*>(c)->fontLoaded(this); | 75 static_cast<CachedFontClient*>(c)->fontLoaded(this); |
| 76 } | 76 } |
| 77 | 77 |
| 78 void CachedFont::data(PassRefPtr<ResourceBuffer> data, bool allDataReceived) | |
| 79 { | |
| 80 if (!allDataReceived) | |
| 81 return; | |
| 82 | |
| 83 m_data = data; | |
| 84 setEncodedSize(m_data.get() ? m_data->size() : 0); | |
| 85 setLoading(false); | |
| 86 checkNotify(); | |
| 87 } | |
| 88 | |
| 89 void CachedFont::beginLoadIfNeeded(CachedResourceLoader* dl) | 78 void CachedFont::beginLoadIfNeeded(CachedResourceLoader* dl) |
| 90 { | 79 { |
| 91 if (!m_loadInitiated) { | 80 if (!m_loadInitiated) { |
| 92 m_loadInitiated = true; | 81 m_loadInitiated = true; |
| 93 CachedResource::load(dl, m_options); | 82 CachedResource::load(dl, m_options); |
| 94 } | 83 } |
| 95 } | 84 } |
| 96 | 85 |
| 97 bool CachedFont::ensureCustomFontData() | 86 bool CachedFont::ensureCustomFontData() |
| 98 { | 87 { |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 void CachedFont::allClientsRemoved() | 155 void CachedFont::allClientsRemoved() |
| 167 { | 156 { |
| 168 if (m_fontData) { | 157 if (m_fontData) { |
| 169 delete m_fontData; | 158 delete m_fontData; |
| 170 m_fontData = 0; | 159 m_fontData = 0; |
| 171 } | 160 } |
| 172 } | 161 } |
| 173 | 162 |
| 174 void CachedFont::checkNotify() | 163 void CachedFont::checkNotify() |
| 175 { | 164 { |
| 176 if (isLoading()) | |
| 177 return; | |
| 178 | |
| 179 CachedResourceClientWalker<CachedFontClient> w(m_clients); | 165 CachedResourceClientWalker<CachedFontClient> w(m_clients); |
| 180 while (CachedFontClient* c = w.next()) | 166 while (CachedFontClient* c = w.next()) |
| 181 c->fontLoaded(this); | 167 c->fontLoaded(this); |
| 182 } | 168 } |
| 183 | 169 |
| 184 void CachedFont::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const | 170 void CachedFont::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const |
| 185 { | 171 { |
| 186 MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CachedResou
rceFont); | 172 MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CachedResou
rceFont); |
| 187 CachedResource::reportMemoryUsage(memoryObjectInfo); | 173 CachedResource::reportMemoryUsage(memoryObjectInfo); |
| 188 #if ENABLE(SVG_FONTS) | 174 #if ENABLE(SVG_FONTS) |
| 189 info.addMember(m_externalSVGDocument, "externalSVGDocument"); | 175 info.addMember(m_externalSVGDocument, "externalSVGDocument"); |
| 190 #endif | 176 #endif |
| 191 info.addMember(m_fontData, "fontData"); | 177 info.addMember(m_fontData, "fontData"); |
| 192 } | 178 } |
| 193 | 179 |
| 194 } | 180 } |
| OLD | NEW |