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

Unified Diff: content/renderer/media/android/webmediaplayer_android.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 | « no previous file | content/renderer/media/android/webmediaplayer_android.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/media/android/webmediaplayer_android.h
diff --git a/content/renderer/media/android/webmediaplayer_android.h b/content/renderer/media/android/webmediaplayer_android.h
index 10c095c47913125fb12919c0aff309be2d3a6b98..6698ae4fd360fa1fc88e59c7f05c447c252acaf2 100644
--- a/content/renderer/media/android/webmediaplayer_android.h
+++ b/content/renderer/media/android/webmediaplayer_android.h
@@ -82,7 +82,7 @@ class WebMediaPlayerAndroid
blink::WebFrame* frame,
blink::WebMediaPlayerClient* client,
blink::WebMediaPlayerEncryptedMediaClient* encrypted_client,
- base::WeakPtr<media::WebMediaPlayerDelegate> delegate,
+ media::WebMediaPlayerDelegate* delegate,
RendererMediaPlayerManager* player_manager,
scoped_refptr<StreamTextureFactory> factory,
int frame_id,
@@ -277,7 +277,13 @@ class WebMediaPlayerAndroid
// |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<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 |delegate_| and is guaranteed
+ // to outlive |this|; thus it is safe to store |delegate_| as a raw pointer.
+ media::WebMediaPlayerDelegate* delegate_;
int delegate_id_;
// Callback responsible for determining if loading of media should be deferred
« no previous file with comments | « no previous file | content/renderer/media/android/webmediaplayer_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698