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

Unified Diff: webkit/media/android/media_source_delegate.h

Issue 15898002: Fix various MediaSource related crashes on Android. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Make Destroy() public and remove friend decl to make compiler happy Created 7 years, 7 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 | « media/base/android/media_source_player.cc ('k') | webkit/media/android/media_source_delegate.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_
-
« no previous file with comments | « media/base/android/media_source_player.cc ('k') | webkit/media/android/media_source_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698