OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 27 matching lines...) Expand all Loading... |
38 #include "platform/CrossOriginAttributeValue.h" | 38 #include "platform/CrossOriginAttributeValue.h" |
39 #include "platform/PrerenderClient.h" | 39 #include "platform/PrerenderClient.h" |
40 #include "platform/loader/fetch/ResourceClient.h" | 40 #include "platform/loader/fetch/ResourceClient.h" |
41 #include "platform/loader/fetch/ResourceOwner.h" | 41 #include "platform/loader/fetch/ResourceOwner.h" |
42 #include "platform/wtf/Optional.h" | 42 #include "platform/wtf/Optional.h" |
43 | 43 |
44 namespace blink { | 44 namespace blink { |
45 | 45 |
46 class Document; | 46 class Document; |
47 class LinkRelAttribute; | 47 class LinkRelAttribute; |
| 48 class LocalFrame; |
48 class NetworkHintsInterface; | 49 class NetworkHintsInterface; |
49 class PrerenderHandle; | 50 class PrerenderHandle; |
50 struct ViewportDescriptionWrapper; | 51 struct ViewportDescriptionWrapper; |
51 | 52 |
52 // The LinkLoader can load link rel types icon, dns-prefetch, subresource, | 53 // The LinkLoader can load link rel types icon, dns-prefetch, subresource, |
53 // prefetch and prerender. | 54 // prefetch and prerender. |
54 class CORE_EXPORT LinkLoader final | 55 class CORE_EXPORT LinkLoader final |
55 : public GarbageCollectedFinalized<LinkLoader>, | 56 : public GarbageCollectedFinalized<LinkLoader>, |
56 public ResourceOwner<Resource, ResourceClient>, | 57 public ResourceOwner<Resource, ResourceClient>, |
57 public PrerenderClient { | 58 public PrerenderClient { |
(...skipping 30 matching lines...) Expand all Loading... |
88 enum CanLoadResources { | 89 enum CanLoadResources { |
89 kOnlyLoadResources, | 90 kOnlyLoadResources, |
90 kDoNotLoadResources, | 91 kDoNotLoadResources, |
91 kLoadResourcesAndPreconnect | 92 kLoadResourcesAndPreconnect |
92 }; | 93 }; |
93 // Media links cannot be preloaded until the first chunk is parsed. The rest | 94 // Media links cannot be preloaded until the first chunk is parsed. The rest |
94 // can be preloaded at commit time. | 95 // can be preloaded at commit time. |
95 enum MediaPreloadPolicy { kLoadAll, kOnlyLoadNonMedia, kOnlyLoadMedia }; | 96 enum MediaPreloadPolicy { kLoadAll, kOnlyLoadNonMedia, kOnlyLoadMedia }; |
96 static void LoadLinksFromHeader(const String& header_value, | 97 static void LoadLinksFromHeader(const String& header_value, |
97 const KURL& base_url, | 98 const KURL& base_url, |
98 Document*, | 99 LocalFrame&, |
| 100 Document*, // can be nullptr |
99 const NetworkHintsInterface&, | 101 const NetworkHintsInterface&, |
100 CanLoadResources, | 102 CanLoadResources, |
101 MediaPreloadPolicy, | 103 MediaPreloadPolicy, |
102 ViewportDescriptionWrapper*); | 104 ViewportDescriptionWrapper*); |
103 static WTF::Optional<Resource::Type> GetResourceTypeFromAsAttribute( | 105 static WTF::Optional<Resource::Type> GetResourceTypeFromAsAttribute( |
104 const String& as); | 106 const String& as); |
105 | 107 |
106 Resource* LinkPreloadedResourceForTesting(); | 108 Resource* LinkPreloadedResourceForTesting(); |
107 | 109 |
108 DECLARE_TRACE(); | 110 DECLARE_TRACE(); |
(...skipping 10 matching lines...) Expand all Loading... |
119 TaskRunnerTimer<LinkLoader> link_load_timer_; | 121 TaskRunnerTimer<LinkLoader> link_load_timer_; |
120 TaskRunnerTimer<LinkLoader> link_loading_error_timer_; | 122 TaskRunnerTimer<LinkLoader> link_loading_error_timer_; |
121 | 123 |
122 Member<PrerenderHandle> prerender_; | 124 Member<PrerenderHandle> prerender_; |
123 Member<LinkPreloadResourceClient> link_preload_resource_client_; | 125 Member<LinkPreloadResourceClient> link_preload_resource_client_; |
124 }; | 126 }; |
125 | 127 |
126 } // namespace blink | 128 } // namespace blink |
127 | 129 |
128 #endif | 130 #endif |
OLD | NEW |