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

Unified Diff: chrome/browser/local_discovery/privet_traffic_detector.cc

Issue 1061503008: [chrome/browser/local_discovery] favor DCHECK_CURRENTLY_ON for better logs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 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
« no previous file with comments | « no previous file | chrome/browser/local_discovery/pwg_raster_converter.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/local_discovery/privet_traffic_detector.cc
diff --git a/chrome/browser/local_discovery/privet_traffic_detector.cc b/chrome/browser/local_discovery/privet_traffic_detector.cc
index c2001254ab214ea79e8855292fe8282085b1a301..9153af874414a7d491e5750baa5f87a5c39b276a 100644
--- a/chrome/browser/local_discovery/privet_traffic_detector.cc
+++ b/chrome/browser/local_discovery/privet_traffic_detector.cc
@@ -22,7 +22,7 @@ const char kPrivetDeviceTypeDnsString[] = "\x07_privet";
void GetNetworkListOnFileThread(
const base::Callback<void(const net::NetworkInterfaceList&)> callback) {
- DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::FILE));
+ DCHECK_CURRENTLY_ON(content::BrowserThread::FILE);
net::NetworkInterfaceList networks;
if (!GetNetworkList(&networks, net::INCLUDE_HOST_SCOPE_VIRTUAL_INTERFACES))
return;
@@ -76,26 +76,26 @@ void PrivetTrafficDetector::Start() {
}
PrivetTrafficDetector::~PrivetTrafficDetector() {
- DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
+ DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
net::NetworkChangeNotifier::RemoveNetworkChangeObserver(this);
}
void PrivetTrafficDetector::StartOnIOThread() {
- DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
+ DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
net::NetworkChangeNotifier::AddNetworkChangeObserver(this);
ScheduleRestart();
}
void PrivetTrafficDetector::OnNetworkChanged(
net::NetworkChangeNotifier::ConnectionType type) {
- DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
+ DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
restart_attempts_ = kMaxRestartAttempts;
if (type != net::NetworkChangeNotifier::CONNECTION_NONE)
ScheduleRestart();
}
void PrivetTrafficDetector::ScheduleRestart() {
- DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
+ DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
socket_.reset();
weak_ptr_factory_.InvalidateWeakPtrs();
content::BrowserThread::PostDelayedTask(
@@ -108,7 +108,7 @@ void PrivetTrafficDetector::ScheduleRestart() {
}
void PrivetTrafficDetector::Restart(const net::NetworkInterfaceList& networks) {
- DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
+ DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
networks_ = networks;
if (Bind() < net::OK || DoLoop(0) < net::OK) {
if ((restart_attempts_--) > 0)
@@ -125,7 +125,7 @@ int PrivetTrafficDetector::Bind() {
UMA_HISTOGRAM_LONG_TIMES("LocalDiscovery.DetectorRestartTime", time_delta);
}
start_time_ = base::Time::Now();
- DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
+ DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
socket_.reset(new net::UDPServerSocket(NULL, net::NetLog::Source()));
net::IPEndPoint multicast_addr = net::GetMDnsIPEndPoint(address_family_);
net::IPAddressNumber address_any(multicast_addr.address().size());
@@ -170,7 +170,7 @@ bool PrivetTrafficDetector::IsPrivetPacket(int rv) const {
}
int PrivetTrafficDetector::DoLoop(int rv) {
- DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
+ DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
do {
if (IsPrivetPacket(rv)) {
socket_.reset();
« no previous file with comments | « no previous file | chrome/browser/local_discovery/pwg_raster_converter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698