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

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: 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
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) 38 , m_didCallDispose(false)
39 { 39 {
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 } 40 }
49 41
50 AudioSummingJunction::~AudioSummingJunction() 42 AudioSummingJunction::~AudioSummingJunction()
51 { 43 {
52 } 44 m_didCallDispose = true;
haraken 2015/03/25 12:34:48 I guess m_didCallDispose is no longer helpful.
tkent 2015/03/25 22:28:08 Right. Will remove it.
53 45 deferredTaskHandler().removeMarkedSummingJunction(this);
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 } 46 }
63 47
64 void AudioSummingJunction::changedOutputs() 48 void AudioSummingJunction::changedOutputs()
65 { 49 {
66 ASSERT(context()->isGraphOwner()); 50 ASSERT(deferredTaskHandler().isGraphOwner());
67 if (!m_renderingStateNeedUpdating && !m_didCallDispose) { 51 if (!m_renderingStateNeedUpdating && !m_didCallDispose) {
68 context()->handler().markSummingJunctionDirty(this); 52 deferredTaskHandler().markSummingJunctionDirty(this);
69 m_renderingStateNeedUpdating = true; 53 m_renderingStateNeedUpdating = true;
70 } 54 }
71 } 55 }
72 56
73 void AudioSummingJunction::updateRenderingState() 57 void AudioSummingJunction::updateRenderingState()
74 { 58 {
75 ASSERT(context()->isAudioThread()); 59 ASSERT(deferredTaskHandler().isAudioThread());
76 ASSERT(context()->isGraphOwner()); 60 ASSERT(deferredTaskHandler().isGraphOwner());
77 if (m_renderingStateNeedUpdating) { 61 if (m_renderingStateNeedUpdating) {
78 // Copy from m_outputs to m_renderingOutputs. 62 // Copy from m_outputs to m_renderingOutputs.
79 m_renderingOutputs.resize(m_outputs.size()); 63 m_renderingOutputs.resize(m_outputs.size());
80 unsigned j = 0; 64 unsigned j = 0;
81 for (AudioNodeOutput* output : m_outputs) { 65 for (AudioNodeOutput* output : m_outputs) {
82 m_renderingOutputs[j++] = output; 66 m_renderingOutputs[j++] = output;
83 output->updateRenderingState(); 67 output->updateRenderingState();
84 } 68 }
85 69
86 didUpdate(); 70 didUpdate();
87 71
88 m_renderingStateNeedUpdating = false; 72 m_renderingStateNeedUpdating = false;
89 } 73 }
90 } 74 }
91 75
92 } // namespace blink 76 } // namespace blink
93 77
94 #endif // ENABLE(WEB_AUDIO) 78 #endif // ENABLE(WEB_AUDIO)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698