Chromium Code Reviews| 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 43 #include "wtf/OwnPtr.h" | 43 #include "wtf/OwnPtr.h" |
| 44 | 44 |
| 45 namespace blink { | 45 namespace blink { |
| 46 | 46 |
| 47 class Document; | 47 class Document; |
| 48 class LinkRelAttribute; | 48 class LinkRelAttribute; |
| 49 class NetworkHintsInterface; | 49 class NetworkHintsInterface; |
| 50 class PrerenderHandle; | 50 class PrerenderHandle; |
| 51 | 51 |
| 52 // The LinkLoader can load link rel types icon, dns-prefetch, subresource, prefe tch and prerender. | 52 // The LinkLoader can load link rel types icon, dns-prefetch, subresource, prefe tch and prerender. |
| 53 class CORE_EXPORT LinkLoader final : public ResourceOwner<Resource, ResourceClie nt>, public PrerenderClient { | 53 class CORE_EXPORT LinkLoader final : public NoBaseWillBeGarbageCollectedFinalize d<LinkLoader>, public ResourceOwner<Resource, ResourceClient>, public PrerenderC lient { |
| 54 DISALLOW_NEW(); | 54 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(LinkLoader); |
| 55 public: | 55 public: |
| 56 explicit LinkLoader(LinkLoaderClient*); | 56 static PassOwnPtrWillBeRawPtr<LinkLoader> create(LinkLoaderClient* client) |
| 57 { | |
| 58 return adoptPtrWillBeNoop(new LinkLoader(client)); | |
| 59 } | |
| 57 ~LinkLoader() override; | 60 ~LinkLoader() override; |
| 58 | 61 |
| 59 // from ResourceClient | 62 // from ResourceClient |
| 60 void notifyFinished(Resource*) override; | 63 void notifyFinished(Resource*) override; |
| 61 String debugName() const override { return "LinkLoader"; } | 64 String debugName() const override { return "LinkLoader"; } |
| 62 | 65 |
| 63 // from PrerenderClient | 66 // from PrerenderClient |
| 64 void didStartPrerender() override; | 67 void didStartPrerender() override; |
| 65 void didStopPrerender() override; | 68 void didStopPrerender() override; |
| 66 void didSendLoadForPrerender() override; | 69 void didSendLoadForPrerender() override; |
| 67 void didSendDOMContentLoadedForPrerender() override; | 70 void didSendDOMContentLoadedForPrerender() override; |
| 68 | 71 |
| 69 void released(); | 72 void released(); |
| 70 bool loadLink(const LinkRelAttribute&, CrossOriginAttributeValue, const Stri ng& type, const String& as, const KURL&, Document&, const NetworkHintsInterface& ); | 73 bool loadLink(const LinkRelAttribute&, CrossOriginAttributeValue, const Stri ng& type, const String& as, const KURL&, Document&, const NetworkHintsInterface& ); |
| 71 enum CanLoadResources { LoadResources, DoNotLoadResources }; | 74 enum CanLoadResources { LoadResources, DoNotLoadResources }; |
| 72 static bool loadLinkFromHeader(const String& headerValue, Document*, const N etworkHintsInterface&, CanLoadResources); | 75 static bool loadLinkFromHeader(const String& headerValue, Document*, const N etworkHintsInterface&, CanLoadResources); |
| 73 | 76 |
| 74 DECLARE_TRACE(); | 77 DECLARE_TRACE(); |
| 75 | 78 |
| 76 private: | 79 private: |
| 80 explicit LinkLoader(LinkLoaderClient*); | |
| 81 | |
| 77 void linkLoadTimerFired(Timer<LinkLoader>*); | 82 void linkLoadTimerFired(Timer<LinkLoader>*); |
| 78 void linkLoadingErrorTimerFired(Timer<LinkLoader>*); | 83 void linkLoadingErrorTimerFired(Timer<LinkLoader>*); |
| 79 | 84 |
| 80 LinkLoaderClient* m_client; | 85 LinkLoaderClient* m_client; |
|
haraken
2016/01/12 00:22:52
It would be better to make LinkLoaderClient a GCMi
| |
| 81 | 86 |
| 82 Timer<LinkLoader> m_linkLoadTimer; | 87 Timer<LinkLoader> m_linkLoadTimer; |
| 83 Timer<LinkLoader> m_linkLoadingErrorTimer; | 88 Timer<LinkLoader> m_linkLoadingErrorTimer; |
| 84 | 89 |
| 85 OwnPtrWillBeMember<PrerenderHandle> m_prerender; | 90 OwnPtrWillBeMember<PrerenderHandle> m_prerender; |
| 86 }; | 91 }; |
| 87 | 92 |
| 88 } | 93 } |
| 89 | 94 |
| 90 #endif | 95 #endif |
| OLD | NEW |