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

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

Issue 455353002: Add an ASSERT to verify that AudioNode::dispose() is always called (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 4 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
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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 , m_context(context) 51 , m_context(context)
52 , m_sampleRate(sampleRate) 52 , m_sampleRate(sampleRate)
53 , m_lastProcessingTime(-1) 53 , m_lastProcessingTime(-1)
54 , m_lastNonSilentTime(-1) 54 , m_lastNonSilentTime(-1)
55 #if !ENABLE(OILPAN) 55 #if !ENABLE(OILPAN)
56 , m_normalRefCount(1) // start out with normal refCount == 1 (like WTF::RefC ounted class) 56 , m_normalRefCount(1) // start out with normal refCount == 1 (like WTF::RefC ounted class)
57 #endif 57 #endif
58 , m_connectionRefCount(0) 58 , m_connectionRefCount(0)
59 , m_isMarkedForDeletion(false) 59 , m_isMarkedForDeletion(false)
60 , m_isDisabled(false) 60 , m_isDisabled(false)
61 #ifndef NDEBUG
tkent 2014/08/11 10:13:06 #if ENABLE(ASSERT)
haraken 2014/08/11 10:32:59 Done.
62 , m_disposeIsCalled(false)
63 #endif
61 , m_channelCount(2) 64 , m_channelCount(2)
62 , m_channelCountMode(Max) 65 , m_channelCountMode(Max)
63 , m_channelInterpretation(AudioBus::Speakers) 66 , m_channelInterpretation(AudioBus::Speakers)
64 { 67 {
65 ScriptWrappable::init(this); 68 ScriptWrappable::init(this);
66 #if ENABLE(OILPAN) 69 #if ENABLE(OILPAN)
67 m_context->registerLiveNode(*this); 70 m_context->registerLiveNode(*this);
68 #endif 71 #endif
69 #if DEBUG_AUDIONODE_REFERENCES 72 #if DEBUG_AUDIONODE_REFERENCES
70 if (!s_isNodeCountInitialized) { 73 if (!s_isNodeCountInitialized) {
71 s_isNodeCountInitialized = true; 74 s_isNodeCountInitialized = true;
72 atexit(AudioNode::printNodeCounts); 75 atexit(AudioNode::printNodeCounts);
73 } 76 }
74 #endif 77 #endif
75 ++s_instanceCount; 78 ++s_instanceCount;
76 } 79 }
77 80
78 AudioNode::~AudioNode() 81 AudioNode::~AudioNode()
79 { 82 {
83 ASSERT(m_disposeIsCalled);
80 --s_instanceCount; 84 --s_instanceCount;
81 #if DEBUG_AUDIONODE_REFERENCES 85 #if DEBUG_AUDIONODE_REFERENCES
82 --s_nodeCount[nodeType()]; 86 --s_nodeCount[nodeType()];
83 #if ENABLE(OILPAN) 87 #if ENABLE(OILPAN)
84 fprintf(stderr, "%p: %d: AudioNode::~AudioNode() %d\n", this, nodeType(), m_ connectionRefCount); 88 fprintf(stderr, "%p: %d: AudioNode::~AudioNode() %d\n", this, nodeType(), m_ connectionRefCount);
85 #else 89 #else
86 fprintf(stderr, "%p: %d: AudioNode::~AudioNode() %d %d\n", this, nodeType(), m_normalRefCount, m_connectionRefCount); 90 fprintf(stderr, "%p: %d: AudioNode::~AudioNode() %d %d\n", this, nodeType(), m_normalRefCount, m_connectionRefCount);
87 #endif 91 #endif
88 #endif 92 #endif
89 } 93 }
(...skipping 12 matching lines...) Expand all
102 { 106 {
103 ASSERT(isMainThread()); 107 ASSERT(isMainThread());
104 ASSERT(context()->isGraphOwner()); 108 ASSERT(context()->isGraphOwner());
105 #if ENABLE(OILPAN) 109 #if ENABLE(OILPAN)
106 context()->removeAutomaticPullNode(this); 110 context()->removeAutomaticPullNode(this);
107 for (unsigned i = 0; i < m_outputs.size(); ++i) 111 for (unsigned i = 0; i < m_outputs.size(); ++i)
108 output(i)->disconnectAll(); 112 output(i)->disconnectAll();
109 m_isMarkedForDeletion = true; 113 m_isMarkedForDeletion = true;
110 #endif 114 #endif
111 context()->unmarkDirtyNode(*this); 115 context()->unmarkDirtyNode(*this);
116 #ifndef NDEBUG
tkent 2014/08/11 10:13:06 Ditto.
117 m_disposeIsCalled = true;
118 #endif
112 } 119 }
113 120
114 String AudioNode::nodeTypeName() const 121 String AudioNode::nodeTypeName() const
115 { 122 {
116 switch (m_nodeType) { 123 switch (m_nodeType) {
117 case NodeTypeDestination: 124 case NodeTypeDestination:
118 return "AudioDestinationNode"; 125 return "AudioDestinationNode";
119 case NodeTypeOscillator: 126 case NodeTypeOscillator:
120 return "OscillatorNode"; 127 return "OscillatorNode";
121 case NodeTypeAudioBufferSource: 128 case NodeTypeAudioBufferSource:
(...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after
639 { 646 {
640 visitor->trace(m_context); 647 visitor->trace(m_context);
641 visitor->trace(m_inputs); 648 visitor->trace(m_inputs);
642 visitor->trace(m_outputs); 649 visitor->trace(m_outputs);
643 EventTargetWithInlineData::trace(visitor); 650 EventTargetWithInlineData::trace(visitor);
644 } 651 }
645 652
646 } // namespace blink 653 } // namespace blink
647 654
648 #endif // ENABLE(WEB_AUDIO) 655 #endif // ENABLE(WEB_AUDIO)
OLDNEW
« Source/modules/webaudio/AudioNode.h ('K') | « Source/modules/webaudio/AudioNode.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698