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

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

Issue 51953002: [Net] Add a priority parameter to URLRequest's constructor (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments Created 7 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 | Annotate | Revision Log
« no previous file with comments | « net/test/spawned_test_server/spawner_communicator.cc ('k') | net/url_request/url_request.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 "base/bind.h" 7 #include "base/bind.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "base/single_thread_task_runner.h" 10 #include "base/single_thread_task_runner.h"
11 #include "base/stl_util.h" 11 #include "base/stl_util.h"
12 #include "base/thread_task_runner_handle.h" 12 #include "base/thread_task_runner_handle.h"
13 #include "base/tracked_objects.h" 13 #include "base/tracked_objects.h"
14 #include "net/base/io_buffer.h" 14 #include "net/base/io_buffer.h"
15 #include "net/base/load_flags.h" 15 #include "net/base/load_flags.h"
16 #include "net/base/net_errors.h" 16 #include "net/base/net_errors.h"
17 #include "net/base/request_priority.h"
17 #include "net/base/upload_bytes_element_reader.h" 18 #include "net/base/upload_bytes_element_reader.h"
18 #include "net/base/upload_data_stream.h" 19 #include "net/base/upload_data_stream.h"
19 #include "net/base/upload_file_element_reader.h" 20 #include "net/base/upload_file_element_reader.h"
20 #include "net/http/http_response_headers.h" 21 #include "net/http/http_response_headers.h"
21 #include "net/url_request/url_fetcher_delegate.h" 22 #include "net/url_request/url_fetcher_delegate.h"
22 #include "net/url_request/url_fetcher_response_writer.h" 23 #include "net/url_request/url_fetcher_response_writer.h"
23 #include "net/url_request/url_request_context.h" 24 #include "net/url_request/url_request_context.h"
24 #include "net/url_request/url_request_context_getter.h" 25 #include "net/url_request/url_request_context_getter.h"
25 #include "net/url_request/url_request_throttler_manager.h" 26 #include "net/url_request/url_request_throttler_manager.h"
26 27
(...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after
495 // Since StartURLRequest() is posted as a *delayed* task, it may 496 // Since StartURLRequest() is posted as a *delayed* task, it may
496 // run after the URLFetcher was already stopped. 497 // run after the URLFetcher was already stopped.
497 return; 498 return;
498 } 499 }
499 500
500 DCHECK(request_context_getter_.get()); 501 DCHECK(request_context_getter_.get());
501 DCHECK(!request_.get()); 502 DCHECK(!request_.get());
502 503
503 g_registry.Get().AddURLFetcherCore(this); 504 g_registry.Get().AddURLFetcherCore(this);
504 current_response_bytes_ = 0; 505 current_response_bytes_ = 0;
505 request_.reset(request_context_getter_->GetURLRequestContext()->CreateRequest( 506 request_ = request_context_getter_->GetURLRequestContext()->CreateRequest(
506 original_url_, this)); 507 original_url_, DEFAULT_PRIORITY, this);
507 request_->set_stack_trace(stack_trace_); 508 request_->set_stack_trace(stack_trace_);
508 int flags = request_->load_flags() | load_flags_; 509 int flags = request_->load_flags() | load_flags_;
509 if (!g_interception_enabled) 510 if (!g_interception_enabled)
510 flags = flags | LOAD_DISABLE_INTERCEPT; 511 flags = flags | LOAD_DISABLE_INTERCEPT;
511 512
512 if (is_chunked_upload_) 513 if (is_chunked_upload_)
513 request_->EnableChunkedUpload(); 514 request_->EnableChunkedUpload();
514 request_->set_load_flags(flags); 515 request_->set_load_flags(flags);
515 request_->SetReferrer(referrer_); 516 request_->SetReferrer(referrer_);
516 request_->set_first_party_for_cookies(first_party_for_cookies_.is_empty() ? 517 request_->set_first_party_for_cookies(first_party_for_cookies_.is_empty() ?
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after
883 } 884 }
884 885
885 void URLFetcherCore::InformDelegateDownloadProgressInDelegateThread( 886 void URLFetcherCore::InformDelegateDownloadProgressInDelegateThread(
886 int64 current, int64 total) { 887 int64 current, int64 total) {
887 DCHECK(delegate_task_runner_->BelongsToCurrentThread()); 888 DCHECK(delegate_task_runner_->BelongsToCurrentThread());
888 if (delegate_) 889 if (delegate_)
889 delegate_->OnURLFetchDownloadProgress(fetcher_, current, total); 890 delegate_->OnURLFetchDownloadProgress(fetcher_, current, total);
890 } 891 }
891 892
892 } // namespace net 893 } // namespace net
OLDNEW
« no previous file with comments | « net/test/spawned_test_server/spawner_communicator.cc ('k') | net/url_request/url_request.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698