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

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 and resolving merge conflicts 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 <string>
9 #include "base/memory/weak_ptr.h"
10 9
11 namespace base { 10 #include "base/time.h"
12 class MessageLoopProxy;
13 }
14 11
15 namespace webkit_media { 12 namespace webkit_media {
16 13
17 class WebMediaPlayerAndroid; 14 // An interface to facilitate the IPC between the browser side
18 15 // android::MediaPlayer and the WebMediaPlayerImplAndroid in the renderer
19 // Acts as a thread proxy between media::MediaPlayerBridge and 16 // process.
20 // WebMediaPlayerAndroid so that callbacks are posted onto the render thread. 17 // Implementation is provided by content::WebMediaPlayerProxyImplAndroid.
21 class WebMediaPlayerProxyAndroid 18 class WebMediaPlayerProxyAndroid {
22 : public base::RefCountedThreadSafe<WebMediaPlayerProxyAndroid> {
23 public: 19 public:
24 WebMediaPlayerProxyAndroid(
25 const scoped_refptr<base::MessageLoopProxy>& render_loop,
26 base::WeakPtr<WebMediaPlayerAndroid> webmediaplayer);
27
28 // Callbacks from media::MediaPlayerBridge to WebMediaPlayerAndroid.
29 void MediaErrorCallback(int error_type);
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
37 private:
38 friend class base::RefCountedThreadSafe<WebMediaPlayerProxyAndroid>;
39 virtual ~WebMediaPlayerProxyAndroid(); 20 virtual ~WebMediaPlayerProxyAndroid();
40 21
41 // Notify |webmediaplayer_| that an error has occured. 22 // Initialize a MediaPlayerBridge object in browser process
42 void MediaErrorTask(int error_type); 23 virtual void Initialize(int player_id, const std::string& url,
24 const std::string& first_party_for_cookies) = 0;
43 25
44 // Notify |webmediaplayer_| that some info has been received from 26 // Start the player.
45 // media::MediaPlayerBridge. 27 virtual void Start(int player_id) = 0;
46 void MediaInfoTask(int info_type);
47 28
48 // Notify |webmediaplayer_| that the video size has changed. 29 // Pause the player.
49 void VideoSizeChangedTask(int width, int height); 30 virtual void Pause(int player_id) = 0;
50 31
51 // Notify |webmediaplayer_| that an update in buffering has occured. 32 // Perform seek on the player.
52 void BufferingUpdateTask(int percent); 33 virtual void Seek(int player_id, base::TimeDelta time) = 0;
53 34
54 // Notify |webmediaplayer_| that playback has completed. 35 // Release resources for the player.
55 void PlaybackCompleteTask(); 36 virtual void ReleaseResources(int player_id) = 0;
56 37
57 // Notify |webmediaplayer_| that seek has completed. 38 // Destroy the player in the browser process
58 void SeekCompleteTask(); 39 virtual void DestroyPlayer(int player_id) = 0;
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 }; 40 };
71 41
72 } // namespace webkit_media 42 } // namespace webkit_media
73 43
74 #endif // WEBKIT_MEDIA_ANDROID_WEBMEDIAPLAYER_PROXY_ANDROID_H_ 44 #endif // WEBKIT_MEDIA_ANDROID_WEBMEDIAPLAYER_PROXY_ANDROID_H_
OLDNEW
« no previous file with comments | « webkit/media/android/webmediaplayer_manager_android.cc ('k') | webkit/media/android/webmediaplayer_proxy_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698