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

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

Issue 2954853002: Use Independent URLLoader
Patch Set: . Created 3 years, 5 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
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 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 uint32_t options, 158 uint32_t options,
159 StartLoaderCallback start_loader_callback, 159 StartLoaderCallback start_loader_callback,
160 const ResourceRequest& url_request, 160 const ResourceRequest& url_request,
161 scoped_refptr<base::SingleThreadTaskRunner> task_runner) { 161 scoped_refptr<base::SingleThreadTaskRunner> task_runner) {
162 mojom::URLLoaderClientPtr client; 162 mojom::URLLoaderClientPtr client;
163 client_binding_.Bind(mojo::MakeRequest(&client), std::move(task_runner)); 163 client_binding_.Bind(mojo::MakeRequest(&client), std::move(task_runner));
164 164
165 if (factory) { 165 if (factory) {
166 DCHECK(!start_loader_callback); 166 DCHECK(!start_loader_callback);
167 167
168 mojom::URLLoaderAssociatedPtr url_loader; 168 auto url_loader_request = mojo::MakeRequest(&url_loader_);
169 auto url_loader_request = mojo::MakeRequest(&url_loader);
170 url_loader_ = std::move(url_loader);
171 factory->CreateLoaderAndStart(std::move(url_loader_request), routing_id, 169 factory->CreateLoaderAndStart(std::move(url_loader_request), routing_id,
172 request_id, options, url_request, 170 request_id, options, url_request,
173 std::move(client), traffic_annotation_); 171 std::move(client), traffic_annotation_);
174 } else { 172 } else {
175 mojom::URLLoaderPtr url_loader; 173 auto url_loader_request = mojo::MakeRequest(&url_loader_);
176 auto url_loader_request = mojo::MakeRequest(&url_loader);
177 url_loader_ = std::move(url_loader);
178 std::move(start_loader_callback) 174 std::move(start_loader_callback)
179 .Run(std::move(url_loader_request), std::move(client)); 175 .Run(std::move(url_loader_request), std::move(client));
180 } 176 }
181 } 177 }
182 178
183 void ThrottlingURLLoader::OnReceiveResponse( 179 void ThrottlingURLLoader::OnReceiveResponse(
184 const ResourceResponseHead& response_head, 180 const ResourceResponseHead& response_head,
185 const base::Optional<net::SSLInfo>& ssl_info, 181 const base::Optional<net::SSLInfo>& ssl_info,
186 mojom::DownloadedTempFilePtr downloaded_file) { 182 mojom::DownloadedTempFilePtr downloaded_file) {
187 DCHECK_EQ(DEFERRED_NONE, deferred_stage_); 183 DCHECK_EQ(DEFERRED_NONE, deferred_stage_);
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
331 break; 327 break;
332 } 328 }
333 default: 329 default:
334 NOTREACHED(); 330 NOTREACHED();
335 break; 331 break;
336 } 332 }
337 deferred_stage_ = DEFERRED_NONE; 333 deferred_stage_ = DEFERRED_NONE;
338 } 334 }
339 335
340 } // namespace content 336 } // namespace content
OLDNEW
« no previous file with comments | « content/common/throttling_url_loader.h ('k') | content/common/throttling_url_loader_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698