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" |
13 #include "base/file_version_info.h" | 14 #include "base/file_version_info.h" |
14 #include "base/message_loop/message_loop.h" | 15 #include "base/message_loop/message_loop.h" |
15 #include "base/metrics/field_trial.h" | 16 #include "base/metrics/field_trial.h" |
16 #include "base/metrics/histogram.h" | 17 #include "base/metrics/histogram.h" |
17 #include "base/profiler/scoped_tracker.h" | 18 #include "base/profiler/scoped_tracker.h" |
18 #include "base/rand_util.h" | 19 #include "base/rand_util.h" |
19 #include "base/strings/string_util.h" | 20 #include "base/strings/string_util.h" |
20 #include "base/time/time.h" | 21 #include "base/time/time.h" |
21 #include "net/base/host_port_pair.h" | 22 #include "net/base/host_port_pair.h" |
22 #include "net/base/load_flags.h" | 23 #include "net/base/load_flags.h" |
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
282 request_info_.extra_headers.SetHeaderIfMissing( | 283 request_info_.extra_headers.SetHeaderIfMissing( |
283 HttpRequestHeaders::kUserAgent, | 284 HttpRequestHeaders::kUserAgent, |
284 http_user_agent_settings_ ? | 285 http_user_agent_settings_ ? |
285 http_user_agent_settings_->GetUserAgent() : std::string()); | 286 http_user_agent_settings_->GetUserAgent() : std::string()); |
286 | 287 |
287 AddExtraHeaders(); | 288 AddExtraHeaders(); |
288 AddCookieHeaderAndStart(); | 289 AddCookieHeaderAndStart(); |
289 } | 290 } |
290 | 291 |
291 void URLRequestHttpJob::Kill() { | 292 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 } |
292 if (!transaction_.get()) | 299 if (!transaction_.get()) |
293 return; | 300 return; |
294 | 301 |
295 weak_factory_.InvalidateWeakPtrs(); | 302 weak_factory_.InvalidateWeakPtrs(); |
296 DestroyTransaction(); | 303 DestroyTransaction(); |
297 URLRequestJob::Kill(); | 304 URLRequestJob::Kill(); |
298 } | 305 } |
299 | 306 |
300 void URLRequestHttpJob::NotifyBeforeSendProxyHeadersCallback( | 307 void URLRequestHttpJob::NotifyBeforeSendProxyHeadersCallback( |
301 const ProxyInfo& proxy_info, | 308 const ProxyInfo& proxy_info, |
(...skipping 1296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1598 return override_response_headers_.get() ? | 1605 return override_response_headers_.get() ? |
1599 override_response_headers_.get() : | 1606 override_response_headers_.get() : |
1600 transaction_->GetResponseInfo()->headers.get(); | 1607 transaction_->GetResponseInfo()->headers.get(); |
1601 } | 1608 } |
1602 | 1609 |
1603 void URLRequestHttpJob::NotifyURLRequestDestroyed() { | 1610 void URLRequestHttpJob::NotifyURLRequestDestroyed() { |
1604 awaiting_callback_ = false; | 1611 awaiting_callback_ = false; |
1605 } | 1612 } |
1606 | 1613 |
1607 } // namespace net | 1614 } // namespace net |
OLD | NEW |