| Index: third_party/WebKit/Source/core/html/AutoplayUmaHelper.h
|
| diff --git a/third_party/WebKit/Source/core/html/AutoplayUmaHelper.h b/third_party/WebKit/Source/core/html/AutoplayUmaHelper.h
|
| index 7dda64bb56d55bc2b799c5290a8a9b9f2c420e88..706dd56183f0ea03aad7098bc37ec2557184ecfc 100644
|
| --- a/third_party/WebKit/Source/core/html/AutoplayUmaHelper.h
|
| +++ b/third_party/WebKit/Source/core/html/AutoplayUmaHelper.h
|
| @@ -5,6 +5,8 @@
|
| #ifndef AutoplayUmaHelper_h
|
| #define AutoplayUmaHelper_h
|
|
|
| +#include "core/CoreExport.h"
|
| +#include "core/dom/ContextLifecycleObserver.h"
|
| #include "core/events/EventListener.h"
|
| #include "platform/heap/Handle.h"
|
|
|
| @@ -40,7 +42,10 @@ class Document;
|
| class ElementVisibilityObserver;
|
| class HTMLMediaElement;
|
|
|
| -class AutoplayUmaHelper final : public EventListener {
|
| +class CORE_EXPORT AutoplayUmaHelper : public EventListener,
|
| + public ContextLifecycleObserver {
|
| + USING_GARBAGE_COLLECTED_MIXIN(AutoplayUmaHelper);
|
| +
|
| public:
|
| static AutoplayUmaHelper* create(HTMLMediaElement*);
|
|
|
| @@ -48,6 +53,8 @@ class AutoplayUmaHelper final : public EventListener {
|
|
|
| bool operator==(const EventListener&) const override;
|
|
|
| + void contextDestroyed() override;
|
| +
|
| void onAutoplayInitiated(AutoplaySource);
|
|
|
| void recordAutoplayUnmuteStatus(AutoplayUnmuteActionStatus);
|
| @@ -61,15 +68,15 @@ class AutoplayUmaHelper final : public EventListener {
|
| DECLARE_VIRTUAL_TRACE();
|
|
|
| private:
|
| - explicit AutoplayUmaHelper(HTMLMediaElement*);
|
| + friend class MockAutoplayUmaHelper;
|
|
|
| + explicit AutoplayUmaHelper(HTMLMediaElement*);
|
| void handleEvent(ExecutionContext*, Event*) override;
|
| -
|
| void handlePlayingEvent();
|
| void handlePauseEvent();
|
| - void handleUnloadEvent();
|
| + virtual void handleContextDestroyed(); // Make virtual for testing.
|
|
|
| - void maybeUnregisterUnloadListener();
|
| + void maybeUnregisterContextDestroyedObserver();
|
|
|
| void maybeStartRecordingMutedVideoPlayMethodBecomeVisible();
|
| void maybeStopRecordingMutedVideoPlayMethodBecomeVisible(bool isVisible);
|
| @@ -80,7 +87,7 @@ class AutoplayUmaHelper final : public EventListener {
|
| void onVisibilityChangedForMutedVideoOffscreenDuration(bool isVisibile);
|
| void onVisibilityChangedForMutedVideoPlayMethodBecomeVisible(bool isVisible);
|
|
|
| - bool shouldListenToUnloadEvent() const;
|
| + bool shouldListenToContextDestroyed() const;
|
|
|
| // The autoplay source. Use AutoplaySource::NumberOfSources for invalid
|
| // source.
|
|
|