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

Side by Side Diff: Source/modules/webaudio/AudioContext.cpp

Issue 349213007: WebAudio: Remove AudioNode::RefType. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix webaudio/delaynode-max-nondefault-delay.html Created 6 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 | Annotate | Revision Log
« no previous file with comments | « Source/modules/webaudio/AudioContext.h ('k') | Source/modules/webaudio/AudioNode.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 568 matching lines...) Expand 10 before | Expand all | Expand 10 after
579 derefNode(m_finishedNodes[i]); 579 derefNode(m_finishedNodes[i]);
580 580
581 m_finishedNodes.clear(); 581 m_finishedNodes.clear();
582 } 582 }
583 583
584 void AudioContext::refNode(AudioNode* node) 584 void AudioContext::refNode(AudioNode* node)
585 { 585 {
586 ASSERT(isMainThread()); 586 ASSERT(isMainThread());
587 AutoLocker locker(this); 587 AutoLocker locker(this);
588 588
589 node->ref(AudioNode::RefTypeConnection);
590 m_referencedNodes.append(node); 589 m_referencedNodes.append(node);
590 node->makeConnection();
591 } 591 }
592 592
593 void AudioContext::derefNode(AudioNode* node) 593 void AudioContext::derefNode(AudioNode* node)
594 { 594 {
595 ASSERT(isGraphOwner()); 595 ASSERT(isGraphOwner());
596 596
597 node->deref(AudioNode::RefTypeConnection);
598
599 for (unsigned i = 0; i < m_referencedNodes.size(); ++i) { 597 for (unsigned i = 0; i < m_referencedNodes.size(); ++i) {
600 if (node == m_referencedNodes[i]) { 598 if (node == m_referencedNodes[i].get()) {
599 node->breakConnection();
601 m_referencedNodes.remove(i); 600 m_referencedNodes.remove(i);
602 break; 601 break;
603 } 602 }
604 } 603 }
605 } 604 }
606 605
607 void AudioContext::derefUnfinishedSourceNodes() 606 void AudioContext::derefUnfinishedSourceNodes()
608 { 607 {
609 ASSERT(isMainThread()); 608 ASSERT(isMainThread());
610 for (unsigned i = 0; i < m_referencedNodes.size(); ++i) 609 for (unsigned i = 0; i < m_referencedNodes.size(); ++i)
611 m_referencedNodes[i]->deref(AudioNode::RefTypeConnection); 610 m_referencedNodes[i]->breakConnection();
612 611
613 m_referencedNodes.clear(); 612 m_referencedNodes.clear();
614 } 613 }
615 614
616 void AudioContext::lock(bool& mustReleaseLock) 615 void AudioContext::lock(bool& mustReleaseLock)
617 { 616 {
618 // Don't allow regular lock in real-time audio thread. 617 // Don't allow regular lock in real-time audio thread.
619 ASSERT(isMainThread()); 618 ASSERT(isMainThread());
620 619
621 ThreadIdentifier thisThread = currentThread(); 620 ThreadIdentifier thisThread = currentThread();
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
735 if (mustReleaseLock) 734 if (mustReleaseLock)
736 unlock(); 735 unlock();
737 } 736 }
738 } 737 }
739 738
740 void AudioContext::handleDeferredFinishDerefs() 739 void AudioContext::handleDeferredFinishDerefs()
741 { 740 {
742 ASSERT(isAudioThread() && isGraphOwner()); 741 ASSERT(isAudioThread() && isGraphOwner());
743 for (unsigned i = 0; i < m_deferredFinishDerefList.size(); ++i) { 742 for (unsigned i = 0; i < m_deferredFinishDerefList.size(); ++i) {
744 AudioNode* node = m_deferredFinishDerefList[i]; 743 AudioNode* node = m_deferredFinishDerefList[i];
745 node->finishDeref(AudioNode::RefTypeConnection); 744 node->finishDeref();
746 } 745 }
747 746
748 m_deferredFinishDerefList.clear(); 747 m_deferredFinishDerefList.clear();
749 } 748 }
750 749
751 void AudioContext::markForDeletion(AudioNode* node) 750 void AudioContext::markForDeletion(AudioNode* node)
752 { 751 {
753 ASSERT(isGraphOwner()); 752 ASSERT(isGraphOwner());
754 753
755 if (!isInitialized()) 754 if (!isInitialized())
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
955 visitor->trace(m_renderTarget); 954 visitor->trace(m_renderTarget);
956 visitor->trace(m_destinationNode); 955 visitor->trace(m_destinationNode);
957 visitor->trace(m_listener); 956 visitor->trace(m_listener);
958 visitor->trace(m_dirtySummingJunctions); 957 visitor->trace(m_dirtySummingJunctions);
959 EventTargetWithInlineData::trace(visitor); 958 EventTargetWithInlineData::trace(visitor);
960 } 959 }
961 960
962 } // namespace WebCore 961 } // namespace WebCore
963 962
964 #endif // ENABLE(WEB_AUDIO) 963 #endif // ENABLE(WEB_AUDIO)
OLDNEW
« no previous file with comments | « Source/modules/webaudio/AudioContext.h ('k') | Source/modules/webaudio/AudioNode.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698