Chromium Code Reviews| Index: content/browser/android/surface_texture_peer_browser_impl.cc |
| diff --git a/content/browser/android/surface_texture_peer_browser_impl.cc b/content/browser/android/surface_texture_peer_browser_impl.cc |
| index 70dcf1a7ba83d71115b92719e488cd6d6d6c9d25..8e465af904412d775f4364fdace737292d1efb06 100644 |
| --- a/content/browser/android/surface_texture_peer_browser_impl.cc |
| +++ b/content/browser/android/surface_texture_peer_browser_impl.cc |
| @@ -4,12 +4,13 @@ |
| #include "content/browser/android/surface_texture_peer_browser_impl.h" |
| +#include "base/android/jni_android.h" |
| +#include "base/android/scoped_java_ref.h" |
| #include "content/browser/android/media_player_manager_android.h" |
| #include "content/browser/renderer_host/render_view_host_impl.h" |
| -#include "content/common/android/surface_callback.h" |
| +#include "content/common/android/surface.h" |
| #include "content/public/browser/browser_thread.h" |
| #include "content/public/browser/render_process_host.h" |
| -#include "jni/BrowserProcessSurfaceTexture_jni.h" |
| #include "media/base/android/media_player_bridge.h" |
| using base::android::MethodID; |
| @@ -47,25 +48,21 @@ static void SetSurfacePeer( |
| base::android::GetClass(env, "android/view/Surface")); |
| jmethodID constructor = MethodID::Get<MethodID::TYPE_INSTANCE>( |
| env, cls.obj(), "<init>", "(Landroid/graphics/SurfaceTexture;)V"); |
|
bulach
2013/03/01 11:38:24
yay, let's remove *all* the cruft! :)
it seems to
no sievers
2013/03/01 22:29:12
Thanks for pointing out this block, I should have
|
| - ScopedJavaLocalRef<jobject> j_surface( |
| + base::android::ScopedJavaLocalRef<jobject> j_surface( |
| env, env->NewObject( |
| cls.obj(), constructor, |
| surface_texture_bridge->j_surface_texture().obj())); |
| player->SetVideoSurface(j_surface.obj()); |
| - ReleaseSurface(j_surface.obj()); |
| + Surface::Release(j_surface.obj()); |
| } |
| } |
| } |
| } |
| -SurfaceTexturePeerBrowserImpl::SurfaceTexturePeerBrowserImpl( |
| - bool player_in_render_process) |
| - : player_in_render_process_(player_in_render_process) { |
| +SurfaceTexturePeerBrowserImpl::SurfaceTexturePeerBrowserImpl() { |
| } |
| SurfaceTexturePeerBrowserImpl::~SurfaceTexturePeerBrowserImpl() { |
| - if (surface_.obj()) |
| - ReleaseSurface(surface_.obj()); |
| } |
| void SurfaceTexturePeerBrowserImpl::EstablishSurfaceTexturePeer( |
| @@ -79,21 +76,9 @@ void SurfaceTexturePeerBrowserImpl::EstablishSurfaceTexturePeer( |
| JNIEnv* env = base::android::AttachCurrentThread(); |
| DCHECK(env); |
| - if (player_in_render_process_) { |
| - Java_BrowserProcessSurfaceTexture_establishSurfaceTexturePeer( |
| - env, render_process_handle, type, |
| - surface_texture_bridge->j_surface_texture().obj(), |
| - render_view_id, player_id); |
| - } else { |
| - BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, base::Bind( |
| - &SetSurfacePeer, surface_texture_bridge, render_process_handle, |
| - render_view_id, player_id)); |
| - } |
| -} |
| - |
| -bool SurfaceTexturePeerBrowserImpl::RegisterBrowserProcessSurfaceTexture( |
| - JNIEnv* env) { |
| - return RegisterNativesImpl(env); |
| + BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, base::Bind( |
| + &SetSurfacePeer, surface_texture_bridge, render_process_handle, |
| + render_view_id, player_id)); |
| } |
| } // namespace content |