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

Side by Side Diff: Source/modules/webaudio/ScriptProcessorNode.cpp

Issue 170603003: Use nullptr_t for RefPtr, PassRefPtr and RawPtr. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Final rebase Created 6 years, 10 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 | Annotate | Revision Log
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 * 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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 break; 65 break;
66 case 256: 66 case 256:
67 case 512: 67 case 512:
68 case 1024: 68 case 1024:
69 case 2048: 69 case 2048:
70 case 4096: 70 case 4096:
71 case 8192: 71 case 8192:
72 case 16384: 72 case 16384:
73 break; 73 break;
74 default: 74 default:
75 return 0; 75 return nullptr;
76 } 76 }
77 77
78 if (!numberOfInputChannels && !numberOfOutputChannels) 78 if (!numberOfInputChannels && !numberOfOutputChannels)
79 return 0; 79 return nullptr;
80 80
81 if (numberOfInputChannels > AudioContext::maxNumberOfChannels()) 81 if (numberOfInputChannels > AudioContext::maxNumberOfChannels())
82 return 0; 82 return nullptr;
83 83
84 if (numberOfOutputChannels > AudioContext::maxNumberOfChannels()) 84 if (numberOfOutputChannels > AudioContext::maxNumberOfChannels())
85 return 0; 85 return nullptr;
86 86
87 return adoptRef(new ScriptProcessorNode(context, sampleRate, bufferSize, num berOfInputChannels, numberOfOutputChannels)); 87 return adoptRef(new ScriptProcessorNode(context, sampleRate, bufferSize, num berOfInputChannels, numberOfOutputChannels));
88 } 88 }
89 89
90 ScriptProcessorNode::ScriptProcessorNode(AudioContext* context, float sampleRate , size_t bufferSize, unsigned numberOfInputChannels, unsigned numberOfOutputChan nels) 90 ScriptProcessorNode::ScriptProcessorNode(AudioContext* context, float sampleRate , size_t bufferSize, unsigned numberOfInputChannels, unsigned numberOfOutputChan nels)
91 : AudioNode(context, sampleRate) 91 : AudioNode(context, sampleRate)
92 , m_doubleBufferIndex(0) 92 , m_doubleBufferIndex(0)
93 , m_doubleBufferIndexForEvent(0) 93 , m_doubleBufferIndexForEvent(0)
94 , m_bufferSize(bufferSize) 94 , m_bufferSize(bufferSize)
95 , m_bufferReadWriteIndex(0) 95 , m_bufferReadWriteIndex(0)
(...skipping 25 matching lines...) Expand all
121 void ScriptProcessorNode::initialize() 121 void ScriptProcessorNode::initialize()
122 { 122 {
123 if (isInitialized()) 123 if (isInitialized())
124 return; 124 return;
125 125
126 float sampleRate = context()->sampleRate(); 126 float sampleRate = context()->sampleRate();
127 127
128 // Create double buffers on both the input and output sides. 128 // Create double buffers on both the input and output sides.
129 // These AudioBuffers will be directly accessed in the main thread by JavaSc ript. 129 // These AudioBuffers will be directly accessed in the main thread by JavaSc ript.
130 for (unsigned i = 0; i < 2; ++i) { 130 for (unsigned i = 0; i < 2; ++i) {
131 RefPtr<AudioBuffer> inputBuffer = m_numberOfInputChannels ? AudioBuffer: :create(m_numberOfInputChannels, bufferSize(), sampleRate) : 0; 131 RefPtr<AudioBuffer> inputBuffer = m_numberOfInputChannels ? AudioBuffer: :create(m_numberOfInputChannels, bufferSize(), sampleRate) : nullptr;
132 RefPtr<AudioBuffer> outputBuffer = m_numberOfOutputChannels ? AudioBuffe r::create(m_numberOfOutputChannels, bufferSize(), sampleRate) : 0; 132 RefPtr<AudioBuffer> outputBuffer = m_numberOfOutputChannels ? AudioBuffe r::create(m_numberOfOutputChannels, bufferSize(), sampleRate) : nullptr;
133 133
134 m_inputBuffers.append(inputBuffer); 134 m_inputBuffers.append(inputBuffer);
135 m_outputBuffers.append(outputBuffer); 135 m_outputBuffers.append(outputBuffer);
136 } 136 }
137 137
138 AudioNode::initialize(); 138 AudioNode::initialize();
139 } 139 }
140 140
141 void ScriptProcessorNode::uninitialize() 141 void ScriptProcessorNode::uninitialize()
142 { 142 {
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 } 276 }
277 277
278 double ScriptProcessorNode::latencyTime() const 278 double ScriptProcessorNode::latencyTime() const
279 { 279 {
280 return std::numeric_limits<double>::infinity(); 280 return std::numeric_limits<double>::infinity();
281 } 281 }
282 282
283 } // namespace WebCore 283 } // namespace WebCore
284 284
285 #endif // ENABLE(WEB_AUDIO) 285 #endif // ENABLE(WEB_AUDIO)
OLDNEW
« no previous file with comments | « Source/modules/webaudio/PeriodicWave.cpp ('k') | Source/modules/webdatabase/DOMWindowWebDatabase.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698