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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 const char* data = buffer->data(); | 55 const char* data = buffer->data(); |
56 if (data[0] == 'w' && data[1] == 'O' && data[2] == 'F' && data[3] == 'F') | 56 if (data[0] == 'w' && data[1] == 'O' && data[2] == 'F' && data[3] == 'F') |
57 return PackageFormatWOFF; | 57 return PackageFormatWOFF; |
58 if (data[0] == 'w' && data[1] == 'O' && data[2] == 'F' && data[3] == '2') | 58 if (data[0] == 'w' && data[1] == 'O' && data[2] == 'F' && data[3] == '2') |
59 return PackageFormatWOFF2; | 59 return PackageFormatWOFF2; |
60 return PackageFormatSFNT; | 60 return PackageFormatSFNT; |
61 } | 61 } |
62 | 62 |
63 static void recordPackageFormatHistogram(FontPackageFormat format) | 63 static void recordPackageFormatHistogram(FontPackageFormat format) |
64 { | 64 { |
65 blink::Platform::current()->histogramEnumeration("WebFont.PackageFormat", fo
rmat, PackageFormatEnumMax); | 65 Platform::current()->histogramEnumeration("WebFont.PackageFormat", format, P
ackageFormatEnumMax); |
66 } | 66 } |
67 | 67 |
68 FontResource::FontResource(const ResourceRequest& resourceRequest) | 68 FontResource::FontResource(const ResourceRequest& resourceRequest) |
69 : Resource(resourceRequest, Font) | 69 : Resource(resourceRequest, Font) |
70 , m_state(Unloaded) | 70 , m_state(Unloaded) |
71 , m_exceedsFontLoadWaitLimit(false) | 71 , m_exceedsFontLoadWaitLimit(false) |
72 , m_corsFailed(false) | 72 , m_corsFailed(false) |
73 , m_fontLoadWaitLimitTimer(this, &FontResource::fontLoadWaitLimitCallback) | 73 , m_fontLoadWaitLimitTimer(this, &FontResource::fontLoadWaitLimitCallback) |
74 { | 74 { |
75 } | 75 } |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 | 163 |
164 void FontResource::checkNotify() | 164 void FontResource::checkNotify() |
165 { | 165 { |
166 m_fontLoadWaitLimitTimer.stop(); | 166 m_fontLoadWaitLimitTimer.stop(); |
167 ResourceClientWalker<FontResourceClient> w(m_clients); | 167 ResourceClientWalker<FontResourceClient> w(m_clients); |
168 while (FontResourceClient* c = w.next()) | 168 while (FontResourceClient* c = w.next()) |
169 c->fontLoaded(this); | 169 c->fontLoaded(this); |
170 } | 170 } |
171 | 171 |
172 } | 172 } |
OLD | NEW |