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

Side by Side Diff: third_party/WebKit/Source/modules/webaudio/WaveShaperNode.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) 2011, Google Inc. All rights reserved. 2 * Copyright (C) 2011, 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 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 return new WaveShaperNode(context); 52 return new WaveShaperNode(context);
53 } 53 }
54 54
55 WaveShaperProcessor* WaveShaperNode::getWaveShaperProcessor() const 55 WaveShaperProcessor* WaveShaperNode::getWaveShaperProcessor() const
56 { 56 {
57 return static_cast<WaveShaperProcessor*>(static_cast<AudioBasicProcessorHand ler&>(handler()).processor()); 57 return static_cast<WaveShaperProcessor*>(static_cast<AudioBasicProcessorHand ler&>(handler()).processor());
58 } 58 }
59 59
60 void WaveShaperNode::setCurve(DOMFloat32Array* curve, ExceptionState& exceptionS tate) 60 void WaveShaperNode::setCurve(DOMFloat32Array* curve, ExceptionState& exceptionS tate)
61 { 61 {
62 ASSERT(isMainThread()); 62 DCHECK(isMainThread());
63 63
64 if (curve && curve->length() < 2) { 64 if (curve && curve->length() < 2) {
65 exceptionState.throwDOMException( 65 exceptionState.throwDOMException(
66 InvalidAccessError, 66 InvalidAccessError,
67 ExceptionMessages::indexExceedsMinimumBound<unsigned>( 67 ExceptionMessages::indexExceedsMinimumBound<unsigned>(
68 "curve length", 68 "curve length",
69 curve->length(), 69 curve->length(),
70 2)); 70 2));
71 return; 71 return;
72 } 72 }
(...skipping 10 matching lines...) Expand all
83 unsigned size = curve->size(); 83 unsigned size = curve->size();
84 RefPtr<WTF::Float32Array> newCurve = WTF::Float32Array::create(size); 84 RefPtr<WTF::Float32Array> newCurve = WTF::Float32Array::create(size);
85 85
86 memcpy(newCurve->data(), curve->data(), sizeof(float) * size); 86 memcpy(newCurve->data(), curve->data(), sizeof(float) * size);
87 87
88 return DOMFloat32Array::create(newCurve.release()); 88 return DOMFloat32Array::create(newCurve.release());
89 } 89 }
90 90
91 void WaveShaperNode::setOversample(const String& type) 91 void WaveShaperNode::setOversample(const String& type)
92 { 92 {
93 ASSERT(isMainThread()); 93 DCHECK(isMainThread());
94 94
95 // This is to synchronize with the changes made in 95 // This is to synchronize with the changes made in
96 // AudioBasicProcessorNode::checkNumberOfChannelsForInput() where we can 96 // AudioBasicProcessorNode::checkNumberOfChannelsForInput() where we can
97 // initialize() and uninitialize(). 97 // initialize() and uninitialize().
98 BaseAudioContext::AutoLocker contextLocker(context()); 98 BaseAudioContext::AutoLocker contextLocker(context());
99 99
100 if (type == "none") { 100 if (type == "none") {
101 getWaveShaperProcessor()->setOversample(WaveShaperProcessor::OverSampleN one); 101 getWaveShaperProcessor()->setOversample(WaveShaperProcessor::OverSampleN one);
102 } else if (type == "2x") { 102 } else if (type == "2x") {
103 getWaveShaperProcessor()->setOversample(WaveShaperProcessor::OverSample2 x); 103 getWaveShaperProcessor()->setOversample(WaveShaperProcessor::OverSample2 x);
(...skipping 14 matching lines...) Expand all
118 case WaveShaperProcessor::OverSample4x: 118 case WaveShaperProcessor::OverSample4x:
119 return "4x"; 119 return "4x";
120 default: 120 default:
121 ASSERT_NOT_REACHED(); 121 ASSERT_NOT_REACHED();
122 return "none"; 122 return "none";
123 } 123 }
124 } 124 }
125 125
126 } // namespace blink 126 } // namespace blink
127 127
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698