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

Side by Side Diff: content/child/resource_dispatcher.cc

Issue 2573743002: Handle MOJO_RESULT_BUSY result in URLResponseBodyConsumer (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 unified diff | Download patch
« no previous file with comments | « no previous file | content/child/url_response_body_consumer.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc e-loading 5 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc e-loading
6 6
7 #include "content/child/resource_dispatcher.h" 7 #include "content/child/resource_dispatcher.h"
8 8
9 #include <utility> 9 #include <utility>
10 10
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 ~URLLoaderClientImpl() override { 88 ~URLLoaderClientImpl() override {
89 if (body_consumer_) 89 if (body_consumer_)
90 body_consumer_->Cancel(); 90 body_consumer_->Cancel();
91 } 91 }
92 92
93 void OnReceiveResponse( 93 void OnReceiveResponse(
94 const ResourceResponseHead& response_head, 94 const ResourceResponseHead& response_head,
95 mojom::DownloadedTempFilePtr downloaded_file) override { 95 mojom::DownloadedTempFilePtr downloaded_file) override {
96 has_received_response_ = true; 96 has_received_response_ = true;
97 if (body_consumer_) 97 if (body_consumer_)
98 body_consumer_->Start(task_runner_.get()); 98 body_consumer_->Start();
99 downloaded_file_ = std::move(downloaded_file); 99 downloaded_file_ = std::move(downloaded_file);
100 resource_dispatcher_->OnMessageReceived( 100 resource_dispatcher_->OnMessageReceived(
101 ResourceMsg_ReceivedResponse(request_id_, response_head)); 101 ResourceMsg_ReceivedResponse(request_id_, response_head));
102 } 102 }
103 103
104 void OnReceiveRedirect(const net::RedirectInfo& redirect_info, 104 void OnReceiveRedirect(const net::RedirectInfo& redirect_info,
105 const ResourceResponseHead& response_head) override { 105 const ResourceResponseHead& response_head) override {
106 DCHECK(!has_received_response_); 106 DCHECK(!has_received_response_);
107 DCHECK(!body_consumer_); 107 DCHECK(!body_consumer_);
108 resource_dispatcher_->OnMessageReceived(ResourceMsg_ReceivedRedirect( 108 resource_dispatcher_->OnMessageReceived(ResourceMsg_ReceivedRedirect(
109 request_id_, redirect_info, response_head)); 109 request_id_, redirect_info, response_head));
110 } 110 }
111 111
112 void OnDataDownloaded(int64_t data_len, int64_t encoded_data_len) override { 112 void OnDataDownloaded(int64_t data_len, int64_t encoded_data_len) override {
113 resource_dispatcher_->OnMessageReceived( 113 resource_dispatcher_->OnMessageReceived(
114 ResourceMsg_DataDownloaded(request_id_, data_len, encoded_data_len)); 114 ResourceMsg_DataDownloaded(request_id_, data_len, encoded_data_len));
115 } 115 }
116 116
117 void OnStartLoadingResponseBody( 117 void OnStartLoadingResponseBody(
118 mojo::ScopedDataPipeConsumerHandle body) override { 118 mojo::ScopedDataPipeConsumerHandle body) override {
119 DCHECK(!body_consumer_); 119 DCHECK(!body_consumer_);
120 body_consumer_ = new URLResponseBodyConsumer( 120 body_consumer_ = new URLResponseBodyConsumer(
121 request_id_, resource_dispatcher_, std::move(body), task_runner_); 121 request_id_, resource_dispatcher_, std::move(body), task_runner_);
122 if (has_received_response_) 122 if (has_received_response_)
123 body_consumer_->Start(task_runner_.get()); 123 body_consumer_->Start();
124 } 124 }
125 125
126 void OnComplete(const ResourceRequestCompletionStatus& status) override { 126 void OnComplete(const ResourceRequestCompletionStatus& status) override {
127 if (!body_consumer_) { 127 if (!body_consumer_) {
128 resource_dispatcher_->OnMessageReceived( 128 resource_dispatcher_->OnMessageReceived(
129 ResourceMsg_RequestComplete(request_id_, status)); 129 ResourceMsg_RequestComplete(request_id_, status));
130 return; 130 return;
131 } 131 }
132 body_consumer_->OnComplete(status); 132 body_consumer_->OnComplete(status);
133 } 133 }
(...skipping 727 matching lines...) Expand 10 before | Expand all | Expand 10 after
861 delete message; 861 delete message;
862 } 862 }
863 } 863 }
864 864
865 void ResourceDispatcher::SetResourceSchedulingFilter( 865 void ResourceDispatcher::SetResourceSchedulingFilter(
866 scoped_refptr<ResourceSchedulingFilter> resource_scheduling_filter) { 866 scoped_refptr<ResourceSchedulingFilter> resource_scheduling_filter) {
867 resource_scheduling_filter_ = resource_scheduling_filter; 867 resource_scheduling_filter_ = resource_scheduling_filter;
868 } 868 }
869 869
870 } // namespace content 870 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/child/url_response_body_consumer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698