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

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

Issue 2840943002: Update DEBUG_AUDIONODE_REFERENCES to new coding style (Closed)
Patch Set: Turn off flag Created 3 years, 8 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
« no previous file with comments | « no previous file | third_party/WebKit/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 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "modules/webaudio/AudioContext.h" 5 #include "modules/webaudio/AudioContext.h"
6 6
7 #include "bindings/core/v8/ExceptionMessages.h" 7 #include "bindings/core/v8/ExceptionMessages.h"
8 #include "bindings/core/v8/ExceptionState.h" 8 #include "bindings/core/v8/ExceptionState.h"
9 #include "bindings/core/v8/ScriptPromiseResolver.h" 9 #include "bindings/core/v8/ScriptPromiseResolver.h"
10 #include "core/dom/DOMException.h" 10 #include "core/dom/DOMException.h"
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 // startRendering() call from JavaScript. We may want to consider 83 // startRendering() call from JavaScript. We may want to consider
84 // requiring it for symmetry with OfflineAudioContext. 84 // requiring it for symmetry with OfflineAudioContext.
85 audio_context->MaybeUnlockUserGesture(); 85 audio_context->MaybeUnlockUserGesture();
86 if (audio_context->IsAllowedToStart()) { 86 if (audio_context->IsAllowedToStart()) {
87 audio_context->StartRendering(); 87 audio_context->StartRendering();
88 audio_context->SetContextState(kRunning); 88 audio_context->SetContextState(kRunning);
89 } 89 }
90 ++g_hardware_context_count; 90 ++g_hardware_context_count;
91 #if DEBUG_AUDIONODE_REFERENCES 91 #if DEBUG_AUDIONODE_REFERENCES
92 fprintf(stderr, "[%16p]: AudioContext::AudioContext(): %u #%u\n", 92 fprintf(stderr, "[%16p]: AudioContext::AudioContext(): %u #%u\n",
93 audioContext, audioContext->m_contextId, s_hardwareContextCount); 93 audio_context, audio_context->context_id_, g_hardware_context_count);
94 #endif 94 #endif
95 95
96 DEFINE_STATIC_LOCAL(SparseHistogram, max_channel_count_histogram, 96 DEFINE_STATIC_LOCAL(SparseHistogram, max_channel_count_histogram,
97 ("WebAudio.AudioContext.MaxChannelsAvailable")); 97 ("WebAudio.AudioContext.MaxChannelsAvailable"));
98 DEFINE_STATIC_LOCAL(SparseHistogram, sample_rate_histogram, 98 DEFINE_STATIC_LOCAL(SparseHistogram, sample_rate_histogram,
99 ("WebAudio.AudioContext.HardwareSampleRate")); 99 ("WebAudio.AudioContext.HardwareSampleRate"));
100 max_channel_count_histogram.Sample( 100 max_channel_count_histogram.Sample(
101 audio_context->destination()->maxChannelCount()); 101 audio_context->destination()->maxChannelCount());
102 sample_rate_histogram.Sample(audio_context->sampleRate()); 102 sample_rate_histogram.Sample(audio_context->sampleRate());
103 103
104 return audio_context; 104 return audio_context;
105 } 105 }
106 106
107 AudioContext::AudioContext(Document& document, 107 AudioContext::AudioContext(Document& document,
108 const WebAudioLatencyHint& latency_hint) 108 const WebAudioLatencyHint& latency_hint)
109 : BaseAudioContext(&document), context_id_(g_context_id++) { 109 : BaseAudioContext(&document), context_id_(g_context_id++) {
110 destination_node_ = DefaultAudioDestinationNode::Create(this, latency_hint); 110 destination_node_ = DefaultAudioDestinationNode::Create(this, latency_hint);
111 Initialize(); 111 Initialize();
112 } 112 }
113 113
114 AudioContext::~AudioContext() { 114 AudioContext::~AudioContext() {
115 #if DEBUG_AUDIONODE_REFERENCES 115 #if DEBUG_AUDIONODE_REFERENCES
116 fprintf(stderr, "[%16p]: AudioContext::~AudioContext(): %u\n", this, 116 fprintf(stderr, "[%16p]: AudioContext::~AudioContext(): %u\n", this,
117 m_contextId); 117 context_id_);
118 #endif 118 #endif
119 } 119 }
120 120
121 DEFINE_TRACE(AudioContext) { 121 DEFINE_TRACE(AudioContext) {
122 visitor->Trace(close_resolver_); 122 visitor->Trace(close_resolver_);
123 BaseAudioContext::Trace(visitor); 123 BaseAudioContext::Trace(visitor);
124 } 124 }
125 125
126 ScriptPromise AudioContext::suspendContext(ScriptState* script_state) { 126 ScriptPromise AudioContext::suspendContext(ScriptState* script_state) {
127 DCHECK(IsMainThread()); 127 DCHECK(IsMainThread());
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 SetContextState(kSuspended); 264 SetContextState(kSuspended);
265 GetDeferredTaskHandler().ClearHandlersToBeDeleted(); 265 GetDeferredTaskHandler().ClearHandlersToBeDeleted();
266 } 266 }
267 } 267 }
268 268
269 double AudioContext::baseLatency() const { 269 double AudioContext::baseLatency() const {
270 return FramesPerBuffer() / static_cast<double>(sampleRate()); 270 return FramesPerBuffer() / static_cast<double>(sampleRate());
271 } 271 }
272 272
273 } // namespace blink 273 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/modules/webaudio/AudioNode.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698