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

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

Issue 1978403004: Add UMA histograms for WebAudio (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use CustomCountHistogram Created 4 years, 6 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
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"
11 #include "core/dom/ExceptionCode.h" 11 #include "core/dom/ExceptionCode.h"
12 #include "modules/webaudio/AudioBufferCallback.h" 12 #include "modules/webaudio/AudioBufferCallback.h"
13 #include "platform/Histogram.h"
13 #include "platform/audio/AudioUtilities.h" 14 #include "platform/audio/AudioUtilities.h"
14 15
15 #if DEBUG_AUDIONODE_REFERENCES 16 #if DEBUG_AUDIONODE_REFERENCES
16 #include <stdio.h> 17 #include <stdio.h>
17 #endif 18 #endif
18 19
19 namespace blink { 20 namespace blink {
20 21
21 // Don't allow more than this number of simultaneous AudioContexts 22 // Don't allow more than this number of simultaneous AudioContexts
22 // talking to hardware. 23 // talking to hardware.
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 // quantum". NOTE: for now AudioContext does not need an explicit 60 // quantum". NOTE: for now AudioContext does not need an explicit
60 // startRendering() call from JavaScript. We may want to consider 61 // startRendering() call from JavaScript. We may want to consider
61 // requiring it for symmetry with OfflineAudioContext. 62 // requiring it for symmetry with OfflineAudioContext.
62 audioContext->startRendering(); 63 audioContext->startRendering();
63 ++s_hardwareContextCount; 64 ++s_hardwareContextCount;
64 #if DEBUG_AUDIONODE_REFERENCES 65 #if DEBUG_AUDIONODE_REFERENCES
65 fprintf(stderr, "%p: AudioContext::AudioContext(): %u #%u\n", 66 fprintf(stderr, "%p: AudioContext::AudioContext(): %u #%u\n",
66 audioContext, audioContext->m_contextId, s_hardwareContextCount); 67 audioContext, audioContext->m_contextId, s_hardwareContextCount);
67 #endif 68 #endif
68 69
70 DEFINE_STATIC_LOCAL(SparseHistogram, maxChannelCountHistogram,
71 ("WebAudio.AudioContext.MaxChannelsAvailable"));
72 DEFINE_STATIC_LOCAL(SparseHistogram, sampleRateHistogram,
73 ("WebAudio.AudioContext.HardwareSampleRate"));
Mark P 2016/06/10 04:02:53 Is this generally fixed or should this be a custom
Raymond Toy 2016/06/10 15:13:44 We expect the possible values for the hardware sam
74 maxChannelCountHistogram.sample(audioContext->destination()->maxChannelCount ());
75 sampleRateHistogram.sample(audioContext->sampleRate());
76
69 return audioContext; 77 return audioContext;
70 } 78 }
71 79
72 AudioContext::AudioContext(Document& document) 80 AudioContext::AudioContext(Document& document)
73 : AbstractAudioContext(&document) 81 : AbstractAudioContext(&document)
74 , m_contextId(s_contextId++) 82 , m_contextId(s_contextId++)
75 { 83 {
76 } 84 }
77 85
78 AudioContext::~AudioContext() 86 AudioContext::~AudioContext()
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 ASSERT(destination()); 201 ASSERT(destination());
194 202
195 if (contextState() == Running) { 203 if (contextState() == Running) {
196 destination()->audioDestinationHandler().stopRendering(); 204 destination()->audioDestinationHandler().stopRendering();
197 setContextState(Suspended); 205 setContextState(Suspended);
198 deferredTaskHandler().clearHandlersToBeDeleted(); 206 deferredTaskHandler().clearHandlersToBeDeleted();
199 } 207 }
200 } 208 }
201 209
202 } // namespace blink 210 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698