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

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

Issue 2118903002: scheduler: Move the Blink scheduler into Blink (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Another GYP fix Created 4 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/child/web_url_loader_impl.h" 5 #include "content/child/web_url_loader_impl.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <memory> 10 #include <memory>
11 #include <string> 11 #include <string>
12 #include <utility> 12 #include <utility>
13 #include <vector> 13 #include <vector>
14 14
15 #include "base/bind.h" 15 #include "base/bind.h"
16 #include "base/files/file_path.h" 16 #include "base/files/file_path.h"
17 #include "base/logging.h" 17 #include "base/logging.h"
18 #include "base/memory/ptr_util.h" 18 #include "base/memory/ptr_util.h"
19 #include "base/single_thread_task_runner.h" 19 #include "base/single_thread_task_runner.h"
20 #include "base/strings/string_number_conversions.h" 20 #include "base/strings/string_number_conversions.h"
21 #include "base/strings/string_util.h" 21 #include "base/strings/string_util.h"
22 #include "base/time/time.h" 22 #include "base/time/time.h"
23 #include "build/build_config.h" 23 #include "build/build_config.h"
24 #include "components/mime_util/mime_util.h" 24 #include "components/mime_util/mime_util.h"
25 #include "components/scheduler/child/web_task_runner_impl.h"
26 #include "content/child/child_thread_impl.h" 25 #include "content/child/child_thread_impl.h"
27 #include "content/child/ftp_directory_listing_response_delegate.h" 26 #include "content/child/ftp_directory_listing_response_delegate.h"
28 #include "content/child/request_extra_data.h" 27 #include "content/child/request_extra_data.h"
29 #include "content/child/request_info.h" 28 #include "content/child/request_info.h"
30 #include "content/child/resource_dispatcher.h" 29 #include "content/child/resource_dispatcher.h"
31 #include "content/child/shared_memory_data_consumer_handle.h" 30 #include "content/child/shared_memory_data_consumer_handle.h"
32 #include "content/child/sync_load_response.h" 31 #include "content/child/sync_load_response.h"
33 #include "content/child/web_url_request_util.h" 32 #include "content/child/web_url_request_util.h"
34 #include "content/child/weburlresponse_extradata_impl.h" 33 #include "content/child/weburlresponse_extradata_impl.h"
35 #include "content/common/resource_messages.h" 34 #include "content/common/resource_messages.h"
36 #include "content/common/resource_request_body_impl.h" 35 #include "content/common/resource_request_body_impl.h"
37 #include "content/common/service_worker/service_worker_types.h" 36 #include "content/common/service_worker/service_worker_types.h"
38 #include "content/common/ssl_status_serialization.h" 37 #include "content/common/ssl_status_serialization.h"
39 #include "content/public/child/fixed_received_data.h" 38 #include "content/public/child/fixed_received_data.h"
40 #include "content/public/child/request_peer.h" 39 #include "content/public/child/request_peer.h"
41 #include "content/public/common/browser_side_navigation_policy.h" 40 #include "content/public/common/browser_side_navigation_policy.h"
42 #include "content/public/common/ssl_status.h" 41 #include "content/public/common/ssl_status.h"
43 #include "net/base/data_url.h" 42 #include "net/base/data_url.h"
44 #include "net/base/filename_util.h" 43 #include "net/base/filename_util.h"
45 #include "net/base/net_errors.h" 44 #include "net/base/net_errors.h"
46 #include "net/cert/cert_status_flags.h" 45 #include "net/cert/cert_status_flags.h"
47 #include "net/cert/ct_sct_to_string.h" 46 #include "net/cert/ct_sct_to_string.h"
48 #include "net/http/http_response_headers.h" 47 #include "net/http/http_response_headers.h"
49 #include "net/http/http_util.h" 48 #include "net/http/http_util.h"
50 #include "net/ssl/ssl_cipher_suite_names.h" 49 #include "net/ssl/ssl_cipher_suite_names.h"
51 #include "net/ssl/ssl_connection_status_flags.h" 50 #include "net/ssl/ssl_connection_status_flags.h"
52 #include "net/url_request/url_request_data_job.h" 51 #include "net/url_request/url_request_data_job.h"
53 #include "third_party/WebKit/public/platform/WebHTTPLoadInfo.h" 52 #include "third_party/WebKit/public/platform/WebHTTPLoadInfo.h"
54 #include "third_party/WebKit/public/platform/WebSecurityOrigin.h" 53 #include "third_party/WebKit/public/platform/WebSecurityOrigin.h"
55 #include "third_party/WebKit/public/platform/WebTraceLocation.h" 54 #include "third_party/WebKit/public/platform/WebTaskRunner.h"
56 #include "third_party/WebKit/public/platform/WebURL.h" 55 #include "third_party/WebKit/public/platform/WebURL.h"
57 #include "third_party/WebKit/public/platform/WebURLError.h" 56 #include "third_party/WebKit/public/platform/WebURLError.h"
58 #include "third_party/WebKit/public/platform/WebURLLoadTiming.h" 57 #include "third_party/WebKit/public/platform/WebURLLoadTiming.h"
59 #include "third_party/WebKit/public/platform/WebURLLoaderClient.h" 58 #include "third_party/WebKit/public/platform/WebURLLoaderClient.h"
60 #include "third_party/WebKit/public/platform/WebURLRequest.h" 59 #include "third_party/WebKit/public/platform/WebURLRequest.h"
61 #include "third_party/WebKit/public/platform/WebURLResponse.h" 60 #include "third_party/WebKit/public/platform/WebURLResponse.h"
62 #include "third_party/WebKit/public/web/WebSecurityPolicy.h" 61 #include "third_party/WebKit/public/web/WebSecurityPolicy.h"
63 62
64 using base::Time; 63 using base::Time;
65 using base::TimeTicks; 64 using base::TimeTicks;
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 296
298 } // namespace 297 } // namespace
299 298
300 // This inner class exists since the WebURLLoader may be deleted while inside a 299 // This inner class exists since the WebURLLoader may be deleted while inside a
301 // call to WebURLLoaderClient. Refcounting is to keep the context from being 300 // call to WebURLLoaderClient. Refcounting is to keep the context from being
302 // deleted if it may have work to do after calling into the client. 301 // deleted if it may have work to do after calling into the client.
303 class WebURLLoaderImpl::Context : public base::RefCounted<Context> { 302 class WebURLLoaderImpl::Context : public base::RefCounted<Context> {
304 public: 303 public:
305 using ReceivedData = RequestPeer::ReceivedData; 304 using ReceivedData = RequestPeer::ReceivedData;
306 305
307 Context(WebURLLoaderImpl* loader, 306 Context(WebURLLoaderImpl* loader, ResourceDispatcher* resource_dispatcher);
308 ResourceDispatcher* resource_dispatcher,
309 std::unique_ptr<blink::WebTaskRunner> task_runner);
310 307
311 WebURLLoaderClient* client() const { return client_; } 308 WebURLLoaderClient* client() const { return client_; }
312 void set_client(WebURLLoaderClient* client) { client_ = client; } 309 void set_client(WebURLLoaderClient* client) { client_ = client; }
313 310
314 void Cancel(); 311 void Cancel();
315 void SetDefersLoading(bool value); 312 void SetDefersLoading(bool value);
316 void DidChangePriority(WebURLRequest::Priority new_priority, 313 void DidChangePriority(WebURLRequest::Priority new_priority,
317 int intra_priority_value); 314 int intra_priority_value);
318 void Start(const WebURLRequest& request, 315 void Start(const WebURLRequest& request,
319 SyncLoadResponse* sync_load_response); 316 SyncLoadResponse* sync_load_response);
320 void SetWebTaskRunner(std::unique_ptr<blink::WebTaskRunner> task_runner); 317 void SetTaskRunner(scoped_refptr<base::SingleThreadTaskRunner> task_runner);
321 318
322 void OnUploadProgress(uint64_t position, uint64_t size); 319 void OnUploadProgress(uint64_t position, uint64_t size);
323 bool OnReceivedRedirect(const net::RedirectInfo& redirect_info, 320 bool OnReceivedRedirect(const net::RedirectInfo& redirect_info,
324 const ResourceResponseInfo& info); 321 const ResourceResponseInfo& info);
325 void OnReceivedResponse(const ResourceResponseInfo& info); 322 void OnReceivedResponse(const ResourceResponseInfo& info);
326 void OnDownloadedData(int len, int encoded_data_length); 323 void OnDownloadedData(int len, int encoded_data_length);
327 void OnReceivedData(std::unique_ptr<ReceivedData> data); 324 void OnReceivedData(std::unique_ptr<ReceivedData> data);
328 void OnReceivedCachedMetadata(const char* data, int len); 325 void OnReceivedCachedMetadata(const char* data, int len);
329 void OnCompletedRequest(int error_code, 326 void OnCompletedRequest(int error_code,
330 bool was_ignored_by_handler, 327 bool was_ignored_by_handler,
331 bool stale_copy_in_cache, 328 bool stale_copy_in_cache,
332 const std::string& security_info, 329 const std::string& security_info,
333 const base::TimeTicks& completion_time, 330 const base::TimeTicks& completion_time,
334 int64_t total_transfer_size); 331 int64_t total_transfer_size);
335 332
336 private: 333 private:
337 friend class base::RefCounted<Context>; 334 friend class base::RefCounted<Context>;
338 ~Context(); 335 ~Context();
339 336
340 class HandleDataURLTask : public blink::WebTaskRunner::Task {
341 public:
342 explicit HandleDataURLTask(scoped_refptr<Context> context)
343 : context_(context) {}
344
345 void run() override {
346 context_->HandleDataURL();
347 }
348
349 private:
350 scoped_refptr<Context> context_;
351 };
352
353 // Called when the body data stream is detached from the reader side. 337 // Called when the body data stream is detached from the reader side.
354 void CancelBodyStreaming(); 338 void CancelBodyStreaming();
355 // We can optimize the handling of data URLs in most cases. 339 // We can optimize the handling of data URLs in most cases.
356 bool CanHandleDataURLRequestLocally() const; 340 bool CanHandleDataURLRequestLocally() const;
357 void HandleDataURL(); 341 void HandleDataURL();
358 342
359 WebURLLoaderImpl* loader_; 343 WebURLLoaderImpl* loader_;
360 WebURLRequest request_; 344 WebURLRequest request_;
361 WebURLLoaderClient* client_; 345 WebURLLoaderClient* client_;
362 ResourceDispatcher* resource_dispatcher_; 346 ResourceDispatcher* resource_dispatcher_;
363 std::unique_ptr<blink::WebTaskRunner> web_task_runner_; 347 scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
364 WebReferrerPolicy referrer_policy_; 348 WebReferrerPolicy referrer_policy_;
365 std::unique_ptr<FtpDirectoryListingResponseDelegate> ftp_listing_delegate_; 349 std::unique_ptr<FtpDirectoryListingResponseDelegate> ftp_listing_delegate_;
366 std::unique_ptr<StreamOverrideParameters> stream_override_; 350 std::unique_ptr<StreamOverrideParameters> stream_override_;
367 std::unique_ptr<SharedMemoryDataConsumerHandle::Writer> body_stream_writer_; 351 std::unique_ptr<SharedMemoryDataConsumerHandle::Writer> body_stream_writer_;
368 enum DeferState {NOT_DEFERRING, SHOULD_DEFER, DEFERRED_DATA}; 352 enum DeferState {NOT_DEFERRING, SHOULD_DEFER, DEFERRED_DATA};
369 DeferState defers_loading_; 353 DeferState defers_loading_;
370 int request_id_; 354 int request_id_;
371 }; 355 };
372 356
373 // A thin wrapper class for Context to ensure its lifetime while it is 357 // A thin wrapper class for Context to ensure its lifetime while it is
(...skipping 18 matching lines...) Expand all
392 const base::TimeTicks& completion_time, 376 const base::TimeTicks& completion_time,
393 int64_t total_transfer_size) override; 377 int64_t total_transfer_size) override;
394 378
395 private: 379 private:
396 scoped_refptr<Context> context_; 380 scoped_refptr<Context> context_;
397 DISALLOW_COPY_AND_ASSIGN(RequestPeerImpl); 381 DISALLOW_COPY_AND_ASSIGN(RequestPeerImpl);
398 }; 382 };
399 383
400 // WebURLLoaderImpl::Context -------------------------------------------------- 384 // WebURLLoaderImpl::Context --------------------------------------------------
401 385
402 WebURLLoaderImpl::Context::Context( 386 WebURLLoaderImpl::Context::Context(WebURLLoaderImpl* loader,
403 WebURLLoaderImpl* loader, 387 ResourceDispatcher* resource_dispatcher)
404 ResourceDispatcher* resource_dispatcher,
405 std::unique_ptr<blink::WebTaskRunner> web_task_runner)
406 : loader_(loader), 388 : loader_(loader),
407 client_(NULL), 389 client_(NULL),
408 resource_dispatcher_(resource_dispatcher), 390 resource_dispatcher_(resource_dispatcher),
409 web_task_runner_(std::move(web_task_runner)), 391 task_runner_(base::ThreadTaskRunnerHandle::Get()),
410 referrer_policy_(blink::WebReferrerPolicyDefault), 392 referrer_policy_(blink::WebReferrerPolicyDefault),
411 defers_loading_(NOT_DEFERRING), 393 defers_loading_(NOT_DEFERRING),
412 request_id_(-1) {} 394 request_id_(-1) {}
413 395
414 void WebURLLoaderImpl::Context::Cancel() { 396 void WebURLLoaderImpl::Context::Cancel() {
415 TRACE_EVENT_WITH_FLOW0("loading", "WebURLLoaderImpl::Context::Cancel", this, 397 TRACE_EVENT_WITH_FLOW0("loading", "WebURLLoaderImpl::Context::Cancel", this,
416 TRACE_EVENT_FLAG_FLOW_IN); 398 TRACE_EVENT_FLAG_FLOW_IN);
417 if (resource_dispatcher_ && // NULL in unittest. 399 if (resource_dispatcher_ && // NULL in unittest.
418 request_id_ != -1) { 400 request_id_ != -1) {
419 resource_dispatcher_->Cancel(request_id_); 401 resource_dispatcher_->Cancel(request_id_);
(...skipping 13 matching lines...) Expand all
433 loader_ = NULL; 415 loader_ = NULL;
434 } 416 }
435 417
436 void WebURLLoaderImpl::Context::SetDefersLoading(bool value) { 418 void WebURLLoaderImpl::Context::SetDefersLoading(bool value) {
437 if (request_id_ != -1) 419 if (request_id_ != -1)
438 resource_dispatcher_->SetDefersLoading(request_id_, value); 420 resource_dispatcher_->SetDefersLoading(request_id_, value);
439 if (value && defers_loading_ == NOT_DEFERRING) { 421 if (value && defers_loading_ == NOT_DEFERRING) {
440 defers_loading_ = SHOULD_DEFER; 422 defers_loading_ = SHOULD_DEFER;
441 } else if (!value && defers_loading_ != NOT_DEFERRING) { 423 } else if (!value && defers_loading_ != NOT_DEFERRING) {
442 if (defers_loading_ == DEFERRED_DATA) { 424 if (defers_loading_ == DEFERRED_DATA) {
443 // TODO(alexclarke): Find a way to let blink and chromium FROM_HERE 425 task_runner_->PostTask(FROM_HERE,
444 // coexist. 426 base::Bind(&Context::HandleDataURL, this));
445 web_task_runner_->postTask(
446 ::blink::WebTraceLocation(__FUNCTION__, __FILE__),
447 new HandleDataURLTask(this));
448 } 427 }
449 defers_loading_ = NOT_DEFERRING; 428 defers_loading_ = NOT_DEFERRING;
450 } 429 }
451 } 430 }
452 431
453 void WebURLLoaderImpl::Context::DidChangePriority( 432 void WebURLLoaderImpl::Context::DidChangePriority(
454 WebURLRequest::Priority new_priority, int intra_priority_value) { 433 WebURLRequest::Priority new_priority, int intra_priority_value) {
455 if (request_id_ != -1) { 434 if (request_id_ != -1) {
456 resource_dispatcher_->DidChangePriority( 435 resource_dispatcher_->DidChangePriority(
457 request_id_, 436 request_id_,
458 ConvertWebKitPriorityToNetPriority(new_priority), 437 ConvertWebKitPriorityToNetPriority(new_priority),
459 intra_priority_value); 438 intra_priority_value);
460 } 439 }
461 } 440 }
462 441
463 void WebURLLoaderImpl::Context::Start(const WebURLRequest& request, 442 void WebURLLoaderImpl::Context::Start(const WebURLRequest& request,
464 SyncLoadResponse* sync_load_response) { 443 SyncLoadResponse* sync_load_response) {
465 DCHECK(request_id_ == -1); 444 DCHECK(request_id_ == -1);
466 request_ = request; // Save the request. 445 request_ = request; // Save the request.
467 GURL url = request.url(); 446 GURL url = request.url();
468 447
469 if (CanHandleDataURLRequestLocally()) { 448 if (CanHandleDataURLRequestLocally()) {
470 if (sync_load_response) { 449 if (sync_load_response) {
471 // This is a sync load. Do the work now. 450 // This is a sync load. Do the work now.
472 sync_load_response->url = url; 451 sync_load_response->url = url;
473 sync_load_response->error_code = 452 sync_load_response->error_code =
474 GetInfoFromDataURL(sync_load_response->url, sync_load_response, 453 GetInfoFromDataURL(sync_load_response->url, sync_load_response,
475 &sync_load_response->data); 454 &sync_load_response->data);
476 } else { 455 } else {
477 // TODO(alexclarke): Find a way to let blink and chromium FROM_HERE 456 task_runner_->PostTask(FROM_HERE,
478 // coexist. 457 base::Bind(&Context::HandleDataURL, this));
479 web_task_runner_->postTask(
480 ::blink::WebTraceLocation(__FUNCTION__, __FILE__),
481 new HandleDataURLTask(this));
482 } 458 }
483 return; 459 return;
484 } 460 }
485 461
486 if (request.getExtraData()) { 462 if (request.getExtraData()) {
487 RequestExtraData* extra_data = 463 RequestExtraData* extra_data =
488 static_cast<RequestExtraData*>(request.getExtraData()); 464 static_cast<RequestExtraData*>(request.getExtraData());
489 stream_override_ = extra_data->TakeStreamOverrideOwnership(); 465 stream_override_ = extra_data->TakeStreamOverrideOwnership();
490 } 466 }
491 467
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
542 request_info.fetch_credentials_mode = 518 request_info.fetch_credentials_mode =
543 GetFetchCredentialsModeForWebURLRequest(request); 519 GetFetchCredentialsModeForWebURLRequest(request);
544 request_info.fetch_redirect_mode = 520 request_info.fetch_redirect_mode =
545 GetFetchRedirectModeForWebURLRequest(request); 521 GetFetchRedirectModeForWebURLRequest(request);
546 request_info.fetch_request_context_type = 522 request_info.fetch_request_context_type =
547 GetRequestContextTypeForWebURLRequest(request); 523 GetRequestContextTypeForWebURLRequest(request);
548 request_info.fetch_frame_type = 524 request_info.fetch_frame_type =
549 GetRequestContextFrameTypeForWebURLRequest(request); 525 GetRequestContextFrameTypeForWebURLRequest(request);
550 request_info.extra_data = request.getExtraData(); 526 request_info.extra_data = request.getExtraData();
551 request_info.report_raw_headers = request.reportRawHeaders(); 527 request_info.report_raw_headers = request.reportRawHeaders();
552 request_info.loading_web_task_runner.reset(web_task_runner_->clone()); 528 request_info.loading_task_runner = task_runner_;
553 529
554 scoped_refptr<ResourceRequestBodyImpl> request_body = 530 scoped_refptr<ResourceRequestBodyImpl> request_body =
555 GetRequestBodyForWebURLRequest(request).get(); 531 GetRequestBodyForWebURLRequest(request).get();
556 532
557 // PlzNavigate: during navigation, the renderer should request a stream which 533 // PlzNavigate: during navigation, the renderer should request a stream which
558 // contains the body of the response. The network request has already been 534 // contains the body of the response. The network request has already been
559 // made by the browser. 535 // made by the browser.
560 if (stream_override_.get()) { 536 if (stream_override_.get()) {
561 CHECK(IsBrowserSideNavigationEnabled()); 537 CHECK(IsBrowserSideNavigationEnabled());
562 DCHECK(!sync_load_response); 538 DCHECK(!sync_load_response);
(...skipping 11 matching lines...) Expand all
574 TRACE_EVENT_WITH_FLOW0("loading", "WebURLLoaderImpl::Context::Start", this, 550 TRACE_EVENT_WITH_FLOW0("loading", "WebURLLoaderImpl::Context::Start", this,
575 TRACE_EVENT_FLAG_FLOW_OUT); 551 TRACE_EVENT_FLAG_FLOW_OUT);
576 request_id_ = resource_dispatcher_->StartAsync( 552 request_id_ = resource_dispatcher_->StartAsync(
577 request_info, request_body.get(), 553 request_info, request_body.get(),
578 base::WrapUnique(new WebURLLoaderImpl::RequestPeerImpl(this))); 554 base::WrapUnique(new WebURLLoaderImpl::RequestPeerImpl(this)));
579 555
580 if (defers_loading_ != NOT_DEFERRING) 556 if (defers_loading_ != NOT_DEFERRING)
581 resource_dispatcher_->SetDefersLoading(request_id_, true); 557 resource_dispatcher_->SetDefersLoading(request_id_, true);
582 } 558 }
583 559
584 void WebURLLoaderImpl::Context::SetWebTaskRunner( 560 void WebURLLoaderImpl::Context::SetTaskRunner(
585 std::unique_ptr<blink::WebTaskRunner> web_task_runner) { 561 scoped_refptr<base::SingleThreadTaskRunner> task_runner) {
586 web_task_runner_ = std::move(web_task_runner); 562 task_runner_ = std::move(task_runner);
587 } 563 }
588 564
589 void WebURLLoaderImpl::Context::OnUploadProgress(uint64_t position, 565 void WebURLLoaderImpl::Context::OnUploadProgress(uint64_t position,
590 uint64_t size) { 566 uint64_t size) {
591 if (client_) 567 if (client_)
592 client_->didSendData(loader_, position, size); 568 client_->didSendData(loader_, position, size);
593 } 569 }
594 570
595 bool WebURLLoaderImpl::Context::OnReceivedRedirect( 571 bool WebURLLoaderImpl::Context::OnReceivedRedirect(
596 const net::RedirectInfo& redirect_info, 572 const net::RedirectInfo& redirect_info,
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after
937 const std::string& security_info, 913 const std::string& security_info,
938 const base::TimeTicks& completion_time, 914 const base::TimeTicks& completion_time,
939 int64_t total_transfer_size) { 915 int64_t total_transfer_size) {
940 context_->OnCompletedRequest(error_code, was_ignored_by_handler, 916 context_->OnCompletedRequest(error_code, was_ignored_by_handler,
941 stale_copy_in_cache, security_info, 917 stale_copy_in_cache, security_info,
942 completion_time, total_transfer_size); 918 completion_time, total_transfer_size);
943 } 919 }
944 920
945 // WebURLLoaderImpl ----------------------------------------------------------- 921 // WebURLLoaderImpl -----------------------------------------------------------
946 922
947 WebURLLoaderImpl::WebURLLoaderImpl( 923 WebURLLoaderImpl::WebURLLoaderImpl(ResourceDispatcher* resource_dispatcher)
948 ResourceDispatcher* resource_dispatcher, 924 : context_(new Context(this, resource_dispatcher)) {}
949 std::unique_ptr<blink::WebTaskRunner> web_task_runner)
950 : context_(
951 new Context(this, resource_dispatcher, std::move(web_task_runner))) {}
952 925
953 WebURLLoaderImpl::~WebURLLoaderImpl() { 926 WebURLLoaderImpl::~WebURLLoaderImpl() {
954 cancel(); 927 cancel();
955 } 928 }
956 929
957 void WebURLLoaderImpl::PopulateURLResponse(const GURL& url, 930 void WebURLLoaderImpl::PopulateURLResponse(const GURL& url,
958 const ResourceResponseInfo& info, 931 const ResourceResponseInfo& info,
959 WebURLResponse* response, 932 WebURLResponse* response,
960 bool report_security_info) { 933 bool report_security_info) {
961 response->setURL(url); 934 response->setURL(url);
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
1173 context_->SetDefersLoading(value); 1146 context_->SetDefersLoading(value);
1174 } 1147 }
1175 1148
1176 void WebURLLoaderImpl::didChangePriority(WebURLRequest::Priority new_priority, 1149 void WebURLLoaderImpl::didChangePriority(WebURLRequest::Priority new_priority,
1177 int intra_priority_value) { 1150 int intra_priority_value) {
1178 context_->DidChangePriority(new_priority, intra_priority_value); 1151 context_->DidChangePriority(new_priority, intra_priority_value);
1179 } 1152 }
1180 1153
1181 void WebURLLoaderImpl::setLoadingTaskRunner( 1154 void WebURLLoaderImpl::setLoadingTaskRunner(
1182 blink::WebTaskRunner* loading_task_runner) { 1155 blink::WebTaskRunner* loading_task_runner) {
1183 // There's no guarantee on the lifetime of |loading_task_runner| so we take a 1156 context_->SetTaskRunner(loading_task_runner->taskRunner());
1184 // copy.
1185 context_->SetWebTaskRunner(base::WrapUnique(loading_task_runner->clone()));
1186 } 1157 }
1187 1158
1188 // This function is implemented here because it uses net functions. it is 1159 // This function is implemented here because it uses net functions. it is
1189 // tested in 1160 // tested in
1190 // third_party/WebKit/Source/core/fetch/MultipartImageResourceParserTest.cpp. 1161 // third_party/WebKit/Source/core/fetch/MultipartImageResourceParserTest.cpp.
1191 bool WebURLLoaderImpl::ParseMultipartHeadersFromBody( 1162 bool WebURLLoaderImpl::ParseMultipartHeadersFromBody(
1192 const char* bytes, 1163 const char* bytes,
1193 size_t size, 1164 size_t size,
1194 blink::WebURLResponse* response, 1165 blink::WebURLResponse* response,
1195 size_t* end) { 1166 size_t* end) {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
1227 response->clearHTTPHeaderField(webStringName); 1198 response->clearHTTPHeaderField(webStringName);
1228 while (response_headers->EnumerateHeader(&iterator, name, &value)) { 1199 while (response_headers->EnumerateHeader(&iterator, name, &value)) {
1229 response->addHTTPHeaderField(webStringName, 1200 response->addHTTPHeaderField(webStringName,
1230 WebString::fromLatin1(value)); 1201 WebString::fromLatin1(value));
1231 } 1202 }
1232 } 1203 }
1233 return true; 1204 return true;
1234 } 1205 }
1235 1206
1236 } // namespace content 1207 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698