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

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

Issue 2104913002: Rename threadSafeBind() to crossThreadBind() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@TRV_CTCPointer
Patch Set: Rebase Created 4 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
11 * documentation and/or other materials provided with the distribution. 11 * documentation and/or other materials provided with the distribution.
12 * 12 *
13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND AN Y 13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND AN Y
14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
15 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 15 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
16 * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR AN Y 16 * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR AN Y
17 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 17 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
18 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 18 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
19 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND O N 19 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND O N
20 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 20 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
21 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 21 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
22 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 22 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23 */ 23 */
24 24
25 #include "modules/webaudio/AbstractAudioContext.h" 25 #include "modules/webaudio/AbstractAudioContext.h"
26
26 #include "bindings/core/v8/Dictionary.h" 27 #include "bindings/core/v8/Dictionary.h"
27 #include "bindings/core/v8/ExceptionMessages.h" 28 #include "bindings/core/v8/ExceptionMessages.h"
28 #include "bindings/core/v8/ExceptionState.h" 29 #include "bindings/core/v8/ExceptionState.h"
29 #include "bindings/core/v8/ScriptPromiseResolver.h" 30 #include "bindings/core/v8/ScriptPromiseResolver.h"
30 #include "bindings/core/v8/ScriptState.h" 31 #include "bindings/core/v8/ScriptState.h"
31 #include "core/dom/DOMException.h" 32 #include "core/dom/DOMException.h"
32 #include "core/dom/Document.h" 33 #include "core/dom/Document.h"
33 #include "core/dom/ExceptionCode.h" 34 #include "core/dom/ExceptionCode.h"
34 #include "core/dom/ExecutionContextTask.h" 35 #include "core/dom/ExecutionContextTask.h"
35 #include "core/frame/Settings.h" 36 #include "core/frame/Settings.h"
(...skipping 22 matching lines...) Expand all
58 #include "modules/webaudio/OfflineAudioCompletionEvent.h" 59 #include "modules/webaudio/OfflineAudioCompletionEvent.h"
59 #include "modules/webaudio/OfflineAudioContext.h" 60 #include "modules/webaudio/OfflineAudioContext.h"
60 #include "modules/webaudio/OfflineAudioDestinationNode.h" 61 #include "modules/webaudio/OfflineAudioDestinationNode.h"
61 #include "modules/webaudio/OscillatorNode.h" 62 #include "modules/webaudio/OscillatorNode.h"
62 #include "modules/webaudio/PannerNode.h" 63 #include "modules/webaudio/PannerNode.h"
63 #include "modules/webaudio/PeriodicWave.h" 64 #include "modules/webaudio/PeriodicWave.h"
64 #include "modules/webaudio/PeriodicWaveConstraints.h" 65 #include "modules/webaudio/PeriodicWaveConstraints.h"
65 #include "modules/webaudio/ScriptProcessorNode.h" 66 #include "modules/webaudio/ScriptProcessorNode.h"
66 #include "modules/webaudio/StereoPannerNode.h" 67 #include "modules/webaudio/StereoPannerNode.h"
67 #include "modules/webaudio/WaveShaperNode.h" 68 #include "modules/webaudio/WaveShaperNode.h"
69 #include "platform/CrossThreadFunctional.h"
68 #include "platform/Histogram.h" 70 #include "platform/Histogram.h"
69 #include "platform/ThreadSafeFunctional.h"
70 #include "platform/UserGestureIndicator.h" 71 #include "platform/UserGestureIndicator.h"
71 #include "platform/audio/IIRFilter.h" 72 #include "platform/audio/IIRFilter.h"
72 #include "public/platform/Platform.h" 73 #include "public/platform/Platform.h"
73 #include "wtf/text/WTFString.h" 74 #include "wtf/text/WTFString.h"
74 75
75 namespace blink { 76 namespace blink {
76 77
77 namespace { 78 namespace {
78 79
79 enum UserGestureRecord { 80 enum UserGestureRecord {
(...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after
641 continue; 642 continue;
642 if (handler == &node->handler()) { 643 if (handler == &node->handler()) {
643 handler->breakConnection(); 644 handler->breakConnection();
644 m_finishedSourceNodes.add(node); 645 m_finishedSourceNodes.add(node);
645 didRemove = true; 646 didRemove = true;
646 break; 647 break;
647 } 648 }
648 } 649 }
649 } 650 }
650 if (didRemove) 651 if (didRemove)
651 Platform::current()->mainThread()->getWebTaskRunner()->postTask(BLINK_FR OM_HERE, threadSafeBind(&AbstractAudioContext::removeFinishedSourceNodes, wrapCr ossThreadPersistent(this))); 652 Platform::current()->mainThread()->getWebTaskRunner()->postTask(BLINK_FR OM_HERE, crossThreadBind(&AbstractAudioContext::removeFinishedSourceNodes, wrapC rossThreadPersistent(this)));
652 653
653 m_finishedSourceHandlers.clear(); 654 m_finishedSourceHandlers.clear();
654 } 655 }
655 656
656 void AbstractAudioContext::notifySourceNodeStartedProcessing(AudioNode* node) 657 void AbstractAudioContext::notifySourceNodeStartedProcessing(AudioNode* node)
657 { 658 {
658 ASSERT(isMainThread()); 659 ASSERT(isMainThread());
659 AutoLocker locker(this); 660 AutoLocker locker(this);
660 661
661 m_activeSourceNodes.append(node); 662 m_activeSourceNodes.append(node);
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
754 { 755 {
755 // This runs inside the AbstractAudioContext's lock when handling pre-render tasks. 756 // This runs inside the AbstractAudioContext's lock when handling pre-render tasks.
756 ASSERT(isAudioThread()); 757 ASSERT(isAudioThread());
757 ASSERT(isGraphOwner()); 758 ASSERT(isGraphOwner());
758 759
759 // Resolve any pending promises created by resume(). Only do this if we have n't already started 760 // Resolve any pending promises created by resume(). Only do this if we have n't already started
760 // resolving these promises. This gets called very often and it takes some t ime to resolve the 761 // resolving these promises. This gets called very often and it takes some t ime to resolve the
761 // promises in the main thread. 762 // promises in the main thread.
762 if (!m_isResolvingResumePromises && m_resumeResolvers.size() > 0) { 763 if (!m_isResolvingResumePromises && m_resumeResolvers.size() > 0) {
763 m_isResolvingResumePromises = true; 764 m_isResolvingResumePromises = true;
764 Platform::current()->mainThread()->getWebTaskRunner()->postTask(BLINK_FR OM_HERE, threadSafeBind(&AbstractAudioContext::resolvePromisesForResumeOnMainThr ead, wrapCrossThreadPersistent(this))); 765 Platform::current()->mainThread()->getWebTaskRunner()->postTask(BLINK_FR OM_HERE, crossThreadBind(&AbstractAudioContext::resolvePromisesForResumeOnMainTh read, wrapCrossThreadPersistent(this)));
765 } 766 }
766 } 767 }
767 768
768 void AbstractAudioContext::rejectPendingDecodeAudioDataResolvers() 769 void AbstractAudioContext::rejectPendingDecodeAudioDataResolvers()
769 { 770 {
770 // Now reject any pending decodeAudioData resolvers 771 // Now reject any pending decodeAudioData resolvers
771 for (auto& resolver : m_decodeAudioResolvers) 772 for (auto& resolver : m_decodeAudioResolvers)
772 resolver->reject(DOMException::create(InvalidStateError, "Audio context is going away")); 773 resolver->reject(DOMException::create(InvalidStateError, "Audio context is going away"));
773 m_decodeAudioResolvers.clear(); 774 m_decodeAudioResolvers.clear();
774 } 775 }
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
830 831
831 SecurityOrigin* AbstractAudioContext::getSecurityOrigin() const 832 SecurityOrigin* AbstractAudioContext::getSecurityOrigin() const
832 { 833 {
833 if (getExecutionContext()) 834 if (getExecutionContext())
834 return getExecutionContext()->getSecurityOrigin(); 835 return getExecutionContext()->getSecurityOrigin();
835 836
836 return nullptr; 837 return nullptr;
837 } 838 }
838 839
839 } // namespace blink 840 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698