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

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
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..96f2ce20552cc1bab913b81cbb54fbcfc056237e 100644
--- a/content/child/url_loader_client_impl.h
+++ b/content/child/url_loader_client_impl.h
@@ -6,6 +6,7 @@
#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 "content/common/content_export.h"
@@ -42,6 +43,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,15 +64,19 @@ 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_;
+ const scoped_refptr<base::RefCountedData<bool>> is_destroyed_;
scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
};

Powered by Google App Engine
This is Rietveld 408576698