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

Side by Side Diff: third_party/WebKit/Source/core/html/AutoplayUmaHelper.h

Issue 2341783002: Fix an AutoplayUmaHelper crash (Closed)
Patch Set: Created 4 years, 3 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/core/html/AutoplayUmaHelper.cpp » ('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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 #ifndef AutoplayUmaHelper_h 5 #ifndef AutoplayUmaHelper_h
6 #define AutoplayUmaHelper_h 6 #define AutoplayUmaHelper_h
7 7
8 #include "core/events/EventListener.h" 8 #include "core/events/EventListener.h"
9 #include "platform/heap/Handle.h" 9 #include "platform/heap/Handle.h"
10 10
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 void maybeStopRecordingMutedVideoOffscreenDuration(); 74 void maybeStopRecordingMutedVideoOffscreenDuration();
75 75
76 void onVisibilityChangedForMutedVideoOffscreenDuration(bool isVisibile); 76 void onVisibilityChangedForMutedVideoOffscreenDuration(bool isVisibile);
77 void onVisibilityChangedForMutedVideoPlayMethodBecomeVisible(bool isVisible) ; 77 void onVisibilityChangedForMutedVideoPlayMethodBecomeVisible(bool isVisible) ;
78 78
79 bool shouldListenToUnloadEvent() const; 79 bool shouldListenToUnloadEvent() const;
80 80
81 // The autoplay source. Use AutoplaySource::NumberOfSources for invalid sour ce. 81 // The autoplay source. Use AutoplaySource::NumberOfSources for invalid sour ce.
82 AutoplaySource m_source; 82 AutoplaySource m_source;
83 // The media element this UMA helper is attached to. |m_element| owns |this| . 83 // The media element this UMA helper is attached to. |m_element| owns |this| .
84 WeakMember<HTMLMediaElement> m_element; 84 Member<HTMLMediaElement> m_element;
85 85
86 // The observer is used to observe whether a muted video autoplaying by play () 86 // The observer is used to observe whether a muted video autoplaying by play ()
87 // method become visible at some point. 87 // method become visible at some point.
88 // The UMA is pending for recording as long as this observer is non-null. 88 // The UMA is pending for recording as long as this observer is non-null.
89 Member<ElementVisibilityObserver> m_mutedVideoPlayMethodVisibilityObserver; 89 Member<ElementVisibilityObserver> m_mutedVideoPlayMethodVisibilityObserver;
90 90
91 // ----------------------------------------------------------------------- 91 // -----------------------------------------------------------------------
92 // Variables used for recording the duration of autoplay muted video playing offscreen. 92 // Variables used for recording the duration of autoplay muted video playing offscreen.
93 // The variables are valid when |m_autoplayOffscrenVisibilityObserver| is no n-null. 93 // The variables are valid when |m_autoplayOffscrenVisibilityObserver| is no n-null.
94 // The recording stops whenever the playback pauses or the page is unloaded. 94 // The recording stops whenever the playback pauses or the page is unloaded.
95 95
96 // The starting time of autoplaying muted video. 96 // The starting time of autoplaying muted video.
97 int64_t m_mutedVideoAutoplayOffscreenStartTimeMS; 97 int64_t m_mutedVideoAutoplayOffscreenStartTimeMS;
98 98
99 // The duration an autoplaying muted video has been in offscreen. 99 // The duration an autoplaying muted video has been in offscreen.
100 int64_t m_mutedVideoAutoplayOffscreenDurationMS; 100 int64_t m_mutedVideoAutoplayOffscreenDurationMS;
101 101
102 // Whether an autoplaying muted video is visible. 102 // Whether an autoplaying muted video is visible.
103 bool m_isVisible; 103 bool m_isVisible;
104 104
105 // The observer is used to observer an autoplaying muted video changing it's visibility, 105 // The observer is used to observer an autoplaying muted video changing it's visibility,
106 // which is used for offscreen duration UMA. 106 // which is used for offscreen duration UMA.
107 // The UMA is pending for recording as long as this observer is non-null. 107 // The UMA is pending for recording as long as this observer is non-null.
108 Member<ElementVisibilityObserver> m_mutedVideoOffscreenDurationVisibilityObs erver; 108 Member<ElementVisibilityObserver> m_mutedVideoOffscreenDurationVisibilityObs erver;
109 }; 109 };
110 110
111 } // namespace blink 111 } // namespace blink
112 112
113 #endif // AutoplayUmaHelper_h 113 #endif // AutoplayUmaHelper_h
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/html/AutoplayUmaHelper.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698