| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/base/host_resolver_impl.h" | 5 #include "net/base/host_resolver_impl.h" |
| 6 | 6 |
| 7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
| 8 #include <Winsock2.h> | 8 #include <Winsock2.h> |
| 9 #elif defined(OS_POSIX) | 9 #elif defined(OS_POSIX) |
| 10 #include <netdb.h> | 10 #include <netdb.h> |
| (...skipping 563 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 574 | 574 |
| 575 // Copy the results from the first worker thread that resolves the host. | 575 // Copy the results from the first worker thread that resolves the host. |
| 576 results_ = results; | 576 results_ = results; |
| 577 completed_attempt_number_ = attempt_number; | 577 completed_attempt_number_ = attempt_number; |
| 578 completed_attempt_error_ = error; | 578 completed_attempt_error_ = error; |
| 579 } | 579 } |
| 580 | 580 |
| 581 // Ideally the following code would be part of host_resolver_proc.cc, | 581 // Ideally the following code would be part of host_resolver_proc.cc, |
| 582 // however it isn't safe to call NetworkChangeNotifier from worker | 582 // however it isn't safe to call NetworkChangeNotifier from worker |
| 583 // threads. So we do it here on the IO thread instead. | 583 // threads. So we do it here on the IO thread instead. |
| 584 if (error != OK && NetworkChangeNotifier::IsOffline()) | 584 if (error != OK && |
| 585 NetworkChangeNotifier::GetConnectionState() == |
| 586 NetworkChangeNotifier::NONE) |
| 585 error = ERR_INTERNET_DISCONNECTED; | 587 error = ERR_INTERNET_DISCONNECTED; |
| 586 | 588 |
| 587 // We will record data for the first attempt. Don't contaminate with retry | 589 // We will record data for the first attempt. Don't contaminate with retry |
| 588 // attempt's data. | 590 // attempt's data. |
| 589 if (!was_retry_attempt) | 591 if (!was_retry_attempt) |
| 590 RecordPerformanceHistograms(start_time, error, os_error); | 592 RecordPerformanceHistograms(start_time, error, os_error); |
| 591 | 593 |
| 592 RecordAttemptHistograms(start_time, attempt_number, error, os_error); | 594 RecordAttemptHistograms(start_time, attempt_number, error, os_error); |
| 593 | 595 |
| 594 if (was_cancelled()) | 596 if (was_cancelled()) |
| (...skipping 1001 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1596 // resolv.conf changes so we don't need to do anything to clear that cache. | 1598 // resolv.conf changes so we don't need to do anything to clear that cache. |
| 1597 if (cache_.get()) | 1599 if (cache_.get()) |
| 1598 cache_->clear(); | 1600 cache_->clear(); |
| 1599 // Existing jobs will have been sent to the original server so they need to | 1601 // Existing jobs will have been sent to the original server so they need to |
| 1600 // be aborted. TODO(Craig): Should these jobs be restarted? | 1602 // be aborted. TODO(Craig): Should these jobs be restarted? |
| 1601 AbortAllInProgressJobs(); | 1603 AbortAllInProgressJobs(); |
| 1602 // |this| may be deleted inside AbortAllInProgressJobs(). | 1604 // |this| may be deleted inside AbortAllInProgressJobs(). |
| 1603 } | 1605 } |
| 1604 | 1606 |
| 1605 } // namespace net | 1607 } // namespace net |
| OLD | NEW |