| 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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 ASSERT(FontResourceClient::isExpectedType(c)); | 98 ASSERT(FontResourceClient::isExpectedType(c)); |
| 99 Resource::didAddClient(c); | 99 Resource::didAddClient(c); |
| 100 if (isLoaded()) | 100 if (isLoaded()) |
| 101 static_cast<FontResourceClient*>(c)->fontLoaded(this); | 101 static_cast<FontResourceClient*>(c)->fontLoaded(this); |
| 102 if (m_loadLimitState == ShortLimitExceeded || m_loadLimitState == LongLimitE
xceeded) | 102 if (m_loadLimitState == ShortLimitExceeded || m_loadLimitState == LongLimitE
xceeded) |
| 103 static_cast<FontResourceClient*>(c)->fontLoadShortLimitExceeded(this); | 103 static_cast<FontResourceClient*>(c)->fontLoadShortLimitExceeded(this); |
| 104 if (m_loadLimitState == LongLimitExceeded) | 104 if (m_loadLimitState == LongLimitExceeded) |
| 105 static_cast<FontResourceClient*>(c)->fontLoadLongLimitExceeded(this); | 105 static_cast<FontResourceClient*>(c)->fontLoadLongLimitExceeded(this); |
| 106 } | 106 } |
| 107 | 107 |
| 108 void FontResource::setRevalidatingRequest(const ResourceRequest& request) |
| 109 { |
| 110 // Reload will use the same object, and needs to reset |m_loadLimitState| |
| 111 // before any didAddClient() is called again. |
| 112 m_loadLimitState = UnderLimit; |
| 113 Resource::setRevalidatingRequest(request); |
| 114 } |
| 115 |
| 108 void FontResource::startLoadLimitTimersIfNeeded() | 116 void FontResource::startLoadLimitTimersIfNeeded() |
| 109 { | 117 { |
| 110 ASSERT(!stillNeedsLoad()); | 118 ASSERT(!stillNeedsLoad()); |
| 111 if (isLoaded() || m_fontLoadLongLimitTimer.isActive()) | 119 if (isLoaded() || m_fontLoadLongLimitTimer.isActive()) |
| 112 return; | 120 return; |
| 121 ASSERT(m_loadLimitState == UnderLimit); |
| 113 m_fontLoadShortLimitTimer.startOneShot(fontLoadWaitShortLimitSec, BLINK_FROM
_HERE); | 122 m_fontLoadShortLimitTimer.startOneShot(fontLoadWaitShortLimitSec, BLINK_FROM
_HERE); |
| 114 m_fontLoadLongLimitTimer.startOneShot(fontLoadWaitLongLimitSec, BLINK_FROM_H
ERE); | 123 m_fontLoadLongLimitTimer.startOneShot(fontLoadWaitLongLimitSec, BLINK_FROM_H
ERE); |
| 115 } | 124 } |
| 116 | 125 |
| 117 bool FontResource::ensureCustomFontData() | 126 bool FontResource::ensureCustomFontData() |
| 118 { | 127 { |
| 119 if (!m_fontData && !errorOccurred() && !isLoading()) { | 128 if (!m_fontData && !errorOccurred() && !isLoading()) { |
| 120 if (m_data) | 129 if (m_data) |
| 121 m_fontData = FontCustomPlatformData::create(m_data.get(), m_otsParsi
ngMessage); | 130 m_fontData = FontCustomPlatformData::create(m_data.get(), m_otsParsi
ngMessage); |
| 122 | 131 |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 void FontResource::checkNotify() | 181 void FontResource::checkNotify() |
| 173 { | 182 { |
| 174 m_fontLoadShortLimitTimer.stop(); | 183 m_fontLoadShortLimitTimer.stop(); |
| 175 m_fontLoadLongLimitTimer.stop(); | 184 m_fontLoadLongLimitTimer.stop(); |
| 176 ResourceClientWalker<FontResourceClient> w(m_clients); | 185 ResourceClientWalker<FontResourceClient> w(m_clients); |
| 177 while (FontResourceClient* c = w.next()) | 186 while (FontResourceClient* c = w.next()) |
| 178 c->fontLoaded(this); | 187 c->fontLoaded(this); |
| 179 } | 188 } |
| 180 | 189 |
| 181 } // namespace blink | 190 } // namespace blink |
| OLD | NEW |