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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 #endif | 43 #endif |
44 | 44 |
45 namespace WebCore { | 45 namespace WebCore { |
46 | 46 |
47 static const double fontLoadWaitLimitSec = 3.0; | 47 static const double fontLoadWaitLimitSec = 3.0; |
48 | 48 |
49 FontResource::FontResource(const ResourceRequest& resourceRequest) | 49 FontResource::FontResource(const ResourceRequest& resourceRequest) |
50 : Resource(resourceRequest, Font) | 50 : Resource(resourceRequest, Font) |
51 , m_loadInitiated(false) | 51 , m_loadInitiated(false) |
52 , m_exceedsFontLoadWaitLimit(false) | 52 , m_exceedsFontLoadWaitLimit(false) |
53 , m_corsFailed(false) | |
54 , m_fontLoadWaitLimitTimer(this, &FontResource::fontLoadWaitLimitCallback) | 53 , m_fontLoadWaitLimitTimer(this, &FontResource::fontLoadWaitLimitCallback) |
55 { | 54 { |
56 } | 55 } |
57 | 56 |
58 FontResource::~FontResource() | 57 FontResource::~FontResource() |
59 { | 58 { |
60 } | 59 } |
61 | 60 |
62 void FontResource::load(ResourceFetcher*, const ResourceLoaderOptions& options) | 61 void FontResource::load(ResourceFetcher*, const ResourceLoaderOptions& options) |
63 { | 62 { |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 | 177 |
179 void FontResource::allClientsRemoved() | 178 void FontResource::allClientsRemoved() |
180 { | 179 { |
181 m_fontData.clear(); | 180 m_fontData.clear(); |
182 Resource::allClientsRemoved(); | 181 Resource::allClientsRemoved(); |
183 } | 182 } |
184 | 183 |
185 void FontResource::checkNotify() | 184 void FontResource::checkNotify() |
186 { | 185 { |
187 m_fontLoadWaitLimitTimer.stop(); | 186 m_fontLoadWaitLimitTimer.stop(); |
188 | |
189 ResourceClientWalker<FontResourceClient> w(m_clients); | 187 ResourceClientWalker<FontResourceClient> w(m_clients); |
190 // FIXME: Remove this CORS fallback once we have enough UMA to make a decisi
on. | 188 while (FontResourceClient* c = w.next()) |
191 if (m_corsFailed) { | 189 c->fontLoaded(this); |
192 while (FontResourceClient* client = w.next()) | |
193 client->corsFailed(this); | |
194 } else { | |
195 while (FontResourceClient* c = w.next()) | |
196 c->fontLoaded(this); | |
197 } | |
198 } | 190 } |
199 | 191 |
200 } | 192 } |
OLD | NEW |