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

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

Issue 2793593002: AudioWorklet prototype
Patch Set: Merge changes, AudioParam bug fix Created 3 years, 5 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
« no previous file with comments | « third_party/WebKit/Source/platform/audio/AudioDestination.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 75aaa58ed1e549c0af2105d2482534972c74ffa1..cd29c49a6860316bc4bf7089e3f221b591f377a1 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 {
@@ -131,16 +131,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,
@@ -184,14 +184,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;
}
@@ -205,7 +204,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;
}
}
@@ -261,8 +259,7 @@ bool AudioDestination::CheckBufferSize() {
}
bool AudioDestination::IsRenderingThread() {
- return static_cast<ThreadIdentifier>(rendering_thread_->ThreadId()) ==
- CurrentThread();
+ return rendering_thread_->IsCurrentThread();
}
} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/platform/audio/AudioDestination.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698