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

Side by Side Diff: media/base/android/media_player_bridge.h

Issue 193303002: WeakPtr destruction order cleanup: media edition. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase. Created 6 years, 9 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « media/base/android/media_decoder_job.cc ('k') | media/base/android/media_player_bridge.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef MEDIA_BASE_ANDROID_MEDIA_PLAYER_BRIDGE_H_ 5 #ifndef MEDIA_BASE_ANDROID_MEDIA_PLAYER_BRIDGE_H_
6 #define MEDIA_BASE_ANDROID_MEDIA_PLAYER_BRIDGE_H_ 6 #define MEDIA_BASE_ANDROID_MEDIA_PLAYER_BRIDGE_H_
7 7
8 #include <jni.h> 8 #include <jni.h>
9 #include <map> 9 #include <map>
10 #include <string> 10 #include <string>
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 virtual void Prepare(); 98 virtual void Prepare();
99 void OnMediaPrepared(); 99 void OnMediaPrepared();
100 100
101 // Create the corresponding Java class instance. 101 // Create the corresponding Java class instance.
102 virtual void CreateJavaMediaPlayerBridge(); 102 virtual void CreateJavaMediaPlayerBridge();
103 103
104 // Get allowed operations from the player. 104 // Get allowed operations from the player.
105 virtual base::android::ScopedJavaLocalRef<jobject> GetAllowedOperations(); 105 virtual base::android::ScopedJavaLocalRef<jobject> GetAllowedOperations();
106 106
107 private: 107 private:
108 friend class MediaPlayerListener;
109
108 // Set the data source for the media player. 110 // Set the data source for the media player.
109 void SetDataSource(const std::string& url); 111 void SetDataSource(const std::string& url);
110 112
111 // Functions that implements media player control. 113 // Functions that implements media player control.
112 void StartInternal(); 114 void StartInternal();
113 void PauseInternal(); 115 void PauseInternal();
114 void SeekInternal(base::TimeDelta time); 116 void SeekInternal(base::TimeDelta time);
115 117
116 // Called when |time_update_timer_| fires. 118 // Called when |time_update_timer_| fires.
117 void OnTimeUpdateTimerFired(); 119 void OnTimeUpdateTimerFired();
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 bool can_seek_backward_; 163 bool can_seek_backward_;
162 164
163 // Cookies for |url_|. 165 // Cookies for |url_|.
164 std::string cookies_; 166 std::string cookies_;
165 167
166 // Java MediaPlayerBridge instance. 168 // Java MediaPlayerBridge instance.
167 base::android::ScopedJavaGlobalRef<jobject> j_media_player_bridge_; 169 base::android::ScopedJavaGlobalRef<jobject> j_media_player_bridge_;
168 170
169 base::RepeatingTimer<MediaPlayerBridge> time_update_timer_; 171 base::RepeatingTimer<MediaPlayerBridge> time_update_timer_;
170 172
171 // Weak pointer passed to |listener_| for callbacks.
172 base::WeakPtrFactory<MediaPlayerBridge> weak_this_;
173
174 // Listener object that listens to all the media player events. 173 // Listener object that listens to all the media player events.
175 MediaPlayerListener listener_; 174 scoped_ptr<MediaPlayerListener> listener_;
176 175
177 // Whether player is currently using a surface. 176 // Whether player is currently using a surface.
178 bool is_surface_in_use_; 177 bool is_surface_in_use_;
179 178
180 friend class MediaPlayerListener; 179 // Weak pointer passed to |listener_| for callbacks.
180 // NOTE: Weak pointers must be invalidated before all other member variables.
181 base::WeakPtrFactory<MediaPlayerBridge> weak_factory_;
182
181 DISALLOW_COPY_AND_ASSIGN(MediaPlayerBridge); 183 DISALLOW_COPY_AND_ASSIGN(MediaPlayerBridge);
182 }; 184 };
183 185
184 } // namespace media 186 } // namespace media
185 187
186 #endif // MEDIA_BASE_ANDROID_MEDIA_PLAYER_BRIDGE_H_ 188 #endif // MEDIA_BASE_ANDROID_MEDIA_PLAYER_BRIDGE_H_
OLDNEW
« no previous file with comments | « media/base/android/media_decoder_job.cc ('k') | media/base/android/media_player_bridge.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698