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

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

Issue 1037683002: Web Audio: Unapply Oilpan to AudioSummingJunction. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Remove m_didCallDispose Created 5 years, 9 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/AudioSummingJunction.h ('k') | no next file » | 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) 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 14 matching lines...) Expand all
25 #include "config.h" 25 #include "config.h"
26 #if ENABLE(WEB_AUDIO) 26 #if ENABLE(WEB_AUDIO)
27 #include "modules/webaudio/AudioSummingJunction.h" 27 #include "modules/webaudio/AudioSummingJunction.h"
28 28
29 #include "modules/webaudio/AudioContext.h" 29 #include "modules/webaudio/AudioContext.h"
30 #include "modules/webaudio/AudioNodeOutput.h" 30 #include "modules/webaudio/AudioNodeOutput.h"
31 #include <algorithm> 31 #include <algorithm>
32 32
33 namespace blink { 33 namespace blink {
34 34
35 AudioSummingJunction::AudioSummingJunction(AudioContext* context) 35 AudioSummingJunction::AudioSummingJunction(DeferredTaskHandler& handler)
36 : m_context(context) 36 : m_deferredTaskHandler(handler)
37 , m_renderingStateNeedUpdating(false) 37 , m_renderingStateNeedUpdating(false)
38 , m_didCallDispose(false)
39 { 38 {
40 ASSERT(context);
41 m_context->registerLiveAudioSummingJunction(*this);
42 }
43
44 void AudioSummingJunction::dispose()
45 {
46 m_didCallDispose = true;
47 m_context->handler().removeMarkedSummingJunction(this);
48 } 39 }
49 40
50 AudioSummingJunction::~AudioSummingJunction() 41 AudioSummingJunction::~AudioSummingJunction()
51 { 42 {
52 } 43 deferredTaskHandler().removeMarkedSummingJunction(this);
53
54 DEFINE_TRACE(AudioSummingJunction)
55 {
56 visitor->trace(m_context);
57 // FIXME: Oilpan: m_renderingOutputs should not be strong references. This
58 // is a short-term workaround to avoid crashes, and causes AudioNode leaks.
59 AudioContext::AutoLocker locker(m_context);
60 for (size_t i = 0; i < m_renderingOutputs.size(); ++i)
61 visitor->trace(m_renderingOutputs[i]);
62 } 44 }
63 45
64 void AudioSummingJunction::changedOutputs() 46 void AudioSummingJunction::changedOutputs()
65 { 47 {
66 ASSERT(context()->isGraphOwner()); 48 ASSERT(deferredTaskHandler().isGraphOwner());
67 if (!m_renderingStateNeedUpdating && !m_didCallDispose) { 49 if (!m_renderingStateNeedUpdating) {
68 context()->handler().markSummingJunctionDirty(this); 50 deferredTaskHandler().markSummingJunctionDirty(this);
69 m_renderingStateNeedUpdating = true; 51 m_renderingStateNeedUpdating = true;
70 } 52 }
71 } 53 }
72 54
73 void AudioSummingJunction::updateRenderingState() 55 void AudioSummingJunction::updateRenderingState()
74 { 56 {
75 ASSERT(context()->isAudioThread()); 57 ASSERT(deferredTaskHandler().isAudioThread());
76 ASSERT(context()->isGraphOwner()); 58 ASSERT(deferredTaskHandler().isGraphOwner());
77 if (m_renderingStateNeedUpdating) { 59 if (m_renderingStateNeedUpdating) {
78 // Copy from m_outputs to m_renderingOutputs. 60 // Copy from m_outputs to m_renderingOutputs.
79 m_renderingOutputs.resize(m_outputs.size()); 61 m_renderingOutputs.resize(m_outputs.size());
80 unsigned j = 0; 62 unsigned j = 0;
81 for (AudioNodeOutput* output : m_outputs) { 63 for (AudioNodeOutput* output : m_outputs) {
82 m_renderingOutputs[j++] = output; 64 m_renderingOutputs[j++] = output;
83 output->updateRenderingState(); 65 output->updateRenderingState();
84 } 66 }
85 67
86 didUpdate(); 68 didUpdate();
87 69
88 m_renderingStateNeedUpdating = false; 70 m_renderingStateNeedUpdating = false;
89 } 71 }
90 } 72 }
91 73
92 } // namespace blink 74 } // namespace blink
93 75
94 #endif // ENABLE(WEB_AUDIO) 76 #endif // ENABLE(WEB_AUDIO)
OLDNEW
« no previous file with comments | « Source/modules/webaudio/AudioSummingJunction.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698