Chromium Code Reviews| Index: third_party/WebKit/Source/modules/webaudio/BaseAudioContext.h |
| diff --git a/third_party/WebKit/Source/modules/webaudio/BaseAudioContext.h b/third_party/WebKit/Source/modules/webaudio/BaseAudioContext.h |
| index aa2c5f8b54237da92aaa41b11396e1e9d9880e97..b20366804aef02c442a5a4625ae6f4f916b4d417 100644 |
| --- a/third_party/WebKit/Source/modules/webaudio/BaseAudioContext.h |
| +++ b/third_party/WebKit/Source/modules/webaudio/BaseAudioContext.h |
| @@ -54,6 +54,7 @@ class AudioBufferCallback; |
| class AudioBufferSourceNode; |
| class AudioListener; |
| class AudioSummingJunction; |
| +class BaseAudioContextTest; |
| class BiquadFilterNode; |
| class ChannelMergerNode; |
| class ChannelSplitterNode; |
| @@ -297,6 +298,11 @@ class MODULES_EXPORT BaseAudioContext : public EventTargetWithInlineData, |
| // initialized internally if necessary. |
| PeriodicWave* periodicWave(int type); |
| + // For metrics purpose, records when start() is called on a |
| + // AudioScheduledSourceHandler or a AudioBufferSourceHandler without a user |
| + // gesture while the AudioContext is locked. |
| + void maybeRecordStartAttempt(); |
| + |
| protected: |
| explicit BaseAudioContext(Document*); |
| BaseAudioContext(Document*, |
| @@ -340,6 +346,18 @@ class MODULES_EXPORT BaseAudioContext : public EventTargetWithInlineData, |
| bool isAllowedToStart() const; |
| private: |
| + friend class BaseAudioContextTest; |
| + |
| + // Do not change the order of this enum, it is used for metrics. |
| + enum AutoplayStatus { |
|
Raymond Toy
2016/10/10 17:05:10
"AutoPlay" or "Autoplay"? If you had written compl
mlamouri (slow - plz ping)
2016/10/10 18:44:40
We use "autoplay" in one word in Chrome (and most
|
| + AutoplayStatusFailed = 0, |
|
Raymond Toy
2016/10/10 17:05:10
This doesn't seem to quite match the histogram enu
mlamouri (slow - plz ping)
2016/10/10 18:44:40
Sorry about this, I forgot to update the histogram
|
| + AutoplayStatusFailedWithStart = 1, |
| + AutoplayStatusSucceeded = 3, |
|
Raymond Toy
2016/10/10 17:05:10
Why 3 and not 2?
Plus, this doesn't match the his
mlamouri (slow - plz ping)
2016/10/10 18:44:40
Oups. Same cause, I changed histograms and forgot
|
| + |
| + // Keep at the end. |
| + AutoplayStatusCount |
| + }; |
| + |
| bool m_isCleared; |
| void clear(); |
| @@ -381,6 +399,9 @@ class MODULES_EXPORT BaseAudioContext : public EventTargetWithInlineData, |
| // resolvers. |
| virtual void rejectPendingResolvers(); |
| + // Record the current autoplay status and clear it. |
|
Raymond Toy
2016/10/10 17:05:10
It seems this is intended to be called only when t
|
| + void recordAutoplayStatus(); |
| + |
| // True if we're in the process of resolving promises for resume(). Resolving |
| // can take some time and the audio context process loop is very fast, so we |
| // don't want to call resolve an excessive number of times. |
| @@ -420,6 +441,8 @@ class MODULES_EXPORT BaseAudioContext : public EventTargetWithInlineData, |
| // This is considering 32 is large enough for multiple channels audio. |
| // It is somewhat arbitrary and could be increased if necessary. |
| enum { MaxNumberOfChannels = 32 }; |
| + |
| + Optional<AutoplayStatus> m_autoplayStatus; |
| }; |
| } // namespace blink |