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 23 matching lines...) Expand all Loading... |
34 | 34 |
35 #include "core/CoreExport.h" | 35 #include "core/CoreExport.h" |
36 #include "core/fetch/ResourceClient.h" | 36 #include "core/fetch/ResourceClient.h" |
37 #include "core/fetch/ResourceOwner.h" | 37 #include "core/fetch/ResourceOwner.h" |
38 #include "core/loader/LinkLoaderClient.h" | 38 #include "core/loader/LinkLoaderClient.h" |
39 #include "core/loader/resource/LinkPreloadResourceClients.h" | 39 #include "core/loader/resource/LinkPreloadResourceClients.h" |
40 #include "platform/CrossOriginAttributeValue.h" | 40 #include "platform/CrossOriginAttributeValue.h" |
41 #include "platform/PrerenderClient.h" | 41 #include "platform/PrerenderClient.h" |
42 #include "platform/Timer.h" | 42 #include "platform/Timer.h" |
43 #include "platform/heap/Handle.h" | 43 #include "platform/heap/Handle.h" |
| 44 #include "wtf/Optional.h" |
44 | 45 |
45 namespace blink { | 46 namespace blink { |
46 | 47 |
47 class Document; | 48 class Document; |
48 class LinkRelAttribute; | 49 class LinkRelAttribute; |
49 class NetworkHintsInterface; | 50 class NetworkHintsInterface; |
50 class PrerenderHandle; | 51 class PrerenderHandle; |
51 struct ViewportDescriptionWrapper; | 52 struct ViewportDescriptionWrapper; |
52 | 53 |
53 // The LinkLoader can load link rel types icon, dns-prefetch, subresource, | 54 // The LinkLoader can load link rel types icon, dns-prefetch, subresource, |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 // Media links cannot be preloaded until the first chunk is parsed. The rest | 95 // Media links cannot be preloaded until the first chunk is parsed. The rest |
95 // can be preloaded at commit time. | 96 // can be preloaded at commit time. |
96 enum MediaPreloadPolicy { LoadAll, OnlyLoadNonMedia, OnlyLoadMedia }; | 97 enum MediaPreloadPolicy { LoadAll, OnlyLoadNonMedia, OnlyLoadMedia }; |
97 static void loadLinksFromHeader(const String& headerValue, | 98 static void loadLinksFromHeader(const String& headerValue, |
98 const KURL& baseURL, | 99 const KURL& baseURL, |
99 Document*, | 100 Document*, |
100 const NetworkHintsInterface&, | 101 const NetworkHintsInterface&, |
101 CanLoadResources, | 102 CanLoadResources, |
102 MediaPreloadPolicy, | 103 MediaPreloadPolicy, |
103 ViewportDescriptionWrapper*); | 104 ViewportDescriptionWrapper*); |
104 static bool getResourceTypeFromAsAttribute(const String& as, Resource::Type&); | 105 static WTF::Optional<Resource::Type> getResourceTypeFromAsAttribute( |
| 106 const String& as); |
105 | 107 |
106 DECLARE_TRACE(); | 108 DECLARE_TRACE(); |
107 | 109 |
108 private: | 110 private: |
109 explicit LinkLoader(LinkLoaderClient*); | 111 explicit LinkLoader(LinkLoaderClient*); |
110 | 112 |
111 void linkLoadTimerFired(TimerBase*); | 113 void linkLoadTimerFired(TimerBase*); |
112 void linkLoadingErrorTimerFired(TimerBase*); | 114 void linkLoadingErrorTimerFired(TimerBase*); |
113 void createLinkPreloadResourceClient(Resource*); | 115 void createLinkPreloadResourceClient(Resource*); |
114 | 116 |
115 Member<LinkLoaderClient> m_client; | 117 Member<LinkLoaderClient> m_client; |
116 | 118 |
117 Timer<LinkLoader> m_linkLoadTimer; | 119 Timer<LinkLoader> m_linkLoadTimer; |
118 Timer<LinkLoader> m_linkLoadingErrorTimer; | 120 Timer<LinkLoader> m_linkLoadingErrorTimer; |
119 | 121 |
120 Member<PrerenderHandle> m_prerender; | 122 Member<PrerenderHandle> m_prerender; |
121 Member<LinkPreloadResourceClient> m_linkPreloadResourceClient; | 123 Member<LinkPreloadResourceClient> m_linkPreloadResourceClient; |
122 }; | 124 }; |
123 | 125 |
124 } // namespace blink | 126 } // namespace blink |
125 | 127 |
126 #endif | 128 #endif |
OLD | NEW |