OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "core/html/parser/PreloadRequest.h" | 5 #include "core/html/parser/PreloadRequest.h" |
6 | 6 |
7 #include "core/dom/Document.h" | 7 #include "core/dom/Document.h" |
8 #include "core/loader/DocumentLoader.h" | 8 #include "core/loader/DocumentLoader.h" |
9 #include "platform/CrossOriginAttributeValue.h" | 9 #include "platform/CrossOriginAttributeValue.h" |
10 #include "platform/loader/fetch/FetchInitiatorInfo.h" | 10 #include "platform/loader/fetch/FetchInitiatorInfo.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 m_baseURL.isSafeToSendToAnotherThread(); | 21 m_baseURL.isSafeToSendToAnotherThread(); |
22 } | 22 } |
23 | 23 |
24 KURL PreloadRequest::completeURL(Document* document) { | 24 KURL PreloadRequest::completeURL(Document* document) { |
25 if (!m_baseURL.isEmpty()) | 25 if (!m_baseURL.isEmpty()) |
26 return document->completeURLWithOverride(m_resourceURL, m_baseURL); | 26 return document->completeURLWithOverride(m_resourceURL, m_baseURL); |
27 return document->completeURL(m_resourceURL); | 27 return document->completeURL(m_resourceURL); |
28 } | 28 } |
29 | 29 |
30 Resource* PreloadRequest::start(Document* document) { | 30 Resource* PreloadRequest::start(Document* document) { |
31 ASSERT(isMainThread()); | 31 DCHECK(isMainThread()); |
32 | 32 |
33 FetchInitiatorInfo initiatorInfo; | 33 FetchInitiatorInfo initiatorInfo; |
34 initiatorInfo.name = AtomicString(m_initiatorName); | 34 initiatorInfo.name = AtomicString(m_initiatorName); |
35 initiatorInfo.position = m_initiatorPosition; | 35 initiatorInfo.position = m_initiatorPosition; |
36 | 36 |
37 const KURL& url = completeURL(document); | 37 const KURL& url = completeURL(document); |
38 // Data URLs are filtered out in the preload scanner. | 38 // Data URLs are filtered out in the preload scanner. |
39 DCHECK(!url.protocolIsData()); | 39 DCHECK(!url.protocolIsData()); |
40 | 40 |
41 ResourceRequest resourceRequest(url); | 41 ResourceRequest resourceRequest(url); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 m_resourceType == Resource::ImportResource) { | 73 m_resourceType == Resource::ImportResource) { |
74 request.setCharset( | 74 request.setCharset( |
75 m_charset.isEmpty() ? document->characterSet().getString() : m_charset); | 75 m_charset.isEmpty() ? document->characterSet().getString() : m_charset); |
76 } | 76 } |
77 request.setSpeculativePreload(true, m_discoveryTime); | 77 request.setSpeculativePreload(true, m_discoveryTime); |
78 | 78 |
79 return document->loader()->startPreload(m_resourceType, request); | 79 return document->loader()->startPreload(m_resourceType, request); |
80 } | 80 } |
81 | 81 |
82 } // namespace blink | 82 } // namespace blink |
OLD | NEW |