| 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/dom/DocumentWriteIntervention.h" | 8 #include "core/dom/DocumentWriteIntervention.h" |
| 9 #include "core/loader/DocumentLoader.h" | 9 #include "core/loader/DocumentLoader.h" |
| 10 #include "platform/CrossOriginAttributeValue.h" | 10 #include "platform/CrossOriginAttributeValue.h" |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 | 74 |
| 75 if (request_type_ == kRequestTypeLinkRelPreload) | 75 if (request_type_ == kRequestTypeLinkRelPreload) |
| 76 params.SetLinkPreload(true); | 76 params.SetLinkPreload(true); |
| 77 | 77 |
| 78 if (resource_type_ == Resource::kScript || | 78 if (resource_type_ == Resource::kScript || |
| 79 resource_type_ == Resource::kCSSStyleSheet || | 79 resource_type_ == Resource::kCSSStyleSheet || |
| 80 resource_type_ == Resource::kImportResource) { | 80 resource_type_ == Resource::kImportResource) { |
| 81 params.SetCharset(charset_.IsEmpty() ? document->characterSet().GetString() | 81 params.SetCharset(charset_.IsEmpty() ? document->characterSet().GetString() |
| 82 : charset_); | 82 : charset_); |
| 83 } | 83 } |
| 84 params.SetSpeculativePreload(true, discovery_time_); | 84 FetchParameters::SpeculativePreloadType speculative_preload_type = |
| 85 FetchParameters::SpeculativePreloadType::kInDocument; |
| 86 if (from_insertion_scanner_) { |
| 87 speculative_preload_type = |
| 88 FetchParameters::SpeculativePreloadType::kInserted; |
| 89 } |
| 90 params.SetSpeculativePreloadType(speculative_preload_type, discovery_time_); |
| 85 | 91 |
| 86 return document->Loader()->StartPreload(resource_type_, params); | 92 return document->Loader()->StartPreload(resource_type_, params); |
| 87 } | 93 } |
| 88 | 94 |
| 89 } // namespace blink | 95 } // namespace blink |
| OLD | NEW |