Index: webkit/media/android/media_source_delegate.h |
diff --git a/webkit/media/android/media_source_delegate.h b/webkit/media/android/media_source_delegate.h |
index f2cf340ec99c37b9685790ff37884dedaa9a48b7..6ce16b11a7811ece23a9d73b296a7d9a7553027b 100644 |
--- a/webkit/media/android/media_source_delegate.h |
+++ b/webkit/media/android/media_source_delegate.h |
@@ -40,13 +40,20 @@ class MediaSourceDelegate : public media::DemuxerHost { |
typedef base::Callback<void(WebKit::WebMediaPlayer::NetworkState)> |
UpdateNetworkStateCB; |
+ // Helper class used by scoped_ptr to destroy an instance of |
+ // MediaSourceDelegate. |
+ class Destroyer { |
+ public: |
+ inline void operator()(void* media_source_delegate) const { |
+ static_cast<MediaSourceDelegate*>(media_source_delegate)->Destroy(); |
+ } |
+ }; |
+ |
MediaSourceDelegate(WebKit::WebFrame* frame, |
WebKit::WebMediaPlayerClient* client, |
WebMediaPlayerProxyAndroid* proxy, |
int player_id, |
media::MediaLog* media_log); |
- virtual ~MediaSourceDelegate(); |
- |
// Initialize the MediaSourceDelegate. |media_source| will be owned by |
// this object after this call. |
void Initialize(WebKit::WebMediaSource* media_source, |
@@ -79,7 +86,13 @@ class MediaSourceDelegate : public media::DemuxerHost { |
// If it's the first request after the seek, |seek_done| will be true. |
void OnReadFromDemuxer(media::DemuxerStream::Type type, bool seek_done); |
+ // Called by the Destroyer to destroy an instance of this object. |
+ void Destroy(); |
+ |
private: |
+ // This is private to enforce use of the Destroyer. |
+ virtual ~MediaSourceDelegate(); |
+ |
// Methods inherited from DemuxerHost. |
virtual void SetTotalBytes(int64 total_bytes) OVERRIDE; |
virtual void AddBufferedByteRange(int64 start, int64 end) OVERRIDE; |
@@ -90,6 +103,7 @@ class MediaSourceDelegate : public media::DemuxerHost { |
// Callbacks for ChunkDemuxer & Decryptor. |
void OnDemuxerInitDone(media::PipelineStatus status); |
+ void OnDemuxerStopDone(); |
void OnDemuxerOpened(); |
void OnKeyAdded(const std::string& key_system, const std::string& session_id); |
void OnKeyError(const std::string& key_system, |
@@ -127,7 +141,7 @@ class MediaSourceDelegate : public media::DemuxerHost { |
base::WeakPtrFactory<MediaSourceDelegate> weak_this_; |
- WebKit::WebMediaPlayerClient* const client_; |
+ WebKit::WebMediaPlayerClient* client_; |
WebMediaPlayerProxyAndroid* proxy_; |
int player_id_; |
@@ -163,4 +177,3 @@ class MediaSourceDelegate : public media::DemuxerHost { |
} // namespace webkit_media |
#endif // WEBKIT_MEDIA_ANDROID_MEDIA_SOURCE_DELEGATE_H_ |
- |