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

Unified Diff: webrtc/base/physicalsocketserver.cc

Issue 2623473004: Replace all use of the VERIFY macro. (Closed)
Patch Set: Tweaks after reviewing diff to master. Created 3 years, 10 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
Index: webrtc/base/physicalsocketserver.cc
diff --git a/webrtc/base/physicalsocketserver.cc b/webrtc/base/physicalsocketserver.cc
index 3b395ce63cf3f308838ce65818547cc295e6b512..2c4d0f9e11d5e937cb4e60adc12e6a8b1eafe189 100644
--- a/webrtc/base/physicalsocketserver.cc
+++ b/webrtc/base/physicalsocketserver.cc
@@ -138,7 +138,8 @@ PhysicalSocket::PhysicalSocket(PhysicalSocketServer* ss, SOCKET s)
int type = SOCK_STREAM;
socklen_t len = sizeof(type);
- VERIFY(0 == getsockopt(s_, SOL_SOCKET, SO_TYPE, (SockOptArg)&type, &len));
+ int res = getsockopt(s_, SOL_SOCKET, SO_TYPE, (SockOptArg)&type, &len);
+ RTC_DCHECK (res == 0);
kwiberg-webrtc 2017/02/07 09:39:49 Spurious space. Also, RTC_DCHECK_EQ?
udp_ = (SOCK_DGRAM == type);
}
}
@@ -834,7 +835,9 @@ class EventDispatcher : public Dispatcher {
CritScope cs(&crit_);
if (!fSignaled_) {
const uint8_t b[1] = {0};
- if (VERIFY(1 == write(afd_[1], b, sizeof(b)))) {
+ ssize_t res = write(afd_[1], b, sizeof(b));
+ RTC_DCHECK(1 == res);
+ if (res == 1) {
fSignaled_ = true;
}
kwiberg-webrtc 2017/02/07 09:39:49 Hmm. You're not supposed to handle DCHECK failures
nisse-webrtc 2017/02/07 10:48:15 I'm deleting the if. And changing to const and DCH
}
@@ -849,7 +852,8 @@ class EventDispatcher : public Dispatcher {
CritScope cs(&crit_);
if (fSignaled_) {
uint8_t b[4]; // Allow for reading more than 1 byte, but expect 1.
- VERIFY(1 == read(afd_[0], b, sizeof(b)));
+ ssize_t res = read(afd_[0], b, sizeof(b));
kwiberg-webrtc 2017/02/07 09:39:49 const? (You don't *have* to, but I recommend const
nisse-webrtc 2017/02/07 10:48:15 Done.
+ RTC_DCHECK(1 == res);
kwiberg-webrtc 2017/02/07 09:39:49 RTC_DCHECK_EQ, especially if you want the argument
nisse-webrtc 2017/02/07 10:48:15 Done.
fSignaled_ = false;
}
}

Powered by Google App Engine
This is Rietveld 408576698