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

Side by Side Diff: webkit/media/android/webmediaplayer_proxy_android.h

Issue 10919075: Move android mediaplayer from render process to browser process. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: addressing comments Created 8 years, 3 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
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 WEBKIT_MEDIA_ANDROID_WEBMEDIAPLAYER_PROXY_ANDROID_H_ 5 #ifndef WEBKIT_MEDIA_ANDROID_WEBMEDIAPLAYER_PROXY_ANDROID_H_
6 #define WEBKIT_MEDIA_ANDROID_WEBMEDIAPLAYER_PROXY_ANDROID_H_ 6 #define WEBKIT_MEDIA_ANDROID_WEBMEDIAPLAYER_PROXY_ANDROID_H_
7 7
8 #include "base/memory/ref_counted.h" 8 #include "base/time.h"
9 #include "base/memory/weak_ptr.h"
10
11 namespace base {
12 class MessageLoopProxy;
13 }
14 9
15 namespace webkit_media { 10 namespace webkit_media {
16 11
17 class WebMediaPlayerAndroid; 12 // An interface to facilitate the IPC between the browser side
13 // android::MediaPlayer and the WebMediaPlayerImplAndroid in the renderer
14 // process.
15 // Implementation is provided by content::WebMediaPlayerProxyImplAndroid.
16 class WebMediaPlayerProxyAndroid {
17 public:
18 virtual ~WebMediaPlayerProxyAndroid() {};
18 19
19 // Acts as a thread proxy between media::MediaPlayerBridge and 20 // Initialize a MediaPlayerBridge object in browser process
20 // WebMediaPlayerAndroid so that callbacks are posted onto the render thread. 21 virtual void Initialize(int player_id, const std::string& url) = 0;
21 class WebMediaPlayerProxyAndroid
22 : public base::RefCountedThreadSafe<WebMediaPlayerProxyAndroid> {
23 public:
24 WebMediaPlayerProxyAndroid(
25 const scoped_refptr<base::MessageLoopProxy>& render_loop,
26 base::WeakPtr<WebMediaPlayerAndroid> webmediaplayer);
27 22
28 // Callbacks from media::MediaPlayerBridge to WebMediaPlayerAndroid. 23 // Start the player.
29 void MediaErrorCallback(int error_type); 24 virtual void Start(int player_id) = 0;
30 void MediaInfoCallback(int info_type);
31 void VideoSizeChangedCallback(int width, int height);
32 void BufferingUpdateCallback(int percent);
33 void PlaybackCompleteCallback();
34 void SeekCompleteCallback();
35 void MediaPreparedCallback();
36 25
37 private: 26 // Pause the player.
38 friend class base::RefCountedThreadSafe<WebMediaPlayerProxyAndroid>; 27 virtual void Pause(int player_id) = 0;
39 virtual ~WebMediaPlayerProxyAndroid();
40 28
41 // Notify |webmediaplayer_| that an error has occured. 29 // Perform seek on the player.
42 void MediaErrorTask(int error_type); 30 virtual void Seek(int player_id, base::TimeDelta time) = 0;
43 31
44 // Notify |webmediaplayer_| that some info has been received from 32 // Release resources for the player.
45 // media::MediaPlayerBridge. 33 virtual void ReleaseResources(int player_id) = 0;
46 void MediaInfoTask(int info_type);
47 34
48 // Notify |webmediaplayer_| that the video size has changed. 35 // Destroy the player in the browser process
49 void VideoSizeChangedTask(int width, int height); 36 virtual void DestroyPlayer(int player_id) = 0;
50
51 // Notify |webmediaplayer_| that an update in buffering has occured.
52 void BufferingUpdateTask(int percent);
53
54 // Notify |webmediaplayer_| that playback has completed.
55 void PlaybackCompleteTask();
56
57 // Notify |webmediaplayer_| that seek has completed.
58 void SeekCompleteTask();
59
60 // Notify |webmediaplayer_| that media has been prepared successfully.
61 void MediaPreparedTask();
62
63 // The render message loop where WebKit lives.
64 scoped_refptr<base::MessageLoopProxy> render_loop_;
65
66 // The WebMediaPlayerAndroid object all the callbacks should be send to.
67 base::WeakPtr<WebMediaPlayerAndroid> webmediaplayer_;
68
69 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerProxyAndroid);
70 }; 37 };
71 38
72 } // namespace webkit_media 39 } // namespace webkit_media
73 40
74 #endif // WEBKIT_MEDIA_ANDROID_WEBMEDIAPLAYER_PROXY_ANDROID_H_ 41 #endif // WEBKIT_MEDIA_ANDROID_WEBMEDIAPLAYER_PROXY_ANDROID_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698