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

Side by Side Diff: third_party/WebKit/Source/platform/audio/AudioArray.h

Issue 2803733002: Convert ASSERT(foo) to DCHECK(foo) in platform/audio (Closed)
Patch Set: Mechanical change from ASSERT(foo) to DCHECK(foo) 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 unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/platform/audio/AudioBus.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 115
116 T& operator[](size_t i) { return at(i); } 116 T& operator[](size_t i) { return at(i); }
117 117
118 void zero() { 118 void zero() {
119 // This multiplication is made safe by the check in allocate(). 119 // This multiplication is made safe by the check in allocate().
120 memset(this->data(), 0, sizeof(T) * this->size()); 120 memset(this->data(), 0, sizeof(T) * this->size());
121 } 121 }
122 122
123 void zeroRange(unsigned start, unsigned end) { 123 void zeroRange(unsigned start, unsigned end) {
124 bool isSafe = (start <= end) && (end <= this->size()); 124 bool isSafe = (start <= end) && (end <= this->size());
125 ASSERT(isSafe); 125 DCHECK(isSafe);
126 if (!isSafe) 126 if (!isSafe)
127 return; 127 return;
128 128
129 // This expression cannot overflow because end - start cannot be 129 // This expression cannot overflow because end - start cannot be
130 // greater than m_size, which is safe due to the check in allocate(). 130 // greater than m_size, which is safe due to the check in allocate().
131 memset(this->data() + start, 0, sizeof(T) * (end - start)); 131 memset(this->data() + start, 0, sizeof(T) * (end - start));
132 } 132 }
133 133
134 void copyToRange(const T* sourceData, unsigned start, unsigned end) { 134 void copyToRange(const T* sourceData, unsigned start, unsigned end) {
135 bool isSafe = (start <= end) && (end <= this->size()); 135 bool isSafe = (start <= end) && (end <= this->size());
136 ASSERT(isSafe); 136 DCHECK(isSafe);
137 if (!isSafe) 137 if (!isSafe)
138 return; 138 return;
139 139
140 // This expression cannot overflow because end - start cannot be 140 // This expression cannot overflow because end - start cannot be
141 // greater than m_size, which is safe due to the check in allocate(). 141 // greater than m_size, which is safe due to the check in allocate().
142 memcpy(this->data() + start, sourceData, sizeof(T) * (end - start)); 142 memcpy(this->data() + start, sourceData, sizeof(T) * (end - start));
143 } 143 }
144 144
145 private: 145 private:
146 static T* alignedAddress(T* address, intptr_t alignment) { 146 static T* alignedAddress(T* address, intptr_t alignment) {
147 intptr_t value = reinterpret_cast<intptr_t>(address); 147 intptr_t value = reinterpret_cast<intptr_t>(address);
148 return reinterpret_cast<T*>((value + alignment - 1) & ~(alignment - 1)); 148 return reinterpret_cast<T*>((value + alignment - 1) & ~(alignment - 1));
149 } 149 }
150 150
151 T* m_allocation; 151 T* m_allocation;
152 T* m_alignedData; 152 T* m_alignedData;
153 size_t m_size; 153 size_t m_size;
154 }; 154 };
155 155
156 typedef AudioArray<float> AudioFloatArray; 156 typedef AudioArray<float> AudioFloatArray;
157 typedef AudioArray<double> AudioDoubleArray; 157 typedef AudioArray<double> AudioDoubleArray;
158 158
159 } // namespace blink 159 } // namespace blink
160 160
161 #endif // AudioArray_h 161 #endif // AudioArray_h
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/platform/audio/AudioBus.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698