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

Unified Diff: net/url_request/url_request_http_job.cc

Issue 12701011: [Net] Propagate priority changes from URLRequest to HttpTransaction (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add more tests Created 7 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: net/url_request/url_request_http_job.cc
diff --git a/net/url_request/url_request_http_job.cc b/net/url_request/url_request_http_job.cc
index caf344c325363afafb7dd6ed1fa8c42306d93e41..2b92e5ab94cf9b5e48eaff0c6d074ae78af355f2 100644
--- a/net/url_request/url_request_http_job.cc
+++ b/net/url_request/url_request_http_job.cc
@@ -268,6 +268,37 @@ URLRequestHttpJob::URLRequestHttpJob(
ResetTimer();
}
+URLRequestHttpJob::~URLRequestHttpJob() {
+ CHECK(!awaiting_callback_);
+
+ DCHECK(!sdch_test_control_ || !sdch_test_activated_);
+ if (!is_cached_content_) {
+ if (sdch_test_control_)
+ RecordPacketStats(FilterContext::SDCH_EXPERIMENT_HOLDBACK);
+ if (sdch_test_activated_)
+ RecordPacketStats(FilterContext::SDCH_EXPERIMENT_DECODE);
+ }
+ // Make sure SDCH filters are told to emit histogram data while
+ // filter_context_ is still alive.
+ DestroyFilters();
+
+ if (sdch_dictionary_url_.is_valid()) {
+ // Prior to reaching the destructor, request_ has been set to a NULL
+ // pointer, so request_->url() is no longer valid in the destructor, and we
+ // use an alternate copy |request_info_.url|.
+ SdchManager* manager = SdchManager::Global();
+ // To be extra safe, since this is a "different time" from when we decided
+ // to get the dictionary, we'll validate that an SdchManager is available.
+ // At shutdown time, care is taken to be sure that we don't delete this
+ // globally useful instance "too soon," so this check is just defensive
+ // coding to assure that IF the system is shutting down, we don't have any
+ // problem if the manager was deleted ahead of time.
+ if (manager) // Defensive programming.
+ manager->FetchDictionary(request_info_.url, sdch_dictionary_url_);
+ }
+ DoneWithRequest(ABORTED);
+}
+
void URLRequestHttpJob::NotifyHeadersComplete() {
DCHECK(!response_info_);
@@ -1237,37 +1268,6 @@ HostPortPair URLRequestHttpJob::GetSocketAddress() const {
return response_info_ ? response_info_->socket_address : HostPortPair();
}
-URLRequestHttpJob::~URLRequestHttpJob() {
- CHECK(!awaiting_callback_);
-
- DCHECK(!sdch_test_control_ || !sdch_test_activated_);
- if (!is_cached_content_) {
- if (sdch_test_control_)
- RecordPacketStats(FilterContext::SDCH_EXPERIMENT_HOLDBACK);
- if (sdch_test_activated_)
- RecordPacketStats(FilterContext::SDCH_EXPERIMENT_DECODE);
- }
- // Make sure SDCH filters are told to emit histogram data while
- // filter_context_ is still alive.
- DestroyFilters();
-
- if (sdch_dictionary_url_.is_valid()) {
- // Prior to reaching the destructor, request_ has been set to a NULL
- // pointer, so request_->url() is no longer valid in the destructor, and we
- // use an alternate copy |request_info_.url|.
- SdchManager* manager = SdchManager::Global();
- // To be extra safe, since this is a "different time" from when we decided
- // to get the dictionary, we'll validate that an SdchManager is available.
- // At shutdown time, care is taken to be sure that we don't delete this
- // globally useful instance "too soon," so this check is just defensive
- // coding to assure that IF the system is shutting down, we don't have any
- // problem if the manager was deleted ahead of time.
- if (manager) // Defensive programming.
- manager->FetchDictionary(request_info_.url, sdch_dictionary_url_);
- }
- DoneWithRequest(ABORTED);
-}
-
void URLRequestHttpJob::RecordTimer() {
if (request_creation_time_.is_null()) {
NOTREACHED()
@@ -1578,6 +1578,12 @@ void URLRequestHttpJob::NotifyURLRequestDestroyed() {
awaiting_callback_ = false;
}
+void URLRequestHttpJob::SetPriority(RequestPriority priority) {
+ request_info_.priority = priority;
+ if (transaction_)
+ transaction_->SetPriority(priority);
+}
+
void URLRequestHttpJob::OnDetachRequest() {
http_transaction_delegate_->OnDetachRequest();
}

Powered by Google App Engine
This is Rietveld 408576698