OLD | NEW |
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_request_http_job.h" | 5 #include "net/url_request/url_request_http_job.h" |
6 | 6 |
7 #include "base/base_switches.h" | 7 #include "base/base_switches.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/bind_helpers.h" | 9 #include "base/bind_helpers.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
12 #include "base/debug/alias.h" | 12 #include "base/debug/alias.h" |
13 #include "base/debug/dump_without_crashing.h" | |
14 #include "base/file_version_info.h" | 13 #include "base/file_version_info.h" |
15 #include "base/message_loop/message_loop.h" | 14 #include "base/message_loop/message_loop.h" |
16 #include "base/metrics/field_trial.h" | 15 #include "base/metrics/field_trial.h" |
17 #include "base/metrics/histogram.h" | 16 #include "base/metrics/histogram.h" |
18 #include "base/profiler/scoped_tracker.h" | 17 #include "base/profiler/scoped_tracker.h" |
19 #include "base/rand_util.h" | 18 #include "base/rand_util.h" |
20 #include "base/strings/string_util.h" | 19 #include "base/strings/string_util.h" |
21 #include "base/time/time.h" | 20 #include "base/time/time.h" |
22 #include "net/base/host_port_pair.h" | 21 #include "net/base/host_port_pair.h" |
23 #include "net/base/load_flags.h" | 22 #include "net/base/load_flags.h" |
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 request_info_.extra_headers.SetHeaderIfMissing( | 282 request_info_.extra_headers.SetHeaderIfMissing( |
284 HttpRequestHeaders::kUserAgent, | 283 HttpRequestHeaders::kUserAgent, |
285 http_user_agent_settings_ ? | 284 http_user_agent_settings_ ? |
286 http_user_agent_settings_->GetUserAgent() : std::string()); | 285 http_user_agent_settings_->GetUserAgent() : std::string()); |
287 | 286 |
288 AddExtraHeaders(); | 287 AddExtraHeaders(); |
289 AddCookieHeaderAndStart(); | 288 AddCookieHeaderAndStart(); |
290 } | 289 } |
291 | 290 |
292 void URLRequestHttpJob::Kill() { | 291 void URLRequestHttpJob::Kill() { |
293 if (awaiting_callback_) { | |
294 // TODO(battre) crbug.com/289715 | |
295 // Simulate a crash to see who kills the job while it is waiting for a | |
296 // callback. This should not happen, see URLRequest::OrphanJob(). | |
297 base::debug::DumpWithoutCrashing(); | |
298 } | |
299 if (!transaction_.get()) | 292 if (!transaction_.get()) |
300 return; | 293 return; |
301 | 294 |
302 weak_factory_.InvalidateWeakPtrs(); | 295 weak_factory_.InvalidateWeakPtrs(); |
303 DestroyTransaction(); | 296 DestroyTransaction(); |
304 URLRequestJob::Kill(); | 297 URLRequestJob::Kill(); |
305 } | 298 } |
306 | 299 |
307 void URLRequestHttpJob::NotifyBeforeSendProxyHeadersCallback( | 300 void URLRequestHttpJob::NotifyBeforeSendProxyHeadersCallback( |
308 const ProxyInfo& proxy_info, | 301 const ProxyInfo& proxy_info, |
(...skipping 1296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1605 return override_response_headers_.get() ? | 1598 return override_response_headers_.get() ? |
1606 override_response_headers_.get() : | 1599 override_response_headers_.get() : |
1607 transaction_->GetResponseInfo()->headers.get(); | 1600 transaction_->GetResponseInfo()->headers.get(); |
1608 } | 1601 } |
1609 | 1602 |
1610 void URLRequestHttpJob::NotifyURLRequestDestroyed() { | 1603 void URLRequestHttpJob::NotifyURLRequestDestroyed() { |
1611 awaiting_callback_ = false; | 1604 awaiting_callback_ = false; |
1612 } | 1605 } |
1613 | 1606 |
1614 } // namespace net | 1607 } // namespace net |
OLD | NEW |