OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012, Google Inc. All rights reserved. | 2 * Copyright (C) 2012, 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 19 matching lines...) Expand all Loading... |
30 #include "wtf/HashSet.h" | 30 #include "wtf/HashSet.h" |
31 #include "wtf/Vector.h" | 31 #include "wtf/Vector.h" |
32 | 32 |
33 namespace blink { | 33 namespace blink { |
34 | 34 |
35 class AudioContext; | 35 class AudioContext; |
36 class AudioNodeOutput; | 36 class AudioNodeOutput; |
37 | 37 |
38 // An AudioSummingJunction represents a point where zero, one, or more AudioNode
Outputs connect. | 38 // An AudioSummingJunction represents a point where zero, one, or more AudioNode
Outputs connect. |
39 | 39 |
40 class AudioSummingJunction : public NoBaseWillBeGarbageCollectedFinalized<AudioS
ummingJunction> { | 40 class AudioSummingJunction : public GarbageCollectedFinalized<AudioSummingJuncti
on> { |
41 public: | 41 public: |
42 virtual ~AudioSummingJunction(); | 42 virtual ~AudioSummingJunction(); |
43 virtual void trace(Visitor*); | 43 virtual void trace(Visitor*); |
44 | 44 |
45 // Can be called from any thread. | 45 // Can be called from any thread. |
46 AudioContext* context() { return m_context.get(); } | 46 AudioContext* context() { return m_context.get(); } |
47 | 47 |
48 // This must be called whenever we modify m_outputs. | 48 // This must be called whenever we modify m_outputs. |
49 void changedOutputs(); | 49 void changedOutputs(); |
50 | 50 |
51 // This copies m_outputs to m_renderingOutputs. Please see comments for thes
e lists below. | 51 // This copies m_outputs to m_renderingOutputs. Please see comments for thes
e lists below. |
52 // This must be called when we own the context's graph lock in the audio thr
ead at the very start or end of the render quantum. | 52 // This must be called when we own the context's graph lock in the audio thr
ead at the very start or end of the render quantum. |
53 void updateRenderingState(); | 53 void updateRenderingState(); |
54 | 54 |
55 // Rendering code accesses its version of the current connections here. | 55 // Rendering code accesses its version of the current connections here. |
56 unsigned numberOfRenderingConnections() const { return m_renderingOutputs.si
ze(); } | 56 unsigned numberOfRenderingConnections() const { return m_renderingOutputs.si
ze(); } |
57 AudioNodeOutput* renderingOutput(unsigned i) { return m_renderingOutputs[i];
} | 57 AudioNodeOutput* renderingOutput(unsigned i) { return m_renderingOutputs[i];
} |
58 bool isConnected() const { return numberOfRenderingConnections() > 0; } | 58 bool isConnected() const { return numberOfRenderingConnections() > 0; } |
59 | 59 |
60 virtual bool canUpdateState() = 0; | 60 virtual bool canUpdateState() = 0; |
61 virtual void didUpdate() = 0; | 61 virtual void didUpdate() = 0; |
62 | 62 |
63 protected: | 63 protected: |
64 explicit AudioSummingJunction(AudioContext*); | 64 explicit AudioSummingJunction(AudioContext*); |
65 | 65 |
66 RefPtrWillBeMember<AudioContext> m_context; | 66 Member<AudioContext> m_context; |
67 | 67 |
68 // m_outputs contains the AudioNodeOutputs representing current connections
which are not disabled. | 68 // m_outputs contains the AudioNodeOutputs representing current connections
which are not disabled. |
69 // The rendering code should never use this directly, but instead uses m_ren
deringOutputs. | 69 // The rendering code should never use this directly, but instead uses m_ren
deringOutputs. |
70 // Oilpan: Since items are added to the hash set by the audio thread (not re
gistered to Oilpan), | 70 // Oilpan: Since items are added to the hash set by the audio thread (not re
gistered to Oilpan), |
71 // we cannot use a HeapHashSet. | 71 // we cannot use a HeapHashSet. |
| 72 GC_PLUGIN_IGNORE("http://crbug.com/404527") |
72 HashSet<AudioNodeOutput*> m_outputs; | 73 HashSet<AudioNodeOutput*> m_outputs; |
73 | 74 |
74 // m_renderingOutputs is a copy of m_outputs which will never be modified du
ring the graph rendering on the audio thread. | 75 // m_renderingOutputs is a copy of m_outputs which will never be modified du
ring the graph rendering on the audio thread. |
75 // This is the list which is used by the rendering code. | 76 // This is the list which is used by the rendering code. |
76 // Whenever m_outputs is modified, the context is told so it can later updat
e m_renderingOutputs from m_outputs at a safe time. | 77 // Whenever m_outputs is modified, the context is told so it can later updat
e m_renderingOutputs from m_outputs at a safe time. |
77 // Most of the time, m_renderingOutputs is identical to m_outputs. | 78 // Most of the time, m_renderingOutputs is identical to m_outputs. |
78 // Oilpan: Since items are added to the vector by the audio thread (not regi
stered to Oilpan), | 79 // Oilpan: Since items are added to the vector by the audio thread (not regi
stered to Oilpan), |
79 // we cannot use a HeapVector. | 80 // we cannot use a HeapVector. |
| 81 GC_PLUGIN_IGNORE("http://crbug.com/404527") |
80 Vector<AudioNodeOutput*> m_renderingOutputs; | 82 Vector<AudioNodeOutput*> m_renderingOutputs; |
81 | 83 |
82 // m_renderingStateNeedUpdating keeps track if m_outputs is modified. | 84 // m_renderingStateNeedUpdating keeps track if m_outputs is modified. |
83 bool m_renderingStateNeedUpdating; | 85 bool m_renderingStateNeedUpdating; |
84 }; | 86 }; |
85 | 87 |
86 } // namespace blink | 88 } // namespace blink |
87 | 89 |
88 #endif // AudioSummingJunction_h | 90 #endif // AudioSummingJunction_h |
OLD | NEW |