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

Unified Diff: Source/modules/webaudio/DeferredTaskHandler.cpp

Issue 1140723003: Implement suspend() and resume() for OfflineAudioContext (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Added a layout test for synchronous graph manipulation Created 5 years, 6 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: Source/modules/webaudio/DeferredTaskHandler.cpp
diff --git a/Source/modules/webaudio/DeferredTaskHandler.cpp b/Source/modules/webaudio/DeferredTaskHandler.cpp
index c2605c157caa2787a5da09895322d8aa52a7ff66..7b635016c2b10687d0001547dd8a9bc2428aaf6b 100644
--- a/Source/modules/webaudio/DeferredTaskHandler.cpp
+++ b/Source/modules/webaudio/DeferredTaskHandler.cpp
@@ -42,6 +42,19 @@ void DeferredTaskHandler::lock()
m_contextGraphMutex.lock();
}
+void DeferredTaskHandler::forceLock()
+{
+ // This allows the regular lock in non-real-time audio thread.
Raymond Toy 2015/06/16 17:57:09 I think this can only be used with an online conte
hongchan 2015/06/16 21:31:21 No. This lock is only for offline audio context. M
Raymond Toy 2015/06/16 21:46:38 Typo on my part. I meant offline. I think since i
+ ASSERT(!isMainThread());
+ if (isMainThread()) {
Raymond Toy 2015/06/16 17:57:09 This is confusing. You ASSERT that it's not the m
hongchan 2015/06/16 21:31:20 I though we discussed this: for debug build, the a
Raymond Toy 2015/06/16 21:46:38 As we discussed offline, this is ok. But now I wo
+ // If this gets called in the main thread, do tryLock() instead.
+ m_contextGraphMutex.tryLock();
+ return;
+ }
+
+ m_contextGraphMutex.lock();
+}
+
bool DeferredTaskHandler::tryLock()
{
// Try to catch cases of using try lock on main thread

Powered by Google App Engine
This is Rietveld 408576698