Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6)

Side by Side Diff: third_party/WebKit/Source/core/loader/LinkLoader.h

Issue 1586563014: Add <link rel=preload> onload support for scripts and styles (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased and added trace for ResourceOWner Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 18 matching lines...) Expand all
29 * 29 *
30 */ 30 */
31 31
32 #ifndef LinkLoader_h 32 #ifndef LinkLoader_h
33 #define LinkLoader_h 33 #define LinkLoader_h
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/LinkPreloadResourceClients.h"
39 #include "platform/CrossOriginAttributeValue.h" 40 #include "platform/CrossOriginAttributeValue.h"
40 #include "platform/PrerenderClient.h" 41 #include "platform/PrerenderClient.h"
41 #include "platform/Timer.h" 42 #include "platform/Timer.h"
42 #include "platform/heap/Handle.h" 43 #include "platform/heap/Handle.h"
43 #include "wtf/OwnPtr.h" 44 #include "wtf/OwnPtr.h"
44 45
45 namespace blink { 46 namespace blink {
46 47
47 class Document; 48 class Document;
48 class LinkRelAttribute; 49 class LinkRelAttribute;
(...skipping 13 matching lines...) Expand all
62 // from ResourceClient 63 // from ResourceClient
63 void notifyFinished(Resource*) override; 64 void notifyFinished(Resource*) override;
64 String debugName() const override { return "LinkLoader"; } 65 String debugName() const override { return "LinkLoader"; }
65 66
66 // from PrerenderClient 67 // from PrerenderClient
67 void didStartPrerender() override; 68 void didStartPrerender() override;
68 void didStopPrerender() override; 69 void didStopPrerender() override;
69 void didSendLoadForPrerender() override; 70 void didSendLoadForPrerender() override;
70 void didSendDOMContentLoadedForPrerender() override; 71 void didSendDOMContentLoadedForPrerender() override;
71 72
73 void triggerEvents(const Resource*);
74
72 void released(); 75 void released();
73 bool loadLink(const LinkRelAttribute&, CrossOriginAttributeValue, const Stri ng& type, const String& as, const KURL&, Document&, const NetworkHintsInterface& ); 76 bool loadLink(const LinkRelAttribute&, CrossOriginAttributeValue, const Stri ng& type, const String& as, const KURL&, Document&, const NetworkHintsInterface& );
74 enum CanLoadResources { LoadResources, DoNotLoadResources }; 77 enum CanLoadResources { LoadResources, DoNotLoadResources };
75 static bool loadLinkFromHeader(const String& headerValue, Document*, const N etworkHintsInterface&, CanLoadResources); 78 static bool loadLinkFromHeader(const String& headerValue, Document*, const N etworkHintsInterface&, CanLoadResources);
76 static Resource::Type getTypeFromAsAttribute(const String& as, Document*); 79 static Resource::Type getTypeFromAsAttribute(const String& as, Document*);
77 80
78 DECLARE_TRACE(); 81 DECLARE_TRACE();
79 82
80 private: 83 private:
81 explicit LinkLoader(LinkLoaderClient*); 84 explicit LinkLoader(LinkLoaderClient*);
82 85
83 void linkLoadTimerFired(Timer<LinkLoader>*); 86 void linkLoadTimerFired(Timer<LinkLoader>*);
84 void linkLoadingErrorTimerFired(Timer<LinkLoader>*); 87 void linkLoadingErrorTimerFired(Timer<LinkLoader>*);
88 void createLinkPreloadResourceClient(ResourcePtr<Resource>);
85 89
86 LinkLoaderClient* m_client; 90 LinkLoaderClient* m_client;
87 91
88 Timer<LinkLoader> m_linkLoadTimer; 92 Timer<LinkLoader> m_linkLoadTimer;
89 Timer<LinkLoader> m_linkLoadingErrorTimer; 93 Timer<LinkLoader> m_linkLoadingErrorTimer;
90 94
91 OwnPtrWillBeMember<PrerenderHandle> m_prerender; 95 OwnPtrWillBeMember<PrerenderHandle> m_prerender;
96 OwnPtrWillBeMember<LinkPreloadResourceClient> m_linkPreloadResourceClient;
sof 2016/01/20 12:22:53 This is another reason why LinkPreloadResourceClie
92 }; 97 };
93 98
94 } 99 }
95 100
96 #endif 101 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698