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

Unified Diff: content/browser/android/surface_texture_peer_browser_impl.cc

Issue 12388038: Android: Remove Surface cruft (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 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 side-by-side diff with in-line comments
Download patch
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..1f6a8e94e5ff10daaf1a3a71d49ca599b6bafa83 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/scoped_java_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,34 +43,21 @@ 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());
+ ScopedJavaSurface surface(surface_texture_bridge.get());
+ player->SetVideoSurface(surface.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(
base::ProcessHandle render_process_handle,
- SurfaceTextureTarget type,
scoped_refptr<SurfaceTextureBridge> surface_texture_bridge,
int render_view_id,
int player_id) {
@@ -79,21 +66,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

Powered by Google App Engine
This is Rietveld 408576698