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

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

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

Powered by Google App Engine
This is Rietveld 408576698