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

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

Issue 2043753002: Declarative resource hints go through mojo IPC to //content Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use unique_ptr to avoid memory leaks in unit tests Created 4 years, 6 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 29 matching lines...) Expand all
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/OwnPtr.h" 44 #include "wtf/OwnPtr.h"
45 45
46 namespace blink { 46 namespace blink {
47 47
48 class Document; 48 class Document;
49 class LinkRelAttribute; 49 class LinkRelAttribute;
50 class NetworkHintsInterface;
51 class PrerenderHandle; 50 class PrerenderHandle;
52 struct ViewportDescriptionWrapper; 51 struct ViewportDescriptionWrapper;
53 52
54 // The LinkLoader can load link rel types icon, dns-prefetch, subresource, prefe tch and prerender. 53 // The LinkLoader can load link rel types icon, dns-prefetch, subresource, prefe tch and prerender.
55 class CORE_EXPORT LinkLoader final : public GarbageCollectedFinalized<LinkLoader >, public ResourceOwner<Resource, ResourceClient>, public PrerenderClient { 54 class CORE_EXPORT LinkLoader final : public GarbageCollectedFinalized<LinkLoader >, public ResourceOwner<Resource, ResourceClient>, public PrerenderClient {
56 USING_GARBAGE_COLLECTED_MIXIN(LinkLoader); 55 USING_GARBAGE_COLLECTED_MIXIN(LinkLoader);
57 public: 56 public:
58 static LinkLoader* create(LinkLoaderClient* client) 57 static LinkLoader* create(LinkLoaderClient* client)
59 { 58 {
60 return new LinkLoader(client); 59 return new LinkLoader(client);
61 } 60 }
62 ~LinkLoader() override; 61 ~LinkLoader() override;
63 62
64 // from ResourceClient 63 // from ResourceClient
65 void notifyFinished(Resource*) override; 64 void notifyFinished(Resource*) override;
66 String debugName() const override { return "LinkLoader"; } 65 String debugName() const override { return "LinkLoader"; }
67 66
68 // from PrerenderClient 67 // from PrerenderClient
69 void didStartPrerender() override; 68 void didStartPrerender() override;
70 void didStopPrerender() override; 69 void didStopPrerender() override;
71 void didSendLoadForPrerender() override; 70 void didSendLoadForPrerender() override;
72 void didSendDOMContentLoadedForPrerender() override; 71 void didSendDOMContentLoadedForPrerender() override;
73 72
74 void triggerEvents(const Resource*); 73 void triggerEvents(const Resource*);
75 74
76 void released(); 75 void released();
77 bool loadLink(const LinkRelAttribute&, CrossOriginAttributeValue, const Stri ng& type, const String& as, const String& media, const KURL&, Document&, const N etworkHintsInterface&); 76 bool loadLink(const LinkRelAttribute&, CrossOriginAttributeValue, const Stri ng& type, const String& as, const String& media, const KURL&, Document&);
78 enum CanLoadResources { OnlyLoadResources, DoNotLoadResources, LoadResources AndPreconnect }; 77 enum CanLoadResources { OnlyLoadResources, DoNotLoadResources, LoadResources AndPreconnect };
79 static void loadLinksFromHeader(const String& headerValue, const KURL& baseU RL, Document*, const NetworkHintsInterface&, CanLoadResources, ViewportDescripti onWrapper*); 78 static void loadLinksFromHeader(const String& headerValue, const KURL& baseU RL, Document*, CanLoadResources, ViewportDescriptionWrapper*);
80 static bool getResourceTypeFromAsAttribute(const String& as, Resource::Type& ); 79 static bool getResourceTypeFromAsAttribute(const String& as, Resource::Type& );
81 80
82 DECLARE_TRACE(); 81 DECLARE_TRACE();
83 82
84 private: 83 private:
85 explicit LinkLoader(LinkLoaderClient*); 84 explicit LinkLoader(LinkLoaderClient*);
86 85
87 void linkLoadTimerFired(Timer<LinkLoader>*); 86 void linkLoadTimerFired(Timer<LinkLoader>*);
88 void linkLoadingErrorTimerFired(Timer<LinkLoader>*); 87 void linkLoadingErrorTimerFired(Timer<LinkLoader>*);
89 void createLinkPreloadResourceClient(Resource*); 88 void createLinkPreloadResourceClient(Resource*);
90 89
91 Member<LinkLoaderClient> m_client; 90 Member<LinkLoaderClient> m_client;
92 91
93 Timer<LinkLoader> m_linkLoadTimer; 92 Timer<LinkLoader> m_linkLoadTimer;
94 Timer<LinkLoader> m_linkLoadingErrorTimer; 93 Timer<LinkLoader> m_linkLoadingErrorTimer;
95 94
96 Member<PrerenderHandle> m_prerender; 95 Member<PrerenderHandle> m_prerender;
97 Member<LinkPreloadResourceClient> m_linkPreloadResourceClient; 96 Member<LinkPreloadResourceClient> m_linkPreloadResourceClient;
98 }; 97 };
99 98
100 } // namespace blink 99 } // namespace blink
101 100
102 #endif 101 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698