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

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

Issue 385953003: Revert of WebAudio: Remove AudioNode::RefType. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: 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);
589 m_referencedNodes.append(node); 590 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
597 for (unsigned i = 0; i < m_referencedNodes.size(); ++i) { 599 for (unsigned i = 0; i < m_referencedNodes.size(); ++i) {
598 if (node == m_referencedNodes[i].get()) { 600 if (node == m_referencedNodes[i]) {
599 node->breakConnection();
600 m_referencedNodes.remove(i); 601 m_referencedNodes.remove(i);
601 break; 602 break;
602 } 603 }
603 } 604 }
604 } 605 }
605 606
606 void AudioContext::derefUnfinishedSourceNodes() 607 void AudioContext::derefUnfinishedSourceNodes()
607 { 608 {
608 ASSERT(isMainThread()); 609 ASSERT(isMainThread());
609 for (unsigned i = 0; i < m_referencedNodes.size(); ++i) 610 for (unsigned i = 0; i < m_referencedNodes.size(); ++i)
610 m_referencedNodes[i]->breakConnection(); 611 m_referencedNodes[i]->deref(AudioNode::RefTypeConnection);
611 612
612 m_referencedNodes.clear(); 613 m_referencedNodes.clear();
613 } 614 }
614 615
615 void AudioContext::lock(bool& mustReleaseLock) 616 void AudioContext::lock(bool& mustReleaseLock)
616 { 617 {
617 // Don't allow regular lock in real-time audio thread. 618 // Don't allow regular lock in real-time audio thread.
618 ASSERT(isMainThread()); 619 ASSERT(isMainThread());
619 620
620 ThreadIdentifier thisThread = currentThread(); 621 ThreadIdentifier thisThread = currentThread();
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
734 if (mustReleaseLock) 735 if (mustReleaseLock)
735 unlock(); 736 unlock();
736 } 737 }
737 } 738 }
738 739
739 void AudioContext::handleDeferredFinishDerefs() 740 void AudioContext::handleDeferredFinishDerefs()
740 { 741 {
741 ASSERT(isAudioThread() && isGraphOwner()); 742 ASSERT(isAudioThread() && isGraphOwner());
742 for (unsigned i = 0; i < m_deferredFinishDerefList.size(); ++i) { 743 for (unsigned i = 0; i < m_deferredFinishDerefList.size(); ++i) {
743 AudioNode* node = m_deferredFinishDerefList[i]; 744 AudioNode* node = m_deferredFinishDerefList[i];
744 node->finishDeref(); 745 node->finishDeref(AudioNode::RefTypeConnection);
745 } 746 }
746 747
747 m_deferredFinishDerefList.clear(); 748 m_deferredFinishDerefList.clear();
748 } 749 }
749 750
750 void AudioContext::markForDeletion(AudioNode* node) 751 void AudioContext::markForDeletion(AudioNode* node)
751 { 752 {
752 ASSERT(isGraphOwner()); 753 ASSERT(isGraphOwner());
753 754
754 if (!isInitialized()) 755 if (!isInitialized())
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
954 visitor->trace(m_renderTarget); 955 visitor->trace(m_renderTarget);
955 visitor->trace(m_destinationNode); 956 visitor->trace(m_destinationNode);
956 visitor->trace(m_listener); 957 visitor->trace(m_listener);
957 visitor->trace(m_dirtySummingJunctions); 958 visitor->trace(m_dirtySummingJunctions);
958 EventTargetWithInlineData::trace(visitor); 959 EventTargetWithInlineData::trace(visitor);
959 } 960 }
960 961
961 } // namespace WebCore 962 } // namespace WebCore
962 963
963 #endif // ENABLE(WEB_AUDIO) 964 #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