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..eff601293b83ca10162178b162c7ec2cee530cb6 100644 |
--- a/content/browser/android/surface_texture_peer_browser_impl.cc |
+++ b/content/browser/android/surface_texture_peer_browser_impl.cc |
@@ -4,12 +4,12 @@ |
#include "content/browser/android/surface_texture_peer_browser_impl.h" |
+#include "base/android/jni_android.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; |
@@ -43,29 +43,18 @@ static void SetSurfacePeer( |
host->media_player_manager()->GetPlayer(player_id); |
if (player && |
player != host->media_player_manager()->GetFullscreenPlayer()) { |
- base::android::ScopedJavaLocalRef<jclass> cls( |
- base::android::GetClass(env, "android/view/Surface")); |
- jmethodID constructor = MethodID::Get<MethodID::TYPE_INSTANCE>( |
- env, cls.obj(), "<init>", "(Landroid/graphics/SurfaceTexture;)V"); |
- 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 surface(surface_texture_bridge->j_surface_texture()); |
+ player->SetVideoSurface(surface.j_surface().obj()); |
bulach
2013/03/04 10:44:51
I don't quite understand your concerns here, my ma
|
+ surface.Release(); |
bulach
2013/03/04 10:44:51
ok, so if you don't agree with the above :)
"Rele
|
} |
} |
} |
} |
-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 +68,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 |