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 b0639250f59cb3923390f6d6c908e8857ee681f1..46184fde18d820492ce41309350949b26d4e242f 100644 |
--- a/webkit/media/android/media_source_delegate.h |
+++ b/webkit/media/android/media_source_delegate.h |
@@ -39,13 +39,21 @@ 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* x) const { |
qinmin
2013/05/22 18:51:24
nit: s/x/media_source_delegate/
acolwell GONE FROM CHROMIUM
2013/05/22 19:12:09
Done.
|
+ MediaSourceDelegate* delegate = static_cast<MediaSourceDelegate*>(x); |
+ 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,6 +87,14 @@ class MediaSourceDelegate : public media::DemuxerHost { |
void OnReadFromDemuxer(media::DemuxerStream::Type type, bool seek_done); |
private: |
+ friend Destroyer; |
+ |
+ // This is private to enforce use of the Destroyer. |
+ virtual ~MediaSourceDelegate(); |
+ |
+ // Called by the Destroyer to destroy an instance of this object. |
+ void Destroy(); |
+ |
// Methods inherited from DemuxerHost. |
virtual void SetTotalBytes(int64 total_bytes) OVERRIDE; |
virtual void AddBufferedByteRange(int64 start, int64 end) OVERRIDE; |
@@ -89,6 +105,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, |
@@ -123,7 +140,7 @@ class MediaSourceDelegate : public media::DemuxerHost { |
base::WeakPtrFactory<MediaSourceDelegate> weak_this_; |
- WebKit::WebMediaPlayerClient* const client_; |
+ WebKit::WebMediaPlayerClient* client_; |
WebMediaPlayerProxyAndroid* proxy_; |
int player_id_; |
@@ -159,4 +176,3 @@ class MediaSourceDelegate : public media::DemuxerHost { |
} // namespace webkit_media |
#endif // WEBKIT_MEDIA_ANDROID_MEDIA_SOURCE_DELEGATE_H_ |
- |