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

Side by Side Diff: content/common/throttling_url_loader.cc

Issue 2925343003: Fix ThrottlingURLLoader to set task runner on Binding<URLLoaderClient>. (Closed)
Patch Set: Created 3 years, 6 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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 #include "content/common/throttling_url_loader.h" 5 #include "content/common/throttling_url_loader.h"
6 6
7 #include "base/single_thread_task_runner.h" 7 #include "base/single_thread_task_runner.h"
8 8
9 namespace content { 9 namespace content {
10 10
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 if (deferred) { 117 if (deferred) {
118 deferred_stage_ = DEFERRED_START; 118 deferred_stage_ = DEFERRED_START;
119 start_info_ = base::MakeUnique<StartInfo>(factory, routing_id, request_id, 119 start_info_ = base::MakeUnique<StartInfo>(factory, routing_id, request_id,
120 options, std::move(url_request), 120 options, std::move(url_request),
121 std::move(task_runner)); 121 std::move(task_runner));
122 return; 122 return;
123 } 123 }
124 } 124 }
125 125
126 mojom::URLLoaderClientPtr client; 126 mojom::URLLoaderClientPtr client;
127 client_binding_.Bind(mojo::MakeRequest(&client, std::move(task_runner))); 127 client_binding_.Bind(mojo::MakeRequest(&client), std::move(task_runner));
128 factory->CreateLoaderAndStart(mojo::MakeRequest(&url_loader_), routing_id, 128 factory->CreateLoaderAndStart(mojo::MakeRequest(&url_loader_), routing_id,
129 request_id, options, *url_request, 129 request_id, options, *url_request,
130 std::move(client)); 130 std::move(client));
131 } 131 }
132 132
133 void ThrottlingURLLoader::OnReceiveResponse( 133 void ThrottlingURLLoader::OnReceiveResponse(
134 const ResourceResponseHead& response_head, 134 const ResourceResponseHead& response_head,
135 const base::Optional<net::SSLInfo>& ssl_info, 135 const base::Optional<net::SSLInfo>& ssl_info,
136 mojom::DownloadedTempFilePtr downloaded_file) { 136 mojom::DownloadedTempFilePtr downloaded_file) {
137 DCHECK_EQ(DEFERRED_NONE, deferred_stage_); 137 DCHECK_EQ(DEFERRED_NONE, deferred_stage_);
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 } 250 }
251 251
252 void ThrottlingURLLoader::Resume() { 252 void ThrottlingURLLoader::Resume() {
253 if (cancelled_by_throttle_ || deferred_stage_ == DEFERRED_NONE) 253 if (cancelled_by_throttle_ || deferred_stage_ == DEFERRED_NONE)
254 return; 254 return;
255 255
256 switch (deferred_stage_) { 256 switch (deferred_stage_) {
257 case DEFERRED_START: { 257 case DEFERRED_START: {
258 mojom::URLLoaderClientPtr client; 258 mojom::URLLoaderClientPtr client;
259 client_binding_.Bind( 259 client_binding_.Bind(
260 mojo::MakeRequest(&client, std::move(start_info_->task_runner))); 260 mojo::MakeRequest(&client), std::move(start_info_->task_runner));
261 start_info_->url_loader_factory->CreateLoaderAndStart( 261 start_info_->url_loader_factory->CreateLoaderAndStart(
262 mojo::MakeRequest(&url_loader_), start_info_->routing_id, 262 mojo::MakeRequest(&url_loader_), start_info_->routing_id,
263 start_info_->request_id, start_info_->options, 263 start_info_->request_id, start_info_->options,
264 *start_info_->url_request, std::move(client)); 264 *start_info_->url_request, std::move(client));
265 265
266 if (priority_info_) { 266 if (priority_info_) {
267 auto priority_info = std::move(priority_info_); 267 auto priority_info = std::move(priority_info_);
268 url_loader_->SetPriority(priority_info->priority, 268 url_loader_->SetPriority(priority_info->priority,
269 priority_info->intra_priority_value); 269 priority_info->intra_priority_value);
270 } 270 }
(...skipping 13 matching lines...) Expand all
284 break; 284 break;
285 } 285 }
286 default: 286 default:
287 NOTREACHED(); 287 NOTREACHED();
288 break; 288 break;
289 } 289 }
290 deferred_stage_ = DEFERRED_NONE; 290 deferred_stage_ = DEFERRED_NONE;
291 } 291 }
292 292
293 } // namespace content 293 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698