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

Unified Diff: third_party/WebKit/Source/web/WebAssociatedURLLoaderImpl.h

Issue 2399463007: AssociatedURLLoader shouldn't derive from WebURLLoader (Closed)
Patch Set: Rebase Created 4 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/web/WebAssociatedURLLoaderImpl.h
diff --git a/third_party/WebKit/Source/web/WebAssociatedURLLoaderImpl.h b/third_party/WebKit/Source/web/WebAssociatedURLLoaderImpl.h
new file mode 100644
index 0000000000000000000000000000000000000000..3d8eb0673a949aa3fab9af62aef87f859a23751d
--- /dev/null
+++ b/third_party/WebKit/Source/web/WebAssociatedURLLoaderImpl.h
@@ -0,0 +1,71 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef WebAssociatedURLLoaderImpl_h
+#define WebAssociatedURLLoaderImpl_h
+
+#include "platform/heap/Handle.h"
+#include "public/web/WebAssociatedURLLoader.h"
+#include "public/web/WebAssociatedURLLoaderOptions.h"
+#include "wtf/Noncopyable.h"
+#include "wtf/RefPtr.h"
+#include <memory>
+
+namespace blink {
+
+class DocumentThreadableLoader;
+class WebAssociatedURLLoaderClient;
+class WebLocalFrameImpl;
+
+// This class is used to implement WebFrame::createAssociatedURLLoader.
+class WebAssociatedURLLoaderImpl final : public WebAssociatedURLLoader {
+ WTF_MAKE_NONCOPYABLE(WebAssociatedURLLoaderImpl);
+
+ public:
+ WebAssociatedURLLoaderImpl(WebLocalFrameImpl*,
+ const WebAssociatedURLLoaderOptions&);
+ ~WebAssociatedURLLoaderImpl();
+
+ void loadAsynchronously(const WebURLRequest&,
+ WebAssociatedURLLoaderClient*) override;
+ void cancel() override;
+ void setDefersLoading(bool) override;
+ void setLoadingTaskRunner(blink::WebTaskRunner*) override;
+
+ // Called by |m_observer| to handle destruction of the Document associated
+ // with the frame given to the constructor.
+ void documentDestroyed();
+
+ // Called by ClientAdapter to handle completion of loading.
+ void clientAdapterDone();
+
+ private:
+ class ClientAdapter;
+ class Observer;
+
+ void cancelLoader();
+ void disposeObserver();
+
+ WebAssociatedURLLoaderClient* releaseClient() {
+ WebAssociatedURLLoaderClient* client = m_client;
+ m_client = nullptr;
+ return client;
+ }
+
+ WebAssociatedURLLoaderClient* m_client;
+ WebAssociatedURLLoaderOptions m_options;
+
+ // An adapter which converts the DocumentThreadableLoaderClient method
+ // calls into the WebURLLoaderClient method calls.
+ std::unique_ptr<ClientAdapter> m_clientAdapter;
+ Persistent<DocumentThreadableLoader> m_loader;
+
+ // A ContextLifecycleObserver for cancelling |m_loader| when the Document
+ // is detached.
+ Persistent<Observer> m_observer;
+};
+
+} // namespace blink
+
+#endif
« no previous file with comments | « third_party/WebKit/Source/web/BUILD.gn ('k') | third_party/WebKit/Source/web/WebAssociatedURLLoaderImpl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698