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

Side by Side Diff: net/base/host_resolver_impl.cc

Issue 9147026: API for connection type (Ethernet/WIFI/WWAN ...) in NetworkChangeNotifier. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: sync Created 8 years, 7 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 unified diff | Download patch
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/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 722 matching lines...) Expand 10 before | Expand all | Expand 10 after
733 int error, 733 int error,
734 const int os_error) { 734 const int os_error) {
735 DCHECK(origin_loop_->BelongsToCurrentThread()); 735 DCHECK(origin_loop_->BelongsToCurrentThread());
736 DCHECK(error || !results.empty()); 736 DCHECK(error || !results.empty());
737 737
738 bool was_retry_attempt = attempt_number > 1; 738 bool was_retry_attempt = attempt_number > 1;
739 739
740 // Ideally the following code would be part of host_resolver_proc.cc, 740 // Ideally the following code would be part of host_resolver_proc.cc,
741 // however it isn't safe to call NetworkChangeNotifier from worker threads. 741 // however it isn't safe to call NetworkChangeNotifier from worker threads.
742 // So we do it here on the IO thread instead. 742 // So we do it here on the IO thread instead.
743 if (error != OK && NetworkChangeNotifier::IsOffline()) 743 if (error != OK &&
744 NetworkChangeNotifier::GetConnectionType() ==
745 NetworkChangeNotifier::CONNECTION_NONE) {
wtc 2012/05/11 01:35:05 Nit: this line doesn't need to be indented.
744 error = ERR_INTERNET_DISCONNECTED; 746 error = ERR_INTERNET_DISCONNECTED;
747 }
745 748
746 // If this is the first attempt that is finishing later, then record data 749 // If this is the first attempt that is finishing later, then record data
747 // for the first attempt. Won't contaminate with retry attempt's data. 750 // for the first attempt. Won't contaminate with retry attempt's data.
748 if (!was_retry_attempt) 751 if (!was_retry_attempt)
749 RecordPerformanceHistograms(start_time, error, os_error); 752 RecordPerformanceHistograms(start_time, error, os_error);
750 753
751 RecordAttemptHistograms(start_time, attempt_number, error, os_error); 754 RecordAttemptHistograms(start_time, attempt_number, error, os_error);
752 755
753 if (was_canceled()) 756 if (was_canceled())
754 return; 757 return;
(...skipping 1217 matching lines...) Expand 10 before | Expand all | Expand 10 after
1972 1975
1973 if (self && dns_config.IsValid()) 1976 if (self && dns_config.IsValid())
1974 TryServingAllJobsFromHosts(); 1977 TryServingAllJobsFromHosts();
1975 } 1978 }
1976 1979
1977 bool HostResolverImpl::HaveDnsConfig() const { 1980 bool HostResolverImpl::HaveDnsConfig() const {
1978 return (dns_client_.get() != NULL) && (dns_client_->GetConfig() != NULL); 1981 return (dns_client_.get() != NULL) && (dns_client_->GetConfig() != NULL);
1979 } 1982 }
1980 1983
1981 } // namespace net 1984 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698