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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 | 70 |
71 if (request_type_ == kRequestTypeLinkRelPreload) | 71 if (request_type_ == kRequestTypeLinkRelPreload) |
72 params.SetLinkPreload(true); | 72 params.SetLinkPreload(true); |
73 | 73 |
74 if (resource_type_ == Resource::kScript || | 74 if (resource_type_ == Resource::kScript || |
75 resource_type_ == Resource::kCSSStyleSheet || | 75 resource_type_ == Resource::kCSSStyleSheet || |
76 resource_type_ == Resource::kImportResource) { | 76 resource_type_ == Resource::kImportResource) { |
77 params.SetCharset(charset_.IsEmpty() ? document->characterSet().GetString() | 77 params.SetCharset(charset_.IsEmpty() ? document->characterSet().GetString() |
78 : charset_); | 78 : charset_); |
79 } | 79 } |
80 params.SetSpeculativePreload(true, discovery_time_); | 80 FetchParameters::SpeculativePreloadType speculative_preload_type = |
| 81 FetchParameters::SpeculativePreloadType::kInDocument; |
| 82 if (from_insertion_scanner_) { |
| 83 speculative_preload_type = |
| 84 FetchParameters::SpeculativePreloadType::kInserted; |
| 85 } |
| 86 params.SetSpeculativePreloadType(speculative_preload_type, discovery_time_); |
81 | 87 |
82 return document->Loader()->StartPreload(resource_type_, params); | 88 return document->Loader()->StartPreload(resource_type_, params); |
83 } | 89 } |
84 | 90 |
85 } // namespace blink | 91 } // namespace blink |
OLD | NEW |