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::prepareToRevalidate() |
| 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 } |
| 114 |
108 void FontResource::startLoadLimitTimersIfNeeded() | 115 void FontResource::startLoadLimitTimersIfNeeded() |
109 { | 116 { |
110 ASSERT(!stillNeedsLoad()); | 117 ASSERT(!stillNeedsLoad()); |
111 if (isLoaded() || m_fontLoadLongLimitTimer.isActive()) | 118 if (isLoaded() || m_fontLoadLongLimitTimer.isActive()) |
112 return; | 119 return; |
| 120 ASSERT(m_loadLimitState == UnderLimit); |
113 m_fontLoadShortLimitTimer.startOneShot(fontLoadWaitShortLimitSec, BLINK_FROM
_HERE); | 121 m_fontLoadShortLimitTimer.startOneShot(fontLoadWaitShortLimitSec, BLINK_FROM
_HERE); |
114 m_fontLoadLongLimitTimer.startOneShot(fontLoadWaitLongLimitSec, BLINK_FROM_H
ERE); | 122 m_fontLoadLongLimitTimer.startOneShot(fontLoadWaitLongLimitSec, BLINK_FROM_H
ERE); |
115 } | 123 } |
116 | 124 |
117 bool FontResource::ensureCustomFontData() | 125 bool FontResource::ensureCustomFontData() |
118 { | 126 { |
119 if (!m_fontData && !errorOccurred() && !isLoading()) { | 127 if (!m_fontData && !errorOccurred() && !isLoading()) { |
120 if (m_data) | 128 if (m_data) |
121 m_fontData = FontCustomPlatformData::create(m_data.get(), m_otsParsi
ngMessage); | 129 m_fontData = FontCustomPlatformData::create(m_data.get(), m_otsParsi
ngMessage); |
122 | 130 |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 void FontResource::checkNotify() | 180 void FontResource::checkNotify() |
173 { | 181 { |
174 m_fontLoadShortLimitTimer.stop(); | 182 m_fontLoadShortLimitTimer.stop(); |
175 m_fontLoadLongLimitTimer.stop(); | 183 m_fontLoadLongLimitTimer.stop(); |
176 ResourceClientWalker<FontResourceClient> w(m_clients); | 184 ResourceClientWalker<FontResourceClient> w(m_clients); |
177 while (FontResourceClient* c = w.next()) | 185 while (FontResourceClient* c = w.next()) |
178 c->fontLoaded(this); | 186 c->fontLoaded(this); |
179 } | 187 } |
180 | 188 |
181 } // namespace blink | 189 } // namespace blink |
OLD | NEW |