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

Unified Diff: third_party/WebKit/Source/platform/wtf/Vector.h

Issue 2833123002: Replace ASSERT_NOT_REACHED, and RELEASE_ASSERT in platform/wtf (Closed)
Patch Set: wtf Created 3 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
Index: third_party/WebKit/Source/platform/wtf/Vector.h
diff --git a/third_party/WebKit/Source/platform/wtf/Vector.h b/third_party/WebKit/Source/platform/wtf/Vector.h
index 07d10c01747fc938e838c714be477b65226a9e27..3e6f2e355afb5701b1a368b68b6e4a780fe35da8 100644
--- a/third_party/WebKit/Source/platform/wtf/Vector.h
+++ b/third_party/WebKit/Source/platform/wtf/Vector.h
@@ -1000,11 +1000,11 @@ class Vector
// instead of:
// (*pointerToVector)[1];
T& at(size_t i) {
- RELEASE_ASSERT(i < size());
+ CHECK_LT(i, size());
return Base::Buffer()[i];
}
const T& at(size_t i) const {
- RELEASE_ASSERT(i < size());
+ CHECK_LT(i, size());
return Base::Buffer()[i];
}
@@ -1507,7 +1507,7 @@ void Vector<T, inlineCapacity, Allocator>::ExpandCapacity(
if (INLINE_CAPACITY) {
expanded_capacity *= 2;
// Check for integer overflow, which could happen in the 32-bit build.
- RELEASE_ASSERT(expanded_capacity > old_capacity);
+ CHECK_GT(expanded_capacity, old_capacity);
} else {
// This cannot integer overflow.
// On 64-bit, the "expanded" integer is 32-bit, and any encroachment
@@ -1706,7 +1706,7 @@ void Vector<T, inlineCapacity, Allocator>::Append(const U* data,
data = ExpandCapacity(new_size, data);
DCHECK(begin());
}
- RELEASE_ASSERT(new_size >= size_);
+ CHECK_GE(new_size, size_);
T* dest = end();
ANNOTATE_CHANGE_SIZE(begin(), capacity(), size_, new_size);
VectorCopier<VectorTraits<T>::kCanCopyWithMemcpy, T>::UninitializedCopy(
@@ -1766,7 +1766,7 @@ template <typename U>
inline void Vector<T, inlineCapacity, Allocator>::insert(size_t position,
U&& val) {
DCHECK(Allocator::IsAllocationAllowed());
- RELEASE_ASSERT(position <= size());
+ CHECK_LE(position, size());
typename std::remove_reference<U>::type* data = &val;
if (size() == capacity()) {
data = ExpandCapacity(size() + 1, data);
@@ -1785,13 +1785,13 @@ void Vector<T, inlineCapacity, Allocator>::insert(size_t position,
const U* data,
size_t data_size) {
DCHECK(Allocator::IsAllocationAllowed());
- RELEASE_ASSERT(position <= size());
+ CHECK_LE(position, size());
size_t new_size = size_ + data_size;
if (new_size > capacity()) {
data = ExpandCapacity(new_size, data);
DCHECK(begin());
}
- RELEASE_ASSERT(new_size >= size_);
+ CHECK_GE(new_size, size_);
ANNOTATE_CHANGE_SIZE(begin(), capacity(), size_, new_size);
T* spot = begin() + position;
TypeOperations::MoveOverlapping(spot, end(), spot + data_size);
@@ -1830,7 +1830,7 @@ inline void Vector<T, inlineCapacity, Allocator>::PrependVector(
template <typename T, size_t inlineCapacity, typename Allocator>
inline void Vector<T, inlineCapacity, Allocator>::erase(size_t position) {
- RELEASE_ASSERT(position < size());
+ CHECK_LT(position, size());
T* spot = begin() + position;
spot->~T();
TypeOperations::MoveOverlapping(spot + 1, end(), spot);
@@ -1845,7 +1845,7 @@ inline void Vector<T, inlineCapacity, Allocator>::erase(size_t position,
SECURITY_DCHECK(position <= size());
if (!length)
return;
- RELEASE_ASSERT(position + length <= size());
+ CHECK_LE(position + length, size());
T* begin_spot = begin() + position;
T* end_spot = begin_spot + length;
TypeOperations::Destruct(begin_spot, end_spot);
« no previous file with comments | « third_party/WebKit/Source/platform/wtf/TerminatedArrayBuilder.h ('k') | third_party/WebKit/Source/platform/wtf/WTF.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698