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

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

Issue 2812833003: Revert of [SharedArrayBuffer] Prevent SharedArrayBuffer being used in Web APIs (Closed)
Patch Set: 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
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 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 167
168 bool channels_are_good = 168 bool channels_are_good =
169 (number_of_input_channels == number_of_input_channels_) && 169 (number_of_input_channels == number_of_input_channels_) &&
170 (number_of_output_channels == number_of_output_channels_); 170 (number_of_output_channels == number_of_output_channels_);
171 DCHECK(channels_are_good); 171 DCHECK(channels_are_good);
172 if (!channels_are_good) 172 if (!channels_are_good)
173 return; 173 return;
174 174
175 for (unsigned i = 0; i < number_of_input_channels; ++i) 175 for (unsigned i = 0; i < number_of_input_channels; ++i)
176 internal_input_bus_->SetChannelMemory( 176 internal_input_bus_->SetChannelMemory(
177 i, 177 i, input_buffer->getChannelData(i)->Data() + buffer_read_write_index_,
178 input_buffer->getChannelData(i).View()->Data() +
179 buffer_read_write_index_,
180 frames_to_process); 178 frames_to_process);
181 179
182 if (number_of_input_channels) 180 if (number_of_input_channels)
183 internal_input_bus_->CopyFrom(*input_bus); 181 internal_input_bus_->CopyFrom(*input_bus);
184 182
185 // Copy from the output buffer to the output. 183 // Copy from the output buffer to the output.
186 for (unsigned i = 0; i < number_of_output_channels; ++i) { 184 for (unsigned i = 0; i < number_of_output_channels; ++i)
187 memcpy(output_bus->Channel(i)->MutableData(), 185 memcpy(output_bus->Channel(i)->MutableData(),
188 output_buffer->getChannelData(i).View()->Data() + 186 output_buffer->getChannelData(i)->Data() + buffer_read_write_index_,
189 buffer_read_write_index_,
190 sizeof(float) * frames_to_process); 187 sizeof(float) * frames_to_process);
191 }
192 188
193 // Update the buffering index. 189 // Update the buffering index.
194 buffer_read_write_index_ = 190 buffer_read_write_index_ =
195 (buffer_read_write_index_ + frames_to_process) % BufferSize(); 191 (buffer_read_write_index_ + frames_to_process) % BufferSize();
196 192
197 // m_bufferReadWriteIndex will wrap back around to 0 when the current input 193 // m_bufferReadWriteIndex will wrap back around to 0 when the current input
198 // and output buffers are full. 194 // and output buffers are full.
199 // When this happens, fire an event and swap buffers. 195 // When this happens, fire an event and swap buffers.
200 if (!buffer_read_write_index_) { 196 if (!buffer_read_write_index_) {
201 // Avoid building up requests on the main thread to fire process events when 197 // Avoid building up requests on the main thread to fire process events when
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
492 488
493 // If |onaudioprocess| event handler is defined, the node should not be 489 // If |onaudioprocess| event handler is defined, the node should not be
494 // GCed even if it is out of scope. 490 // GCed even if it is out of scope.
495 if (HasEventListeners(EventTypeNames::audioprocess)) 491 if (HasEventListeners(EventTypeNames::audioprocess))
496 return true; 492 return true;
497 493
498 return false; 494 return false;
499 } 495 }
500 496
501 } // namespace blink 497 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698