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