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

Side by Side 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: Fixing nits Created 5 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 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 23 matching lines...) Expand all
34 34
35 namespace blink { 35 namespace blink {
36 36
37 void DeferredTaskHandler::lock() 37 void DeferredTaskHandler::lock()
38 { 38 {
39 // Don't allow regular lock in real-time audio thread. 39 // Don't allow regular lock in real-time audio thread.
40 ASSERT(isMainThread()); 40 ASSERT(isMainThread());
41 m_contextGraphMutex.lock(); 41 m_contextGraphMutex.lock();
42 } 42 }
43 43
44 void DeferredTaskHandler::forceLock()
45 {
46 // This allows the regular lock in offline audio rendering. It is okay to
tkent 2015/07/16 00:33:43 Such comment should be in the header.
hongchan 2015/07/16 16:22:18 Done.
47 // lock the offline audio render thread because it is not real-time thread.
48 ASSERT(!isMainThread());
49 m_contextGraphMutex.lock();
50 }
51
44 bool DeferredTaskHandler::tryLock() 52 bool DeferredTaskHandler::tryLock()
45 { 53 {
46 // Try to catch cases of using try lock on main thread 54 // Try to catch cases of using try lock on main thread
47 // - it should use regular lock. 55 // - it should use regular lock.
48 ASSERT(isAudioThread()); 56 ASSERT(isAudioThread());
49 if (!isAudioThread()) { 57 if (!isAudioThread()) {
50 // In release build treat tryLock() as lock() (since above 58 // In release build treat tryLock() as lock() (since above
51 // ASSERT(isAudioThread) never fires) - this is the best we can do. 59 // ASSERT(isAudioThread) never fires) - this is the best we can do.
52 lock(); 60 lock();
53 return true; 61 return true;
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 { 269 {
262 ASSERT(isMainThread()); 270 ASSERT(isMainThread());
263 AutoLocker locker(*this); 271 AutoLocker locker(*this);
264 m_renderingOrphanHandlers.clear(); 272 m_renderingOrphanHandlers.clear();
265 m_deletableOrphanHandlers.clear(); 273 m_deletableOrphanHandlers.clear();
266 } 274 }
267 275
268 } // namespace blink 276 } // namespace blink
269 277
270 #endif // ENABLE(WEB_AUDIO) 278 #endif // ENABLE(WEB_AUDIO)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698