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

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

Issue 2725873002: Media: fix memory leak because of the document holding on an EventListener. (Closed)
Patch Set: Created 3 years, 9 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 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 MediaControlsOrientationLockDelegate_h 5 #ifndef MediaControlsOrientationLockDelegate_h
6 #define MediaControlsOrientationLockDelegate_h 6 #define MediaControlsOrientationLockDelegate_h
7 7
8 #include "core/CoreExport.h" 8 #include "core/CoreExport.h"
9 #include "core/events/EventListener.h" 9 #include "core/events/EventListener.h"
10 #include "public/platform/modules/screen_orientation/WebScreenOrientationLockTyp e.h" 10 #include "public/platform/modules/screen_orientation/WebScreenOrientationLockTyp e.h"
(...skipping 28 matching lines...) Expand all
39 // - MaybeLockedFullscreen => PendingFullscreen: on fullscreenchange event 39 // - MaybeLockedFullscreen => PendingFullscreen: on fullscreenchange event
40 // (leaving fullscreen). 40 // (leaving fullscreen).
41 class CORE_EXPORT MediaControlsOrientationLockDelegate final 41 class CORE_EXPORT MediaControlsOrientationLockDelegate final
42 : public EventListener { 42 : public EventListener {
43 public: 43 public:
44 explicit MediaControlsOrientationLockDelegate(HTMLVideoElement&); 44 explicit MediaControlsOrientationLockDelegate(HTMLVideoElement&);
45 45
46 // EventListener implementation. 46 // EventListener implementation.
47 bool operator==(const EventListener&) const override; 47 bool operator==(const EventListener&) const override;
48 48
49 // Called by MediaControls when the HTMLMediaElement is no longer in the
50 // document. All event listeners on the document should be removed in order
51 // for the object to be ready for garbage collection.
52 void detach();
53
49 DECLARE_VIRTUAL_TRACE(); 54 DECLARE_VIRTUAL_TRACE();
50 55
51 private: 56 private:
52 friend class MediaControlsOrientationLockDelegateTest; 57 friend class MediaControlsOrientationLockDelegateTest;
53 58
54 enum class State { 59 enum class State {
55 PendingFullscreen, 60 PendingFullscreen,
56 PendingMetadata, 61 PendingMetadata,
57 MaybeLockedFullscreen, 62 MaybeLockedFullscreen,
58 }; 63 };
(...skipping 25 matching lines...) Expand all
84 // In other words, whether the orientation was locked. 89 // In other words, whether the orientation was locked.
85 bool m_shouldUnlockOrientation = false; 90 bool m_shouldUnlockOrientation = false;
86 91
87 // `m_videoElement` owns MediaControls that owns |this|. 92 // `m_videoElement` owns MediaControls that owns |this|.
88 Member<HTMLVideoElement> m_videoElement; 93 Member<HTMLVideoElement> m_videoElement;
89 }; 94 };
90 95
91 } // namespace blink 96 } // namespace blink
92 97
93 #endif // MediaControlsOrientationLockDelegate_h 98 #endif // MediaControlsOrientationLockDelegate_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698