Update DCHECK() usage to utilize the more expressive debugging functions.

BUG=58409

Review URL: http://codereview.chromium.org/6891008

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@82639 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/base/i18n/icu_string_conversions_unittest.cc b/base/i18n/icu_string_conversions_unittest.cc
index eb9d2cd..a3ec35c 100644
--- a/base/i18n/icu_string_conversions_unittest.cc
+++ b/base/i18n/icu_string_conversions_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
@@ -35,7 +35,7 @@
 #elif defined(WCHAR_T_IS_UTF32)
   string16 u16;
   while (*s != 0) {
-    DCHECK(static_cast<unsigned int>(*s) <= 0xFFFFu);
+    DCHECK_LE(static_cast<unsigned int>(*s), 0xFFFFu);
     u16.push_back(*s++);
   }
   return u16;
diff --git a/base/metrics/field_trial.cc b/base/metrics/field_trial.cc
index c1416db..ad2e5a0 100644
--- a/base/metrics/field_trial.cc
+++ b/base/metrics/field_trial.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
@@ -67,7 +67,7 @@
 
 int FieldTrial::AppendGroup(const std::string& name,
                             Probability group_probability) {
-  DCHECK(group_probability <= divisor_);
+  DCHECK_LE(group_probability, divisor_);
   DCHECK_GE(group_probability, 0);
 
   if (enable_benchmarking_ || disable_field_trial_)
@@ -75,7 +75,7 @@
 
   accumulated_group_probability_ += group_probability;
 
-  DCHECK(accumulated_group_probability_ <= divisor_);
+  DCHECK_LE(accumulated_group_probability_, divisor_);
   if (group_ == kNotFinalized && accumulated_group_probability_ > random_) {
     // This is the group that crossed the random line, so we do the assignment.
     group_ = next_group_number_;
diff --git a/base/pickle.cc b/base/pickle.cc
index afe35db..80d362f 100644
--- a/base/pickle.cc
+++ b/base/pickle.cc
@@ -34,7 +34,7 @@
       capacity_(0),
       variable_buffer_offset_(0) {
   DCHECK_GE(static_cast<size_t>(header_size), sizeof(Header));
-  DCHECK(header_size <= kPayloadUnit);
+  DCHECK_LE(header_size, kPayloadUnit);
   Resize(kPayloadUnit);
   header_->payload_size = 0;
 }
@@ -417,8 +417,8 @@
 const char* Pickle::FindNext(size_t header_size,
                              const char* start,
                              const char* end) {
-  DCHECK(header_size == AlignInt(header_size, sizeof(uint32)));
-  DCHECK(header_size <= static_cast<size_t>(kPayloadUnit));
+  DCHECK_EQ(header_size, AlignInt(header_size, sizeof(uint32)));
+  DCHECK_LE(header_size, static_cast<size_t>(kPayloadUnit));
 
   if (static_cast<size_t>(end - start) < sizeof(Header))
     return NULL;
diff --git a/base/rand_util.cc b/base/rand_util.cc
index 4a455f1..ea6ffd3 100644
--- a/base/rand_util.cc
+++ b/base/rand_util.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
@@ -14,7 +14,7 @@
 namespace base {
 
 int RandInt(int min, int max) {
-  DCHECK(min <= max);
+  DCHECK_LE(min, max);
 
   uint64 range = static_cast<uint64>(max) - min + 1;
   int result = min + static_cast<int>(base::RandGenerator(range));
diff --git a/base/shared_memory_posix.cc b/base/shared_memory_posix.cc
index b8e004d..7a238ed 100644
--- a/base/shared_memory_posix.cc
+++ b/base/shared_memory_posix.cc
@@ -82,7 +82,7 @@
 
 // static
 void SharedMemory::CloseHandle(const SharedMemoryHandle& handle) {
-  DCHECK(handle.fd >= 0);
+  DCHECK_GE(handle.fd, 0);
   if (HANDLE_EINTR(close(handle.fd)) < 0)
     PLOG(ERROR) << "close";
 }
diff --git a/base/sync_socket_posix.cc b/base/sync_socket_posix.cc
index 91467b1..1082c64 100644
--- a/base/sync_socket_posix.cc
+++ b/base/sync_socket_posix.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
@@ -88,14 +88,14 @@
 }
 
 size_t SyncSocket::Send(const void* buffer, size_t length) {
-  DCHECK(length <= kMaxMessageLength);
+  DCHECK_LE(length, kMaxMessageLength);
   const char* charbuffer = static_cast<const char*>(buffer);
   int len = file_util::WriteFileDescriptor(handle_, charbuffer, length);
   return static_cast<size_t>(len);
 }
 
 size_t SyncSocket::Receive(void* buffer, size_t length) {
-  DCHECK(length <= kMaxMessageLength);
+  DCHECK_LE(length, kMaxMessageLength);
   char* charbuffer = static_cast<char*>(buffer);
   if (file_util::ReadFromFD(handle_, charbuffer, length)) {
     return length;
diff --git a/base/sync_socket_win.cc b/base/sync_socket_win.cc
index 1e4fb2f..13091da 100644
--- a/base/sync_socket_win.cc
+++ b/base/sync_socket_win.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
@@ -108,7 +108,7 @@
 }
 
 size_t SyncSocket::Send(const void* buffer, size_t length) {
-  DCHECK(length <= kMaxMessageLength);
+  DCHECK_LE(length, kMaxMessageLength);
   size_t count = 0;
   while (count < length) {
     DWORD len;
@@ -125,7 +125,7 @@
 }
 
 size_t SyncSocket::Receive(void* buffer, size_t length) {
-  DCHECK(length <= kMaxMessageLength);
+  DCHECK_LE(length, kMaxMessageLength);
   size_t count = 0;
   while (count < length) {
     DWORD len;
diff --git a/base/time_win.cc b/base/time_win.cc
index 883c486..7124a74 100644
--- a/base/time_win.cc
+++ b/base/time_win.cc
@@ -62,7 +62,7 @@
 }
 
 void MicrosecondsToFileTime(int64 us, FILETIME* ft) {
-  DCHECK(us >= 0) << "Time is less than 0, negative values are not "
+  DCHECK_GE(us, 0ULL) << "Time is less than 0, negative values are not "
       "representable in FILETIME";
 
   // Multiply by 10 to convert milliseconds to 100-nanoseconds. Bit_cast will