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 #ifndef PreloadRequest_h | 5 #ifndef PreloadRequest_h |
6 #define PreloadRequest_h | 6 #define PreloadRequest_h |
7 | 7 |
8 #include "core/fetch/ClientHintsPreferences.h" | 8 #include "core/fetch/ClientHintsPreferences.h" |
9 #include "core/fetch/FetchRequest.h" | 9 #include "core/fetch/FetchRequest.h" |
10 #include "core/fetch/IntegrityMetadata.h" | 10 #include "core/fetch/IntegrityMetadata.h" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 ClientHintsPreferences(), | 45 ClientHintsPreferences(), |
46 RequestType requestType = RequestTypePreload) { | 46 RequestType requestType = RequestTypePreload) { |
47 // Never preload data URLs. We also disallow relative ref URLs which become | 47 // Never preload data URLs. We also disallow relative ref URLs which become |
48 // data URLs if the document's URL is a data URL. We don't want to create | 48 // data URLs if the document's URL is a data URL. We don't want to create |
49 // extra resource requests with data URLs to avoid copy / initialization | 49 // extra resource requests with data URLs to avoid copy / initialization |
50 // overhead, which can be significant for large URLs. | 50 // overhead, which can be significant for large URLs. |
51 if (resourceURL.isEmpty() || resourceURL.startsWith("#") || | 51 if (resourceURL.isEmpty() || resourceURL.startsWith("#") || |
52 protocolIs(resourceURL, "data")) { | 52 protocolIs(resourceURL, "data")) { |
53 return nullptr; | 53 return nullptr; |
54 } | 54 } |
55 return wrapUnique(new PreloadRequest( | 55 return WTF::wrapUnique(new PreloadRequest( |
56 initiatorName, initiatorPosition, resourceURL, baseURL, resourceType, | 56 initiatorName, initiatorPosition, resourceURL, baseURL, resourceType, |
57 resourceWidth, clientHintsPreferences, requestType, referrerPolicy)); | 57 resourceWidth, clientHintsPreferences, requestType, referrerPolicy)); |
58 } | 58 } |
59 | 59 |
60 bool isSafeToSendToAnotherThread() const; | 60 bool isSafeToSendToAnotherThread() const; |
61 | 61 |
62 Resource* start(Document*); | 62 Resource* start(Document*); |
63 | 63 |
64 double discoveryTime() const { return m_discoveryTime; } | 64 double discoveryTime() const { return m_discoveryTime; } |
65 void setDefer(FetchRequest::DeferOption defer) { m_defer = defer; } | 65 void setDefer(FetchRequest::DeferOption defer) { m_defer = defer; } |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 RequestType m_requestType; | 134 RequestType m_requestType; |
135 ReferrerPolicy m_referrerPolicy; | 135 ReferrerPolicy m_referrerPolicy; |
136 IntegrityMetadataSet m_integrityMetadata; | 136 IntegrityMetadataSet m_integrityMetadata; |
137 }; | 137 }; |
138 | 138 |
139 typedef Vector<std::unique_ptr<PreloadRequest>> PreloadRequestStream; | 139 typedef Vector<std::unique_ptr<PreloadRequest>> PreloadRequestStream; |
140 | 140 |
141 } // namespace blink | 141 } // namespace blink |
142 | 142 |
143 #endif | 143 #endif |
OLD | NEW |