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

Side by Side Diff: third_party/WebKit/Source/modules/webaudio/AudioBuffer.cpp

Issue 2159403002: Replace ASSERT with DCHECK in WebAudio (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 4 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
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 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 232
233 return; 233 return;
234 } 234 }
235 235
236 unsigned count = channelData->length() - startInChannel; 236 unsigned count = channelData->length() - startInChannel;
237 count = std::min(destination->length(), count); 237 count = std::min(destination->length(), count);
238 238
239 const float* src = channelData->data(); 239 const float* src = channelData->data();
240 float* dst = destination->data(); 240 float* dst = destination->data();
241 241
242 ASSERT(src); 242 DCHECK(src);
243 ASSERT(dst); 243 DCHECK(dst);
244 244
245 memcpy(dst, src + startInChannel, count * sizeof(*src)); 245 memcpy(dst, src + startInChannel, count * sizeof(*src));
246 } 246 }
247 247
248 void AudioBuffer::copyToChannel(DOMFloat32Array* source, long channelNumber, Exc eptionState& exceptionState) 248 void AudioBuffer::copyToChannel(DOMFloat32Array* source, long channelNumber, Exc eptionState& exceptionState)
249 { 249 {
250 return copyToChannel(source, channelNumber, 0, exceptionState); 250 return copyToChannel(source, channelNumber, 0, exceptionState);
251 } 251 }
252 252
253 void AudioBuffer::copyToChannel(DOMFloat32Array* source, long channelNumber, uns igned long startInChannel, ExceptionState& exceptionState) 253 void AudioBuffer::copyToChannel(DOMFloat32Array* source, long channelNumber, uns igned long startInChannel, ExceptionState& exceptionState)
(...skipping 26 matching lines...) Expand all
280 280
281 return; 281 return;
282 } 282 }
283 283
284 unsigned count = channelData->length() - startInChannel; 284 unsigned count = channelData->length() - startInChannel;
285 count = std::min(source->length(), count); 285 count = std::min(source->length(), count);
286 286
287 const float* src = source->data(); 287 const float* src = source->data();
288 float* dst = channelData->data(); 288 float* dst = channelData->data();
289 289
290 ASSERT(src); 290 DCHECK(src);
291 ASSERT(dst); 291 DCHECK(dst);
292 292
293 memcpy(dst + startInChannel, src, count * sizeof(*dst)); 293 memcpy(dst + startInChannel, src, count * sizeof(*dst));
294 } 294 }
295 295
296 void AudioBuffer::zero() 296 void AudioBuffer::zero()
297 { 297 {
298 for (unsigned i = 0; i < m_channels.size(); ++i) { 298 for (unsigned i = 0; i < m_channels.size(); ++i) {
299 if (DOMFloat32Array* array = getChannelData(i)) { 299 if (DOMFloat32Array* array = getChannelData(i)) {
300 float* data = array->data(); 300 float* data = array->data();
301 memset(data, 0, length() * sizeof(*data)); 301 memset(data, 0, length() * sizeof(*data));
302 } 302 }
303 } 303 }
304 } 304 }
305 305
306 } // namespace blink 306 } // namespace blink
307 307
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698