Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(21)

Side by Side Diff: third_party/WebKit/Source/core/fetch/FontResource.cpp

Issue 1879793003: Remove DeferredByClient (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@Resource_load
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 void FontResource::checkNotify() 169 void FontResource::checkNotify()
173 { 170 {
174 m_fontLoadShortLimitTimer.stop(); 171 m_fontLoadShortLimitTimer.stop();
175 m_fontLoadLongLimitTimer.stop(); 172 m_fontLoadLongLimitTimer.stop();
176 ResourceClientWalker<FontResourceClient> w(m_clients); 173 ResourceClientWalker<FontResourceClient> w(m_clients);
177 while (FontResourceClient* c = w.next()) 174 while (FontResourceClient* c = w.next())
178 c->fontLoaded(this); 175 c->fontLoaded(this);
179 } 176 }
180 177
181 } // namespace blink 178 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698