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

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: event-based 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 25 matching lines...) Expand all
36 // - PendingMetadata => MaybeLockedFullscreen: on loadedmetadata; 36 // - PendingMetadata => MaybeLockedFullscreen: on loadedmetadata;
37 // - PendingMetadata => PendingFullscreen: on fullscreenchange event (leaving 37 // - PendingMetadata => PendingFullscreen: on fullscreenchange event (leaving
38 // fullscreen); 38 // fullscreen);
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 // Called by MediaControls when the HTMLMediaElement is added to a document
47 // document. All event listeners should be added.
48 void attach();
49
50 // Called by MediaControls when the HTMLMediaElement is no longer in the
51 // document. All event listeners should be removed in order to prepare the
52 // object to be garbage collected.
53 void detach();
54
46 // EventListener implementation. 55 // EventListener implementation.
47 bool operator==(const EventListener&) const override; 56 bool operator==(const EventListener&) const override;
48 57
49 DECLARE_VIRTUAL_TRACE(); 58 DECLARE_VIRTUAL_TRACE();
50 59
51 private: 60 private:
52 friend class MediaControlsOrientationLockDelegateTest; 61 friend class MediaControlsOrientationLockDelegateTest;
53 62
54 enum class State { 63 enum class State {
55 PendingFullscreen, 64 PendingFullscreen,
(...skipping 28 matching lines...) Expand all
84 // In other words, whether the orientation was locked. 93 // In other words, whether the orientation was locked.
85 bool m_shouldUnlockOrientation = false; 94 bool m_shouldUnlockOrientation = false;
86 95
87 // `m_videoElement` owns MediaControls that owns |this|. 96 // `m_videoElement` owns MediaControls that owns |this|.
88 Member<HTMLVideoElement> m_videoElement; 97 Member<HTMLVideoElement> m_videoElement;
89 }; 98 };
90 99
91 } // namespace blink 100 } // namespace blink
92 101
93 #endif // MediaControlsOrientationLockDelegate_h 102 #endif // MediaControlsOrientationLockDelegate_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698