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

Side by Side Diff: net/url_request/url_fetcher_core.cc

Issue 732423002: Update from chromium https://crrev.com/304586 (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 6 years, 1 month 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 | « net/url_request/url_fetcher.cc ('k') | net/url_request/url_fetcher_impl.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 #include "net/url_request/url_fetcher_core.h" 5 #include "net/url_request/url_fetcher_core.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 16 matching lines...) Expand all
27 #include "net/url_request/url_fetcher_delegate.h" 27 #include "net/url_request/url_fetcher_delegate.h"
28 #include "net/url_request/url_fetcher_response_writer.h" 28 #include "net/url_request/url_fetcher_response_writer.h"
29 #include "net/url_request/url_request_context.h" 29 #include "net/url_request/url_request_context.h"
30 #include "net/url_request/url_request_context_getter.h" 30 #include "net/url_request/url_request_context_getter.h"
31 #include "net/url_request/url_request_throttler_manager.h" 31 #include "net/url_request/url_request_throttler_manager.h"
32 32
33 namespace { 33 namespace {
34 34
35 const int kBufferSize = 4096; 35 const int kBufferSize = 4096;
36 const int kUploadProgressTimerInterval = 100; 36 const int kUploadProgressTimerInterval = 100;
37 bool g_interception_enabled = false;
38 bool g_ignore_certificate_requests = false; 37 bool g_ignore_certificate_requests = false;
39 38
40 void EmptyCompletionCallback(int result) {} 39 void EmptyCompletionCallback(int result) {}
41 40
42 } // namespace 41 } // namespace
43 42
44 namespace net { 43 namespace net {
45 44
46 // URLFetcherCore::Registry --------------------------------------------------- 45 // URLFetcherCore::Registry ---------------------------------------------------
47 46
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after
463 } 462 }
464 463
465 void URLFetcherCore::CancelAll() { 464 void URLFetcherCore::CancelAll() {
466 g_registry.Get().CancelAll(); 465 g_registry.Get().CancelAll();
467 } 466 }
468 467
469 int URLFetcherCore::GetNumFetcherCores() { 468 int URLFetcherCore::GetNumFetcherCores() {
470 return g_registry.Get().size(); 469 return g_registry.Get().size();
471 } 470 }
472 471
473 void URLFetcherCore::SetEnableInterceptionForTests(bool enabled) {
474 g_interception_enabled = enabled;
475 }
476
477 void URLFetcherCore::SetIgnoreCertificateRequests(bool ignored) { 472 void URLFetcherCore::SetIgnoreCertificateRequests(bool ignored) {
478 g_ignore_certificate_requests = ignored; 473 g_ignore_certificate_requests = ignored;
479 } 474 }
480 475
481 URLFetcherCore::~URLFetcherCore() { 476 URLFetcherCore::~URLFetcherCore() {
482 // |request_| should be NULL. If not, it's unsafe to delete it here since we 477 // |request_| should be NULL. If not, it's unsafe to delete it here since we
483 // may not be on the IO thread. 478 // may not be on the IO thread.
484 DCHECK(!request_.get()); 479 DCHECK(!request_.get());
485 } 480 }
486 481
(...skipping 20 matching lines...) Expand all
507 502
508 DCHECK(request_context_getter_.get()); 503 DCHECK(request_context_getter_.get());
509 DCHECK(!request_.get()); 504 DCHECK(!request_.get());
510 505
511 g_registry.Get().AddURLFetcherCore(this); 506 g_registry.Get().AddURLFetcherCore(this);
512 current_response_bytes_ = 0; 507 current_response_bytes_ = 0;
513 request_ = request_context_getter_->GetURLRequestContext()->CreateRequest( 508 request_ = request_context_getter_->GetURLRequestContext()->CreateRequest(
514 original_url_, DEFAULT_PRIORITY, this, NULL); 509 original_url_, DEFAULT_PRIORITY, this, NULL);
515 request_->set_stack_trace(stack_trace_); 510 request_->set_stack_trace(stack_trace_);
516 int flags = request_->load_flags() | load_flags_; 511 int flags = request_->load_flags() | load_flags_;
517 if (!g_interception_enabled)
518 flags = flags | LOAD_DISABLE_INTERCEPT;
519 512
520 if (is_chunked_upload_) 513 if (is_chunked_upload_)
521 request_->EnableChunkedUpload(); 514 request_->EnableChunkedUpload();
522 request_->SetLoadFlags(flags); 515 request_->SetLoadFlags(flags);
523 request_->SetReferrer(referrer_); 516 request_->SetReferrer(referrer_);
524 request_->set_referrer_policy(referrer_policy_); 517 request_->set_referrer_policy(referrer_policy_);
525 request_->set_first_party_for_cookies(first_party_for_cookies_.is_empty() ? 518 request_->set_first_party_for_cookies(first_party_for_cookies_.is_empty() ?
526 original_url_ : first_party_for_cookies_); 519 original_url_ : first_party_for_cookies_);
527 if (url_request_data_key_ && !url_request_create_data_callback_.is_null()) { 520 if (url_request_data_key_ && !url_request_create_data_callback_.is_null()) {
528 request_->SetUserData(url_request_data_key_, 521 request_->SetUserData(url_request_data_key_,
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after
895 } 888 }
896 889
897 void URLFetcherCore::InformDelegateDownloadProgressInDelegateThread( 890 void URLFetcherCore::InformDelegateDownloadProgressInDelegateThread(
898 int64 current, int64 total) { 891 int64 current, int64 total) {
899 DCHECK(delegate_task_runner_->BelongsToCurrentThread()); 892 DCHECK(delegate_task_runner_->BelongsToCurrentThread());
900 if (delegate_) 893 if (delegate_)
901 delegate_->OnURLFetchDownloadProgress(fetcher_, current, total); 894 delegate_->OnURLFetchDownloadProgress(fetcher_, current, total);
902 } 895 }
903 896
904 } // namespace net 897 } // namespace net
OLDNEW
« no previous file with comments | « net/url_request/url_fetcher.cc ('k') | net/url_request/url_fetcher_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698