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

Unified Diff: third_party/WebKit/Source/platform/audio/AudioDestination.cpp

Issue 2793593002: AudioWorklet prototype
Patch Set: Rebase after ThreadedWorkletMessaginProxy change Created 3 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/platform/audio/AudioDestination.cpp
diff --git a/third_party/WebKit/Source/platform/audio/AudioDestination.cpp b/third_party/WebKit/Source/platform/audio/AudioDestination.cpp
index 39d569fd56ae9f8ab1156cca8e02ef89622fce06..689bb5eee9acc32fde83c6877aa414666e257db0 100644
--- a/third_party/WebKit/Source/platform/audio/AudioDestination.cpp
+++ b/third_party/WebKit/Source/platform/audio/AudioDestination.cpp
@@ -32,6 +32,7 @@
#include "platform/CrossThreadFunctional.h"
#include "platform/Histogram.h"
#include "platform/WebTaskRunner.h"
+#include "platform/WebThreadSupportingGC.h"
#include "platform/audio/AudioUtilities.h"
#include "platform/audio/PushPullFIFO.h"
#include "platform/instrumentation/tracing/TraceEvent.h"
@@ -40,7 +41,6 @@
#include "public/platform/Platform.h"
#include "public/platform/WebAudioLatencyHint.h"
#include "public/platform/WebSecurityOrigin.h"
-#include "public/platform/WebThread.h"
namespace blink {
@@ -125,16 +125,16 @@ void AudioDestination::Render(const WebVector<float*>& destination_data,
// TODO(hongchan): this check might be redundant, so consider removing later.
if (frames_to_render != 0 && rendering_thread_) {
- rendering_thread_->GetWebTaskRunner()->PostTask(
+ rendering_thread_->PostTask(
BLINK_FROM_HERE,
- CrossThreadBind(&AudioDestination::RequestRenderOnWebThread,
+ CrossThreadBind(&AudioDestination::RequestRenderOnWorkerThread,
CrossThreadUnretained(this), number_of_frames,
frames_to_render, delay, delay_timestamp,
prior_frames_skipped));
}
}
-void AudioDestination::RequestRenderOnWebThread(size_t frames_requested,
+void AudioDestination::RequestRenderOnWorkerThread(size_t frames_requested,
size_t frames_to_render,
double delay,
double delay_timestamp,
@@ -178,14 +178,13 @@ void AudioDestination::RequestRenderOnWebThread(size_t frames_requested,
frames_elapsed_ += frames_requested;
}
-void AudioDestination::Start() {
+void AudioDestination::Start(WebThreadSupportingGC* thread) {
DCHECK(IsMainThread());
// Start the "audio device" after the rendering thread is ready.
if (web_audio_device_ && !is_playing_) {
TRACE_EVENT0("webaudio", "AudioDestination::Start");
- rendering_thread_ =
- Platform::Current()->CreateThread("WebAudio Rendering Thread");
+ rendering_thread_ = thread;
web_audio_device_->Start();
is_playing_ = true;
}
@@ -199,7 +198,6 @@ void AudioDestination::Stop() {
if (web_audio_device_ && is_playing_) {
TRACE_EVENT0("webaudio", "AudioDestination::Stop");
web_audio_device_->Stop();
- rendering_thread_.reset();
is_playing_ = false;
}
}
@@ -255,8 +253,7 @@ bool AudioDestination::CheckBufferSize() {
}
bool AudioDestination::IsRenderingThread() {
- return static_cast<ThreadIdentifier>(rendering_thread_->ThreadId()) ==
- CurrentThread();
+ return rendering_thread_->IsCurrentThread();
}
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698