| 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..8b6bb384b720957c9b74d0fd5b8349e66111473b 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 requires a user gesture.
|
| + void maybeRecordStartAttempt();
|
| +
|
| protected:
|
| explicit BaseAudioContext(Document*);
|
| BaseAudioContext(Document*,
|
| @@ -340,6 +346,23 @@ 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 {
|
| + // The AudioContext failed to activate because of user gesture requirements.
|
| + AutoplayStatusFailed = 0,
|
| + // Same as AutoplayStatusFailed but start() on a node was called with a user
|
| + // gesture.
|
| + AutoplayStatusFailedWithStart = 1,
|
| + // The AudioContext had user gesture requirements and was able to activate
|
| + // with a user gesture.
|
| + AutoplayStatusSucceeded = 2,
|
| +
|
| + // Keep at the end.
|
| + AutoplayStatusCount
|
| + };
|
| +
|
| bool m_isCleared;
|
| void clear();
|
|
|
| @@ -381,6 +404,9 @@ class MODULES_EXPORT BaseAudioContext : public EventTargetWithInlineData,
|
| // resolvers.
|
| virtual void rejectPendingResolvers();
|
|
|
| + // Record the current autoplay status and clear it.
|
| + 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 +446,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
|
|
|