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

Unified Diff: content/child/url_loader_client_impl.h

Issue 2591383003: Implement SetDefersLoading on content::URLLoaderClientImpl (Closed)
Patch Set: fix Created 4 years 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
« no previous file with comments | « content/child/test_request_peer.cc ('k') | content/child/url_loader_client_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/child/url_loader_client_impl.h
diff --git a/content/child/url_loader_client_impl.h b/content/child/url_loader_client_impl.h
index 3710c074c367cd8791ced8cf9d742834afc6a4c8..ada64af8cb5e5928565af62125c49ccc7ecc6295 100644
--- a/content/child/url_loader_client_impl.h
+++ b/content/child/url_loader_client_impl.h
@@ -6,8 +6,10 @@
#define CONTENT_CHILD_URL_LOADER_CLIENT_IMPL_H_
#include <stdint.h>
+#include <vector>
#include "base/callback_forward.h"
#include "base/memory/ref_counted.h"
+#include "base/memory/weak_ptr.h"
#include "content/common/content_export.h"
#include "content/common/url_loader.mojom.h"
#include "ipc/ipc_message.h"
@@ -42,6 +44,16 @@ class CONTENT_EXPORT URLLoaderClientImpl final : public mojom::URLLoaderClient {
void Bind(mojom::URLLoaderClientAssociatedPtrInfo* client_ptr_info,
mojo::AssociatedGroup* associated_group);
+ // Sets |is_deferred_|. From now, the received messages are not dispatched
+ // to clients until UnsetDefersLoading is called.
+ void SetDefersLoading();
+
+ // Unsets |is_deferred_|.
+ void UnsetDefersLoading();
+
+ // Disaptches the messages received after SetDefersLoading is called.
+ void FlushDeferredMessages();
+
// mojom::URLLoaderClient implementation
void OnReceiveResponse(const ResourceResponseHead& response_head,
mojom::DownloadedTempFilePtr downloaded_file) override;
@@ -53,16 +65,20 @@ class CONTENT_EXPORT URLLoaderClientImpl final : public mojom::URLLoaderClient {
mojo::ScopedDataPipeConsumerHandle body) override;
void OnComplete(const ResourceRequestCompletionStatus& status) override;
-private:
+ private:
void Dispatch(const IPC::Message& message);
mojo::AssociatedBinding<mojom::URLLoaderClient> binding_;
scoped_refptr<URLResponseBodyConsumer> body_consumer_;
mojom::DownloadedTempFilePtr downloaded_file_;
+ std::vector<IPC::Message> deferred_messages_;
const int request_id_;
bool has_received_response_ = false;
+ bool is_deferred_ = false;
+ int32_t accumulated_transfer_size_diff_during_deferred_ = 0;
ResourceDispatcher* const resource_dispatcher_;
scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
+ base::WeakPtrFactory<URLLoaderClientImpl> weak_factory_;
};
} // namespace content
« no previous file with comments | « content/child/test_request_peer.cc ('k') | content/child/url_loader_client_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698