| OLD | NEW |
| (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 } |
| OLD | NEW |