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

Unified Diff: third_party/WebKit/Source/modules/webaudio/OfflineAudioDestinationNode.cpp

Issue 2889393003: Lazy initialization of the rendering thread in OfflineAudioContext (Closed)
Patch Set: Adjusting number of contexts for timed-out trybots 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
« no previous file with comments | « third_party/WebKit/Source/modules/webaudio/OfflineAudioDestinationNode.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/modules/webaudio/OfflineAudioDestinationNode.cpp
diff --git a/third_party/WebKit/Source/modules/webaudio/OfflineAudioDestinationNode.cpp b/third_party/WebKit/Source/modules/webaudio/OfflineAudioDestinationNode.cpp
index e35b087652e1663a338b77707488110927f8aae1..32f1f5f2a9dd8b5195da38fbe02b435007eaf7aa 100644
--- a/third_party/WebKit/Source/modules/webaudio/OfflineAudioDestinationNode.cpp
+++ b/third_party/WebKit/Source/modules/webaudio/OfflineAudioDestinationNode.cpp
@@ -46,8 +46,6 @@ OfflineAudioDestinationHandler::OfflineAudioDestinationHandler(
AudioBuffer* render_target)
: AudioDestinationHandler(node),
render_target_(render_target),
- render_thread_(
- Platform::Current()->CreateThread("offline audio renderer")),
frames_processed_(0),
frames_to_process_(0),
is_rendering_started_(false),
@@ -138,10 +136,10 @@ size_t OfflineAudioDestinationHandler::CallbackBufferSize() const {
NOTREACHED();
return 0;
}
-WebThread* OfflineAudioDestinationHandler::OfflineRenderThread() {
- DCHECK(render_thread_);
- return render_thread_.get();
+void OfflineAudioDestinationHandler::InitializeOfflineRenderThread() {
+ DCHECK(IsMainThread());
+ render_thread_ = Platform::Current()->CreateThread("offline audio renderer");
}
void OfflineAudioDestinationHandler::StartOfflineRendering() {
@@ -253,6 +251,11 @@ void OfflineAudioDestinationHandler::NotifySuspend(size_t frame) {
}
void OfflineAudioDestinationHandler::NotifyComplete() {
+ DCHECK(IsMainThread());
+
+ // Nullify the rendering thread to save the system resource.
+ render_thread_.reset();
+
// The OfflineAudioContext might be gone.
if (Context())
Context()->FireCompletionEvent();
« no previous file with comments | « third_party/WebKit/Source/modules/webaudio/OfflineAudioDestinationNode.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698