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

Side by Side Diff: third_party/WebKit/Source/modules/webaudio/OfflineAudioContext.cpp

Issue 2638413004: Don't run removeFinishedSourceNodes with the context lock. (Closed)
Patch Set: Add removeFinishedSourceNodesOnMainThread Created 3 years, 11 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) 2012, Google Inc. All rights reserved. 2 * Copyright (C) 2012, 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 18 matching lines...) Expand all
29 #include "bindings/core/v8/ScriptState.h" 29 #include "bindings/core/v8/ScriptState.h"
30 #include "core/dom/DOMException.h" 30 #include "core/dom/DOMException.h"
31 #include "core/dom/Document.h" 31 #include "core/dom/Document.h"
32 #include "core/dom/ExceptionCode.h" 32 #include "core/dom/ExceptionCode.h"
33 #include "core/dom/ExecutionContext.h" 33 #include "core/dom/ExecutionContext.h"
34 #include "modules/webaudio/AudioListener.h" 34 #include "modules/webaudio/AudioListener.h"
35 #include "modules/webaudio/DeferredTaskHandler.h" 35 #include "modules/webaudio/DeferredTaskHandler.h"
36 #include "modules/webaudio/OfflineAudioCompletionEvent.h" 36 #include "modules/webaudio/OfflineAudioCompletionEvent.h"
37 #include "modules/webaudio/OfflineAudioDestinationNode.h" 37 #include "modules/webaudio/OfflineAudioDestinationNode.h"
38 38
39 #include "platform/CrossThreadFunctional.h"
39 #include "platform/Histogram.h" 40 #include "platform/Histogram.h"
40 #include "platform/audio/AudioUtilities.h" 41 #include "platform/audio/AudioUtilities.h"
42 #include "public/platform/Platform.h"
41 43
42 namespace blink { 44 namespace blink {
43 45
44 OfflineAudioContext* OfflineAudioContext::create( 46 OfflineAudioContext* OfflineAudioContext::create(
45 ExecutionContext* context, 47 ExecutionContext* context,
46 unsigned numberOfChannels, 48 unsigned numberOfChannels,
47 unsigned numberOfFrames, 49 unsigned numberOfFrames,
48 float sampleRate, 50 float sampleRate,
49 ExceptionState& exceptionState) { 51 ExceptionState& exceptionState) {
50 // FIXME: add support for workers. 52 // FIXME: add support for workers.
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 handleStoppableSourceNodes(); 369 handleStoppableSourceNodes();
368 370
369 return shouldSuspend(); 371 return shouldSuspend();
370 } 372 }
371 373
372 void OfflineAudioContext::handlePostOfflineRenderTasks() { 374 void OfflineAudioContext::handlePostOfflineRenderTasks() {
373 DCHECK(isAudioThread()); 375 DCHECK(isAudioThread());
374 376
375 // OfflineGraphAutoLocker here locks the audio graph for the same reason 377 // OfflineGraphAutoLocker here locks the audio graph for the same reason
376 // above in |handlePreOfflineRenderTasks|. 378 // above in |handlePreOfflineRenderTasks|.
377 OfflineGraphAutoLocker locker(this); 379 bool didRemove = false;
380 {
381 OfflineGraphAutoLocker locker(this);
378 382
379 deferredTaskHandler().breakConnections(); 383 deferredTaskHandler().breakConnections();
380 releaseFinishedSourceNodes(); 384 didRemove = releaseFinishedSourceNodes();
381 deferredTaskHandler().handleDeferredTasks(); 385 deferredTaskHandler().handleDeferredTasks();
382 deferredTaskHandler().requestToDeleteHandlersOnMainThread(); 386 deferredTaskHandler().requestToDeleteHandlersOnMainThread();
387 }
388
389 removeFinishedSourceNodes(didRemove);
383 } 390 }
384 391
385 OfflineAudioDestinationHandler& OfflineAudioContext::destinationHandler() { 392 OfflineAudioDestinationHandler& OfflineAudioContext::destinationHandler() {
386 return static_cast<OfflineAudioDestinationHandler&>( 393 return static_cast<OfflineAudioDestinationHandler&>(
387 destination()->audioDestinationHandler()); 394 destination()->audioDestinationHandler());
388 } 395 }
389 396
390 void OfflineAudioContext::resolveSuspendOnMainThread(size_t frame) { 397 void OfflineAudioContext::resolveSuspendOnMainThread(size_t frame) {
391 DCHECK(isMainThread()); 398 DCHECK(isMainThread());
392 399
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
434 441
435 // Note that the GraphLock is required before this check. Since this needs 442 // Note that the GraphLock is required before this check. Since this needs
436 // to run on the audio thread, OfflineGraphAutoLocker must be used. 443 // to run on the audio thread, OfflineGraphAutoLocker must be used.
437 if (m_scheduledSuspends.contains(currentSampleFrame())) 444 if (m_scheduledSuspends.contains(currentSampleFrame()))
438 return true; 445 return true;
439 446
440 return false; 447 return false;
441 } 448 }
442 449
443 } // namespace blink 450 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698