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

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

Issue 1904283004: Replace threadSafeBind() + GCed pointers with CrossThreadPersistent (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@temp1912053002
Patch Set: Rebase Created 4 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 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 781 matching lines...) Expand 10 before | Expand all | Expand 10 after
792 continue; 792 continue;
793 if (handler == &node->handler()) { 793 if (handler == &node->handler()) {
794 handler->breakConnection(); 794 handler->breakConnection();
795 m_finishedSourceNodes.add(node); 795 m_finishedSourceNodes.add(node);
796 didRemove = true; 796 didRemove = true;
797 break; 797 break;
798 } 798 }
799 } 799 }
800 } 800 }
801 if (didRemove) 801 if (didRemove)
802 Platform::current()->mainThread()->getWebTaskRunner()->postTask(BLINK_FR OM_HERE, threadSafeBind(&AbstractAudioContext::removeFinishedSourceNodes, this)) ; 802 Platform::current()->mainThread()->getWebTaskRunner()->postTask(BLINK_FR OM_HERE, threadSafeBind(&AbstractAudioContext::removeFinishedSourceNodes, wrapCr ossThreadPersistent(this)));
803 803
804 m_finishedSourceHandlers.clear(); 804 m_finishedSourceHandlers.clear();
805 } 805 }
806 806
807 void AbstractAudioContext::notifySourceNodeStartedProcessing(AudioNode* node) 807 void AbstractAudioContext::notifySourceNodeStartedProcessing(AudioNode* node)
808 { 808 {
809 ASSERT(isMainThread()); 809 ASSERT(isMainThread());
810 AutoLocker locker(this); 810 AutoLocker locker(this);
811 811
812 m_activeSourceNodes.append(node); 812 m_activeSourceNodes.append(node);
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
902 { 902 {
903 // This runs inside the AbstractAudioContext's lock when handling pre-render tasks. 903 // This runs inside the AbstractAudioContext's lock when handling pre-render tasks.
904 ASSERT(isAudioThread()); 904 ASSERT(isAudioThread());
905 ASSERT(isGraphOwner()); 905 ASSERT(isGraphOwner());
906 906
907 // Resolve any pending promises created by resume(). Only do this if we have n't already started 907 // Resolve any pending promises created by resume(). Only do this if we have n't already started
908 // resolving these promises. This gets called very often and it takes some t ime to resolve the 908 // resolving these promises. This gets called very often and it takes some t ime to resolve the
909 // promises in the main thread. 909 // promises in the main thread.
910 if (!m_isResolvingResumePromises && m_resumeResolvers.size() > 0) { 910 if (!m_isResolvingResumePromises && m_resumeResolvers.size() > 0) {
911 m_isResolvingResumePromises = true; 911 m_isResolvingResumePromises = true;
912 Platform::current()->mainThread()->getWebTaskRunner()->postTask(BLINK_FR OM_HERE, threadSafeBind(&AbstractAudioContext::resolvePromisesForResumeOnMainThr ead, this)); 912 Platform::current()->mainThread()->getWebTaskRunner()->postTask(BLINK_FR OM_HERE, threadSafeBind(&AbstractAudioContext::resolvePromisesForResumeOnMainThr ead, wrapCrossThreadPersistent(this)));
913 } 913 }
914 } 914 }
915 915
916 void AbstractAudioContext::rejectPendingDecodeAudioDataResolvers() 916 void AbstractAudioContext::rejectPendingDecodeAudioDataResolvers()
917 { 917 {
918 // Now reject any pending decodeAudioData resolvers 918 // Now reject any pending decodeAudioData resolvers
919 for (auto& resolver : m_decodeAudioResolvers) 919 for (auto& resolver : m_decodeAudioResolvers)
920 resolver->reject(DOMException::create(InvalidStateError, "Audio context is going away")); 920 resolver->reject(DOMException::create(InvalidStateError, "Audio context is going away"));
921 m_decodeAudioResolvers.clear(); 921 m_decodeAudioResolvers.clear();
922 } 922 }
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
976 976
977 SecurityOrigin* AbstractAudioContext::getSecurityOrigin() const 977 SecurityOrigin* AbstractAudioContext::getSecurityOrigin() const
978 { 978 {
979 if (getExecutionContext()) 979 if (getExecutionContext())
980 return getExecutionContext()->getSecurityOrigin(); 980 return getExecutionContext()->getSecurityOrigin();
981 981
982 return nullptr; 982 return nullptr;
983 } 983 }
984 984
985 } // namespace blink 985 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698