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

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

Issue 2740253002: Remove FetchRequest::mutableResourceRequest() where removing is trivial (Closed)
Patch Set: Fix Created 3 years, 9 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/css/CSSImageSetValue.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 // allowFileAccessFromFileURLs is false. 82 // allowFileAccessFromFileURLs is false.
83 if (request.url().isLocalFile()) 83 if (request.url().isLocalFile())
84 return; 84 return;
85 85
86 request.setCrossOriginAccessControl(securityOrigin, 86 request.setCrossOriginAccessControl(securityOrigin,
87 CrossOriginAttributeAnonymous); 87 CrossOriginAttributeAnonymous);
88 } 88 }
89 89
90 FontResource* CSSFontFaceSrcValue::fetch(Document* document) const { 90 FontResource* CSSFontFaceSrcValue::fetch(Document* document) const {
91 if (!m_fetched) { 91 if (!m_fetched) {
92 FetchRequest request(ResourceRequest(m_absoluteResource), 92 ResourceRequest resourceRequest(m_absoluteResource);
93 FetchInitiatorTypeNames::css); 93 resourceRequest.setHTTPReferrer(SecurityPolicy::generateReferrer(
94 m_referrer.referrerPolicy, resourceRequest.url(), m_referrer.referrer));
95 FetchRequest request(resourceRequest, FetchInitiatorTypeNames::css);
94 if (RuntimeEnabledFeatures::webFontsCacheAwareTimeoutAdaptationEnabled()) 96 if (RuntimeEnabledFeatures::webFontsCacheAwareTimeoutAdaptationEnabled())
95 request.setCacheAwareLoadingEnabled(IsCacheAwareLoadingEnabled); 97 request.setCacheAwareLoadingEnabled(IsCacheAwareLoadingEnabled);
96 request.setContentSecurityCheck(m_shouldCheckContentSecurityPolicy); 98 request.setContentSecurityCheck(m_shouldCheckContentSecurityPolicy);
97 SecurityOrigin* securityOrigin = document->getSecurityOrigin(); 99 SecurityOrigin* securityOrigin = document->getSecurityOrigin();
98 setCrossOriginAccessControl(request, securityOrigin); 100 setCrossOriginAccessControl(request, securityOrigin);
99 request.mutableResourceRequest().setHTTPReferrer(
100 SecurityPolicy::generateReferrer(m_referrer.referrerPolicy,
101 request.url(), m_referrer.referrer));
102 FontResource* resource = FontResource::fetch(request, document->fetcher()); 101 FontResource* resource = FontResource::fetch(request, document->fetcher());
103 if (!resource) 102 if (!resource)
104 return nullptr; 103 return nullptr;
105 m_fetched = FontResourceHelper::create(resource); 104 m_fetched = FontResourceHelper::create(resource);
106 } else { 105 } else {
107 // FIXME: CSSFontFaceSrcValue::fetch is invoked when @font-face rule 106 // FIXME: CSSFontFaceSrcValue::fetch is invoked when @font-face rule
108 // is processed by StyleResolver / StyleEngine. 107 // is processed by StyleResolver / StyleEngine.
109 restoreCachedResourceIfNeeded(document); 108 restoreCachedResourceIfNeeded(document);
110 } 109 }
111 return m_fetched->resource(); 110 return m_fetched->resource();
(...skipping 12 matching lines...) Expand all
124 WebURLRequest::RequestContextFont, FetchInitiatorTypeNames::css); 123 WebURLRequest::RequestContextFont, FetchInitiatorTypeNames::css);
125 } 124 }
126 125
127 bool CSSFontFaceSrcValue::equals(const CSSFontFaceSrcValue& other) const { 126 bool CSSFontFaceSrcValue::equals(const CSSFontFaceSrcValue& other) const {
128 return m_isLocal == other.m_isLocal && m_format == other.m_format && 127 return m_isLocal == other.m_isLocal && m_format == other.m_format &&
129 m_specifiedResource == other.m_specifiedResource && 128 m_specifiedResource == other.m_specifiedResource &&
130 m_absoluteResource == other.m_absoluteResource; 129 m_absoluteResource == other.m_absoluteResource;
131 } 130 }
132 131
133 } // namespace blink 132 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/css/CSSImageSetValue.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698