| Index: media/base/android/media_player_android.h
|
| diff --git a/media/base/android/media_player_android.h b/media/base/android/media_player_android.h
|
| index 8928222156bc3078098507ac81452009c0d44185..e02b2a27f3d4f9e868a879b2045cd67b1dc485a8 100644
|
| --- a/media/base/android/media_player_android.h
|
| +++ b/media/base/android/media_player_android.h
|
| @@ -83,6 +83,12 @@ class MEDIA_EXPORT MediaPlayerAndroid {
|
|
|
| GURL frame_url() { return frame_url_; }
|
|
|
| + // Attach/Detaches |listener_| for listening to all the media events. If
|
| + // |j_media_player| is NULL, |listener_| only listens to the system media
|
| + // events. Otherwise, it also listens to the events from |j_media_player|.
|
| + void AttachListener(jobject j_media_player);
|
| + void DetachListener();
|
| +
|
| protected:
|
| MediaPlayerAndroid(int player_id,
|
| MediaPlayerManager* manager,
|
| @@ -101,12 +107,6 @@ class MEDIA_EXPORT MediaPlayerAndroid {
|
| virtual void OnSeekComplete();
|
| virtual void OnMediaPrepared();
|
|
|
| - // Attach/Detaches |listener_| for listening to all the media events. If
|
| - // |j_media_player| is NULL, |listener_| only listens to the system media
|
| - // events. Otherwise, it also listens to the events from |j_media_player|.
|
| - void AttachListener(jobject j_media_player);
|
| - void DetachListener();
|
| -
|
| // When destroying a subclassed object on a non-UI thread
|
| // it is still required to destroy the |listener_| related stuff
|
| // on the UI thread.
|
| @@ -115,6 +115,10 @@ class MEDIA_EXPORT MediaPlayerAndroid {
|
|
|
| MediaPlayerManager* manager() { return manager_; }
|
|
|
| + base::WeakPtr<MediaPlayerAndroid> weak_ptr_for_ui_thread() {
|
| + return weak_ptr_for_ui_thread_;
|
| + }
|
| +
|
| RequestMediaResourcesCB request_media_resources_cb_;
|
|
|
| private:
|
| @@ -135,6 +139,9 @@ class MEDIA_EXPORT MediaPlayerAndroid {
|
| // Maintains the audible state of the player, true if it is playing sound.
|
| bool is_audible_;
|
|
|
| + // We use this pointer when we post task from Media thread
|
| + base::WeakPtr<MediaPlayerAndroid> weak_ptr_for_ui_thread_;
|
| +
|
| // Weak pointer passed to |listener_| for callbacks.
|
| // NOTE: Weak pointers must be invalidated before all other member variables.
|
| base::WeakPtrFactory<MediaPlayerAndroid> weak_factory_;
|
|
|