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

Unified Diff: media/blink/webmediaplayer_impl.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
« no previous file with comments | « content/renderer/render_frame_impl.cc ('k') | media/blink/webmediaplayer_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/blink/webmediaplayer_impl.h
diff --git a/media/blink/webmediaplayer_impl.h b/media/blink/webmediaplayer_impl.h
index a4bb832bf62f861b2dac8c2440d88def0291da6d..2d594a49b2b0db3c2fadff446cc3ed10127e3bd1 100644
--- a/media/blink/webmediaplayer_impl.h
+++ b/media/blink/webmediaplayer_impl.h
@@ -90,12 +90,12 @@ class MEDIA_BLINK_EXPORT WebMediaPlayerImpl
public base::SupportsWeakPtr<WebMediaPlayerImpl> {
public:
// Constructs a WebMediaPlayer implementation using Chromium's media stack.
- // |delegate| may be null. |renderer_factory| must not be null.
+ // |delegate| and |renderer_factory| must not be null.
WebMediaPlayerImpl(
blink::WebLocalFrame* frame,
blink::WebMediaPlayerClient* client,
blink::WebMediaPlayerEncryptedMediaClient* encrypted_client,
- base::WeakPtr<WebMediaPlayerDelegate> delegate,
+ WebMediaPlayerDelegate* delegate,
std::unique_ptr<RendererFactory> renderer_factory,
linked_ptr<UrlIndex> url_index,
const WebMediaPlayerParams& params);
@@ -518,7 +518,13 @@ class MEDIA_BLINK_EXPORT WebMediaPlayerImpl
// |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.
- base::WeakPtr<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 |delegate_| and is guaranteed
+ // to outlive |this|; thus it is safe to store |delegate_| as a raw pointer.
+ media::WebMediaPlayerDelegate* delegate_;
int delegate_id_;
WebMediaPlayerParams::DeferLoadCB defer_load_cb_;
« no previous file with comments | « content/renderer/render_frame_impl.cc ('k') | media/blink/webmediaplayer_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698