OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef WebAssociatedURLLoaderImpl_h |
| 6 #define WebAssociatedURLLoaderImpl_h |
| 7 |
| 8 #include "platform/heap/Handle.h" |
| 9 #include "public/web/WebAssociatedURLLoader.h" |
| 10 #include "public/web/WebAssociatedURLLoaderOptions.h" |
| 11 #include "wtf/Noncopyable.h" |
| 12 #include "wtf/RefPtr.h" |
| 13 #include <memory> |
| 14 |
| 15 namespace blink { |
| 16 |
| 17 class DocumentThreadableLoader; |
| 18 class WebAssociatedURLLoaderClient; |
| 19 class WebLocalFrameImpl; |
| 20 |
| 21 // This class is used to implement WebFrame::createAssociatedURLLoader. |
| 22 class WebAssociatedURLLoaderImpl final : public WebAssociatedURLLoader { |
| 23 WTF_MAKE_NONCOPYABLE(WebAssociatedURLLoaderImpl); |
| 24 |
| 25 public: |
| 26 WebAssociatedURLLoaderImpl(WebLocalFrameImpl*, |
| 27 const WebAssociatedURLLoaderOptions&); |
| 28 ~WebAssociatedURLLoaderImpl(); |
| 29 |
| 30 void loadAsynchronously(const WebURLRequest&, |
| 31 WebAssociatedURLLoaderClient*) override; |
| 32 void cancel() override; |
| 33 void setDefersLoading(bool) override; |
| 34 void setLoadingTaskRunner(blink::WebTaskRunner*) override; |
| 35 |
| 36 // Called by |m_observer| to handle destruction of the Document associated |
| 37 // with the frame given to the constructor. |
| 38 void documentDestroyed(); |
| 39 |
| 40 // Called by ClientAdapter to handle completion of loading. |
| 41 void clientAdapterDone(); |
| 42 |
| 43 private: |
| 44 class ClientAdapter; |
| 45 class Observer; |
| 46 |
| 47 void cancelLoader(); |
| 48 void disposeObserver(); |
| 49 |
| 50 WebAssociatedURLLoaderClient* releaseClient() { |
| 51 WebAssociatedURLLoaderClient* client = m_client; |
| 52 m_client = nullptr; |
| 53 return client; |
| 54 } |
| 55 |
| 56 WebAssociatedURLLoaderClient* m_client; |
| 57 WebAssociatedURLLoaderOptions m_options; |
| 58 |
| 59 // An adapter which converts the DocumentThreadableLoaderClient method |
| 60 // calls into the WebURLLoaderClient method calls. |
| 61 std::unique_ptr<ClientAdapter> m_clientAdapter; |
| 62 Persistent<DocumentThreadableLoader> m_loader; |
| 63 |
| 64 // A ContextLifecycleObserver for cancelling |m_loader| when the Document |
| 65 // is detached. |
| 66 Persistent<Observer> m_observer; |
| 67 }; |
| 68 |
| 69 } // namespace blink |
| 70 |
| 71 #endif |
OLD | NEW |