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

Side by Side Diff: third_party/WebKit/Source/core/css/CSSFontFaceSrcValue.cpp

Issue 2390583002: [WIP] WebFonts cache-aware timeout adaption (Closed)
Patch Set: remove flag in finish() instead of responseReceived() Created 4 years, 2 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) 2007, 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2007, 2010 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 16 matching lines...) Expand all
27 27
28 #include "core/css/CSSMarkup.h" 28 #include "core/css/CSSMarkup.h"
29 #include "core/css/StyleSheetContents.h" 29 #include "core/css/StyleSheetContents.h"
30 #include "core/dom/Document.h" 30 #include "core/dom/Document.h"
31 #include "core/dom/Node.h" 31 #include "core/dom/Node.h"
32 #include "core/fetch/FetchInitiatorTypeNames.h" 32 #include "core/fetch/FetchInitiatorTypeNames.h"
33 #include "core/fetch/FetchRequest.h" 33 #include "core/fetch/FetchRequest.h"
34 #include "core/fetch/FontResource.h" 34 #include "core/fetch/FontResource.h"
35 #include "core/fetch/ResourceFetcher.h" 35 #include "core/fetch/ResourceFetcher.h"
36 #include "core/loader/MixedContentChecker.h" 36 #include "core/loader/MixedContentChecker.h"
37 #include "platform/CrossOriginAttributeValue.h" 37 #include "platform/CrossOriginAttributeValue.h"
Takashi Toyoshima 2016/10/05 07:06:18 #include "platform/RuntimeEnabledFeatures.h" The
Shao-Chuan Lee 2016/10/05 10:16:10 Done.
38 #include "platform/fonts/FontCache.h" 38 #include "platform/fonts/FontCache.h"
39 #include "platform/fonts/FontCustomPlatformData.h" 39 #include "platform/fonts/FontCustomPlatformData.h"
40 #include "platform/weborigin/SecurityPolicy.h" 40 #include "platform/weborigin/SecurityPolicy.h"
41 #include "wtf/text/StringBuilder.h" 41 #include "wtf/text/StringBuilder.h"
42 42
43 namespace blink { 43 namespace blink {
44 44
45 bool CSSFontFaceSrcValue::isSupportedFormat() const { 45 bool CSSFontFaceSrcValue::isSupportedFormat() const {
46 // Normally we would just check the format, but in order to avoid conflicts wi th the old WinIE style of font-face, 46 // Normally we would just check the format, but in order to avoid conflicts wi th the old WinIE style of font-face,
47 // we will also check to see if the URL ends with .eot. If so, we'll go ahead and assume that we shouldn't load it. 47 // we will also check to see if the URL ends with .eot. If so, we'll go ahead and assume that we shouldn't load it.
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 return; 81 return;
82 82
83 request.setCrossOriginAccessControl(securityOrigin, 83 request.setCrossOriginAccessControl(securityOrigin,
84 CrossOriginAttributeAnonymous); 84 CrossOriginAttributeAnonymous);
85 } 85 }
86 86
87 FontResource* CSSFontFaceSrcValue::fetch(Document* document) const { 87 FontResource* CSSFontFaceSrcValue::fetch(Document* document) const {
88 if (!m_fetched) { 88 if (!m_fetched) {
89 FetchRequest request(ResourceRequest(m_absoluteResource), 89 FetchRequest request(ResourceRequest(m_absoluteResource),
90 FetchInitiatorTypeNames::css); 90 FetchInitiatorTypeNames::css);
91 request.mutableResourceRequest().setIsCacheAwareLoadingEnabled(
92 RuntimeEnabledFeatures::webFontsCacheAwareTimeoutAdaptionEnabled());
hiroshige 2016/10/05 08:27:10 Could you write like this? ResourceRequest resour
Shao-Chuan Lee 2016/10/05 10:16:10 Done.
91 request.setContentSecurityCheck(m_shouldCheckContentSecurityPolicy); 93 request.setContentSecurityCheck(m_shouldCheckContentSecurityPolicy);
92 SecurityOrigin* securityOrigin = document->getSecurityOrigin(); 94 SecurityOrigin* securityOrigin = document->getSecurityOrigin();
93 setCrossOriginAccessControl(request, securityOrigin); 95 setCrossOriginAccessControl(request, securityOrigin);
94 request.mutableResourceRequest().setHTTPReferrer( 96 request.mutableResourceRequest().setHTTPReferrer(
95 SecurityPolicy::generateReferrer(m_referrer.referrerPolicy, 97 SecurityPolicy::generateReferrer(m_referrer.referrerPolicy,
96 request.url(), m_referrer.referrer)); 98 request.url(), m_referrer.referrer));
97 FontResource* resource = FontResource::fetch(request, document->fetcher()); 99 FontResource* resource = FontResource::fetch(request, document->fetcher());
98 if (!resource) 100 if (!resource)
99 return nullptr; 101 return nullptr;
100 m_fetched = FontResourceHelper::create(resource); 102 m_fetched = FontResourceHelper::create(resource);
(...skipping 28 matching lines...) Expand all
129 ResourceFetcher::ResourceLoadingFromCache); 131 ResourceFetcher::ResourceLoadingFromCache);
130 } 132 }
131 133
132 bool CSSFontFaceSrcValue::equals(const CSSFontFaceSrcValue& other) const { 134 bool CSSFontFaceSrcValue::equals(const CSSFontFaceSrcValue& other) const {
133 return m_isLocal == other.m_isLocal && m_format == other.m_format && 135 return m_isLocal == other.m_isLocal && m_format == other.m_format &&
134 m_specifiedResource == other.m_specifiedResource && 136 m_specifiedResource == other.m_specifiedResource &&
135 m_absoluteResource == other.m_absoluteResource; 137 m_absoluteResource == other.m_absoluteResource;
136 } 138 }
137 139
138 } // namespace blink 140 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/fetch/Resource.h » ('j') | third_party/WebKit/Source/core/fetch/Resource.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698