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

Side by Side Diff: Source/core/html/parser/PreloadRequest.cpp

Issue 1108303002: HTMLPreloadScanner unit tests (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: nit Created 5 years, 7 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 | « Source/core/html/parser/PreloadRequest.h ('k') | Source/core/html/parser/ResourcePreloader.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "config.h"
6 #include "core/html/parser/PreloadRequest.h"
7
8 #include "core/dom/Document.h"
9 #include "core/fetch/FetchInitiatorInfo.h"
10
11 namespace blink {
12
13 bool PreloadRequest::isSafeToSendToAnotherThread() const
14 {
15 return m_initiatorName.isSafeToSendToAnotherThread()
16 && m_charset.isSafeToSendToAnotherThread()
17 && m_resourceURL.isSafeToSendToAnotherThread()
18 && m_baseURL.isSafeToSendToAnotherThread();
19 }
20
21 KURL PreloadRequest::completeURL(Document* document)
22 {
23 return document->completeURLWithOverride(m_resourceURL, m_baseURL.isEmpty() ? document->url() : m_baseURL);
24 }
25
26 FetchRequest PreloadRequest::resourceRequest(Document* document)
27 {
28 ASSERT(isMainThread());
29 FetchInitiatorInfo initiatorInfo;
30 initiatorInfo.name = AtomicString(m_initiatorName);
31 initiatorInfo.position = m_initiatorPosition;
32 FetchRequest request(ResourceRequest(completeURL(document)), initiatorInfo);
33
34 if (m_isCORSEnabled)
35 request.setCrossOriginAccessControl(document->securityOrigin(), m_allowC redentials);
36
37 request.setDefer(m_defer);
38 request.setResourceWidth(m_resourceWidth);
39
40 return request;
41 }
42
43 }
OLDNEW
« no previous file with comments | « Source/core/html/parser/PreloadRequest.h ('k') | Source/core/html/parser/ResourcePreloader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698