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

Unified Diff: content/renderer/media/webmediaplayer_ms.h

Issue 2640573002: Remove WebMediaPlayerDelegate null checks (Closed)
Patch Set: Undo accidental delete of WMPI::delegate_ Created 3 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: content/renderer/media/webmediaplayer_ms.h
diff --git a/content/renderer/media/webmediaplayer_ms.h b/content/renderer/media/webmediaplayer_ms.h
index a4b032fa0a28bb0893744e978a676eeaa3534444..c26990ccc9b1253283720d215c67d5fc55996943 100644
--- a/content/renderer/media/webmediaplayer_ms.h
+++ b/content/renderer/media/webmediaplayer_ms.h
@@ -68,10 +68,11 @@ class CONTENT_EXPORT WebMediaPlayerMS
public:
// Construct a WebMediaPlayerMS with reference to the client, and
// a MediaStreamClient which provides MediaStreamVideoRenderer.
+ // |delegate| must not be null.
WebMediaPlayerMS(
blink::WebFrame* frame,
blink::WebMediaPlayerClient* client,
- base::WeakPtr<media::WebMediaPlayerDelegate> delegate,
+ media::WebMediaPlayerDelegate* delegate,
media::MediaLog* media_log,
std::unique_ptr<MediaStreamRendererFactory> factory,
scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_,
@@ -204,7 +205,13 @@ class CONTENT_EXPORT WebMediaPlayerMS
// |delegate_id_|; an id provided after registering with the delegate. The
// WebMediaPlayer may also receive directives (play, pause) from the delegate
// via the WebMediaPlayerDelegate::Observer interface after registration.
- const base::WeakPtr<media::WebMediaPlayerDelegate> delegate_;
+ //
+ // NOTE: HTMLMediaElement is a Blink::SuspendableObject, and will receive a
+ // call to contextDestroyed() when Blink::Document::shutdown() is called.
+ // Document::shutdown() is called before the frame detaches (and before the
+ // frame is destroyed). RenderFrameImpl owns of |delegate_|, and is guaranteed
+ // to outlive |this|. It is therefore safe use a raw pointer directly.
+ media::WebMediaPlayerDelegate* delegate_;
int delegate_id_;
// Inner class used for transfering frames on compositor thread to
« no previous file with comments | « content/renderer/media/android/webmediaplayer_android.cc ('k') | content/renderer/media/webmediaplayer_ms.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698