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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 static void recordPackageFormatHistogram(FontPackageFormat format) | 67 static void recordPackageFormatHistogram(FontPackageFormat format) |
68 { | 68 { |
69 DEFINE_THREAD_SAFE_STATIC_LOCAL(EnumerationHistogram, packageFormatHistogram
, new EnumerationHistogram("WebFont.PackageFormat", PackageFormatEnumMax)); | 69 DEFINE_THREAD_SAFE_STATIC_LOCAL(EnumerationHistogram, packageFormatHistogram
, new EnumerationHistogram("WebFont.PackageFormat", PackageFormatEnumMax)); |
70 packageFormatHistogram.count(format); | 70 packageFormatHistogram.count(format); |
71 } | 71 } |
72 | 72 |
73 FontResource* FontResource::fetch(FetchRequest& request, ResourceFetcher* fetche
r) | 73 FontResource* FontResource::fetch(FetchRequest& request, ResourceFetcher* fetche
r) |
74 { | 74 { |
75 ASSERT(request.resourceRequest().frameType() == WebURLRequest::FrameTypeNone
); | 75 ASSERT(request.resourceRequest().frameType() == WebURLRequest::FrameTypeNone
); |
76 request.mutableResourceRequest().setRequestContext(WebURLRequest::RequestCon
textFont); | 76 request.mutableResourceRequest().setRequestContext(WebURLRequest::RequestCon
textFont); |
77 // Defer the load until the font is actually needed unless this is a preload
. | |
78 if (!request.forPreload()) | |
79 request.setDefer(FetchRequest::DeferredByClient); | |
80 return toFontResource(fetcher->requestResource(request, FontResourceFactory(
))); | 77 return toFontResource(fetcher->requestResource(request, FontResourceFactory(
))); |
81 } | 78 } |
82 | 79 |
83 FontResource::FontResource(const ResourceRequest& resourceRequest, const Resourc
eLoaderOptions& options) | 80 FontResource::FontResource(const ResourceRequest& resourceRequest, const Resourc
eLoaderOptions& options) |
84 : Resource(resourceRequest, Font, options) | 81 : Resource(resourceRequest, Font, options) |
85 , m_loadLimitState(UnderLimit) | 82 , m_loadLimitState(UnderLimit) |
86 , m_corsFailed(false) | 83 , m_corsFailed(false) |
87 , m_fontLoadShortLimitTimer(this, &FontResource::fontLoadShortLimitCallback) | 84 , m_fontLoadShortLimitTimer(this, &FontResource::fontLoadShortLimitCallback) |
88 , m_fontLoadLongLimitTimer(this, &FontResource::fontLoadLongLimitCallback) | 85 , m_fontLoadLongLimitTimer(this, &FontResource::fontLoadLongLimitCallback) |
89 { | 86 { |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 | 175 |
179 void FontResource::checkNotify() | 176 void FontResource::checkNotify() |
180 { | 177 { |
181 m_fontLoadShortLimitTimer.stop(); | 178 m_fontLoadShortLimitTimer.stop(); |
182 m_fontLoadLongLimitTimer.stop(); | 179 m_fontLoadLongLimitTimer.stop(); |
183 | 180 |
184 Resource::checkNotify(); | 181 Resource::checkNotify(); |
185 } | 182 } |
186 | 183 |
187 } // namespace blink | 184 } // namespace blink |
OLD | NEW |