diff options
author | yfriedman@chromium.org <yfriedman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-08-29 04:05:36 +0000 |
---|---|---|
committer | yfriedman@chromium.org <yfriedman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-08-29 04:05:36 +0000 |
commit | 0fc0a2d41dd50576479bf45ceb54c8b292f3cd70 (patch) | |
tree | c33a7a388e8e41cfc838b66175a635f6ec85e3f1 | |
parent | f54b991ac210e0200cde3173b0afb837901ed355 (diff) | |
download | chromium_src-0fc0a2d41dd50576479bf45ceb54c8b292f3cd70.zip chromium_src-0fc0a2d41dd50576479bf45ceb54c8b292f3cd70.tar.gz chromium_src-0fc0a2d41dd50576479bf45ceb54c8b292f3cd70.tar.bz2 |
[Android] Rename SurfaceTextureBridge to just SurfaceTexture.
This came up in https://codereview.chromium.org/22912020/ but was punted
to keep merging smaller. Now that it's in, here's the change. The java
class has a slightly different name as internally to the native
SurfaceTexture object we have a wrapper, but that detail is unknown to
clients.
Review URL: https://chromiumcodereview.appspot.com/23574003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@220183 0039d316-1c4b-4281-b951-d872f2087c98
31 files changed, 118 insertions, 116 deletions
diff --git a/content/app/android/child_process_service.cc b/content/app/android/child_process_service.cc index 88de2ad..4d5de1d 100644 --- a/content/app/android/child_process_service.cc +++ b/content/app/android/child_process_service.cc @@ -45,13 +45,13 @@ class SurfaceTexturePeerChildImpl : public content::SurfaceTexturePeer, virtual void EstablishSurfaceTexturePeer( base::ProcessHandle pid, - scoped_refptr<gfx::SurfaceTextureBridge> surface_texture_bridge, + scoped_refptr<gfx::SurfaceTexture> surface_texture, int primary_id, int secondary_id) OVERRIDE { JNIEnv* env = base::android::AttachCurrentThread(); content::Java_ChildProcessService_establishSurfaceTexturePeer( env, service_.obj(), pid, - surface_texture_bridge->j_surface_texture().obj(), primary_id, + surface_texture->j_surface_texture().obj(), primary_id, secondary_id); CheckException(env); } diff --git a/content/browser/android/in_process/synchronous_compositor_impl.cc b/content/browser/android/in_process/synchronous_compositor_impl.cc index 8fcebf4..ee21e69 100644 --- a/content/browser/android/in_process/synchronous_compositor_impl.cc +++ b/content/browser/android/in_process/synchronous_compositor_impl.cc @@ -19,7 +19,7 @@ #include "content/renderer/media/android/stream_texture_factory_android_synchronous_impl.h" #include "gpu/command_buffer/client/gl_in_process_context.h" #include "gpu/command_buffer/service/stream_texture_manager_in_process_android.h" -#include "ui/gl/android/surface_texture_bridge.h" +#include "ui/gl/android/surface_texture.h" #include "ui/gl/gl_surface.h" #include "webkit/common/gpu/context_provider_in_process.h" #include "webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl.h" @@ -54,7 +54,7 @@ class VideoContextProvider : context_provider_(context_provider), gl_in_process_context_(gl_in_process_context) {} - virtual scoped_refptr<gfx::SurfaceTextureBridge> GetSurfaceTexture( + virtual scoped_refptr<gfx::SurfaceTexture> GetSurfaceTexture( uint32 stream_id) OVERRIDE { return gl_in_process_context_->GetSurfaceTexture(stream_id); } diff --git a/content/browser/android/surface_texture_peer_browser_impl.cc b/content/browser/android/surface_texture_peer_browser_impl.cc index faaf4a2..de110db 100644 --- a/content/browser/android/surface_texture_peer_browser_impl.cc +++ b/content/browser/android/surface_texture_peer_browser_impl.cc @@ -18,7 +18,7 @@ namespace { // Pass a java surface object to the MediaPlayerAndroid object // identified by render process handle, render view ID and player ID. static void SetSurfacePeer( - scoped_refptr<gfx::SurfaceTextureBridge> surface_texture_bridge, + scoped_refptr<gfx::SurfaceTexture> surface_texture, base::ProcessHandle render_process_handle, int render_view_id, int player_id) { @@ -40,7 +40,7 @@ static void SetSurfacePeer( host->media_player_manager()->GetPlayer(player_id); if (player && player != host->media_player_manager()->GetFullscreenPlayer()) { - gfx::ScopedJavaSurface surface(surface_texture_bridge.get()); + gfx::ScopedJavaSurface surface(surface_texture.get()); player->SetVideoSurface(surface.Pass()); } } @@ -57,14 +57,14 @@ SurfaceTexturePeerBrowserImpl::~SurfaceTexturePeerBrowserImpl() { void SurfaceTexturePeerBrowserImpl::EstablishSurfaceTexturePeer( base::ProcessHandle render_process_handle, - scoped_refptr<gfx::SurfaceTextureBridge> surface_texture_bridge, + scoped_refptr<gfx::SurfaceTexture> surface_texture, int render_view_id, int player_id) { - if (!surface_texture_bridge.get()) + if (!surface_texture.get()) return; BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, base::Bind( - &SetSurfacePeer, surface_texture_bridge, render_process_handle, + &SetSurfacePeer, surface_texture, render_process_handle, render_view_id, player_id)); } diff --git a/content/browser/android/surface_texture_peer_browser_impl.h b/content/browser/android/surface_texture_peer_browser_impl.h index 644bf2c..4aa8563 100644 --- a/content/browser/android/surface_texture_peer_browser_impl.h +++ b/content/browser/android/surface_texture_peer_browser_impl.h @@ -24,7 +24,7 @@ class SurfaceTexturePeerBrowserImpl : public SurfaceTexturePeer { // SurfaceTexturePeer implementation. virtual void EstablishSurfaceTexturePeer( base::ProcessHandle render_process_handle, - scoped_refptr<gfx::SurfaceTextureBridge> surface_texture_bridge, + scoped_refptr<gfx::SurfaceTexture> surface_texture, int render_view_id, int player_id) OVERRIDE; diff --git a/content/browser/renderer_host/surface_texture_transport_client_android.cc b/content/browser/renderer_host/surface_texture_transport_client_android.cc index b563480..d382cd5 100644 --- a/content/browser/renderer_host/surface_texture_transport_client_android.cc +++ b/content/browser/renderer_host/surface_texture_transport_client_android.cc @@ -15,7 +15,7 @@ #include "third_party/WebKit/public/platform/WebGraphicsContext3D.h" #include "third_party/khronos/GLES2/gl2.h" #include "third_party/khronos/GLES2/gl2ext.h" -#include "ui/gl/android/surface_texture_bridge.h" +#include "ui/gl/android/surface_texture.h" namespace content { @@ -26,7 +26,7 @@ static const uint32 kGLTextureExternalOES = 0x8D65; class SurfaceRefAndroid : public GpuSurfaceTracker::SurfaceRef { public: SurfaceRefAndroid( - const scoped_refptr<gfx::SurfaceTextureBridge>& surface, + const scoped_refptr<gfx::SurfaceTexture>& surface, ANativeWindow* window) : surface_(surface), window_(window) { @@ -39,7 +39,7 @@ class SurfaceRefAndroid : public GpuSurfaceTracker::SurfaceRef { ANativeWindow_release(window_); } - scoped_refptr<gfx::SurfaceTextureBridge> surface_; + scoped_refptr<gfx::SurfaceTexture> surface_; ANativeWindow* window_; }; @@ -61,7 +61,7 @@ scoped_refptr<cc::Layer> SurfaceTextureTransportClient::Initialize() { // Use a SurfaceTexture to stream frames to the UI thread. video_layer_ = cc::VideoLayer::Create(this); - surface_texture_ = new gfx::SurfaceTextureBridge(0); + surface_texture_ = new gfx::SurfaceTexture(0); surface_texture_->SetFrameAvailableCallback( base::Bind( &SurfaceTextureTransportClient::OnSurfaceTextureFrameAvailable, diff --git a/content/browser/renderer_host/surface_texture_transport_client_android.h b/content/browser/renderer_host/surface_texture_transport_client_android.h index 83d9175..5a000bb 100644 --- a/content/browser/renderer_host/surface_texture_transport_client_android.h +++ b/content/browser/renderer_host/surface_texture_transport_client_android.h @@ -21,7 +21,7 @@ class VideoLayer; } namespace gfx { -class SurfaceTextureBridge; +class SurfaceTexture; } namespace content { @@ -45,7 +45,7 @@ class SurfaceTextureTransportClient : public cc::VideoFrameProvider { void OnSurfaceTextureFrameAvailable(); scoped_refptr<cc::VideoLayer> video_layer_; - scoped_refptr<gfx::SurfaceTextureBridge> surface_texture_; + scoped_refptr<gfx::SurfaceTexture> surface_texture_; ANativeWindow* window_; scoped_refptr<media::VideoFrame> video_frame_; uint32 texture_id_; diff --git a/content/common/android/surface_texture_peer.h b/content/common/android/surface_texture_peer.h index 9be032d..03113b8 100644 --- a/content/common/android/surface_texture_peer.h +++ b/content/common/android/surface_texture_peer.h @@ -6,7 +6,7 @@ #define CONTENT_COMMON_ANDROID_SURFACE_TEXTURE_PEER_H_ #include "base/process/process.h" -#include "ui/gl/android/surface_texture_bridge.h" +#include "ui/gl/android/surface_texture.h" namespace content { @@ -20,7 +20,7 @@ class SurfaceTexturePeer { // process. virtual void EstablishSurfaceTexturePeer( base::ProcessHandle pid, - scoped_refptr<gfx::SurfaceTextureBridge> surface_texture_bridge, + scoped_refptr<gfx::SurfaceTexture> surface_texture, int primary_id, int secondary_id) = 0; diff --git a/content/common/gpu/media/android_video_decode_accelerator.cc b/content/common/gpu/media/android_video_decode_accelerator.cc index ac48abc..403d4ad 100644 --- a/content/common/gpu/media/android_video_decode_accelerator.cc +++ b/content/common/gpu/media/android_video_decode_accelerator.cc @@ -102,7 +102,7 @@ bool AndroidVideoDecodeAccelerator::Initialize( gl_decoder_->RestoreTextureUnitBindings(0); gl_decoder_->RestoreActiveTexture(); - surface_texture_ = new gfx::SurfaceTextureBridge(surface_texture_id_); + surface_texture_ = new gfx::SurfaceTexture(surface_texture_id_); if (!ConfigureMediaCodec()) { LOG(ERROR) << "Failed to create MediaCodec instance."; diff --git a/content/common/gpu/media/android_video_decode_accelerator.h b/content/common/gpu/media/android_video_decode_accelerator.h index b846831..3bc60c8 100644 --- a/content/common/gpu/media/android_video_decode_accelerator.h +++ b/content/common/gpu/media/android_video_decode_accelerator.h @@ -21,7 +21,7 @@ #include "media/video/video_decode_accelerator.h" namespace gfx { -class SurfaceTextureBridge; +class SurfaceTexture; } namespace content { @@ -127,7 +127,7 @@ class CONTENT_EXPORT AndroidVideoDecodeAccelerator : scoped_ptr<media::VideoCodecBridge> media_codec_; // A container of texture. Used to set a texture to |media_codec_|. - scoped_refptr<gfx::SurfaceTextureBridge> surface_texture_; + scoped_refptr<gfx::SurfaceTexture> surface_texture_; // The texture id which is set to |surface_texture_|. uint32 surface_texture_id_; diff --git a/content/common/gpu/media/android_video_decode_accelerator_unittest.cc b/content/common/gpu/media/android_video_decode_accelerator_unittest.cc index baf516d..4e25e68 100644 --- a/content/common/gpu/media/android_video_decode_accelerator_unittest.cc +++ b/content/common/gpu/media/android_video_decode_accelerator_unittest.cc @@ -15,7 +15,7 @@ #include "media/video/picture.h" #include "media/video/video_decode_accelerator.h" #include "testing/gtest/include/gtest/gtest.h" -#include "ui/gl/android/surface_texture_bridge.h" +#include "ui/gl/android/surface_texture.h" namespace { @@ -73,7 +73,7 @@ class AndroidVideoDecodeAcceleratorTest : public testing::Test { bool Configure(media::VideoCodec codec) { AndroidVideoDecodeAccelerator* accelerator = static_cast<AndroidVideoDecodeAccelerator*>(accelerator_.get()); - accelerator->surface_texture_ = new gfx::SurfaceTextureBridge(0); + accelerator->surface_texture_ = new gfx::SurfaceTexture(0); accelerator->codec_ = codec; return accelerator->ConfigureMediaCodec(); } diff --git a/content/common/gpu/stream_texture_manager_android.cc b/content/common/gpu/stream_texture_manager_android.cc index 3462fe2..0f173e1 100644 --- a/content/common/gpu/stream_texture_manager_android.cc +++ b/content/common/gpu/stream_texture_manager_android.cc @@ -9,14 +9,14 @@ #include "content/common/gpu/gpu_messages.h" #include "gpu/command_buffer/service/stream_texture.h" #include "ui/gfx/size.h" -#include "ui/gl/android/surface_texture_bridge.h" +#include "ui/gl/android/surface_texture.h" #include "ui/gl/gl_bindings.h" namespace content { StreamTextureManagerAndroid::StreamTextureAndroid::StreamTextureAndroid( GpuChannel* channel, int service_id) - : surface_texture_bridge_(new gfx::SurfaceTextureBridge(service_id)), + : surface_texture_(new gfx::SurfaceTexture(service_id)), size_(0, 0), has_updated_(false), channel_(channel) { @@ -29,13 +29,13 @@ StreamTextureManagerAndroid::StreamTextureAndroid::~StreamTextureAndroid() { void StreamTextureManagerAndroid::StreamTextureAndroid::Update() { GLint texture_id = 0; glGetIntegerv(GL_TEXTURE_BINDING_EXTERNAL_OES, &texture_id); - surface_texture_bridge_->UpdateTexImage(); + surface_texture_->UpdateTexImage(); glBindTexture(GL_TEXTURE_EXTERNAL_OES, texture_id); if (matrix_callback_.is_null()) return; float mtx[16]; - surface_texture_bridge_->GetTransformMatrix(mtx); + surface_texture_->GetTransformMatrix(mtx); // Only query the matrix once we have bound a valid frame. if (has_updated_ && memcmp(current_matrix_, mtx, sizeof(mtx)) != 0) { @@ -120,7 +120,7 @@ void StreamTextureManagerAndroid::RegisterStreamTextureProxy( base::Unretained(this), route_id); stream_texture->set_matrix_changed_callback(matrix_cb); - stream_texture->surface_texture_bridge()->SetFrameAvailableCallback( + stream_texture->surface_texture()->SetFrameAvailableCallback( frame_cb); } } @@ -133,7 +133,7 @@ void StreamTextureManagerAndroid::EstablishStreamTexture( if (stream_texture) { SurfaceTexturePeer::GetInstance()->EstablishSurfaceTexturePeer( process, - stream_texture->surface_texture_bridge(), + stream_texture->surface_texture(), primary_id, secondary_id); } diff --git a/content/common/gpu/stream_texture_manager_android.h b/content/common/gpu/stream_texture_manager_android.h index 9da84d9..e1bfda4 100644 --- a/content/common/gpu/stream_texture_manager_android.h +++ b/content/common/gpu/stream_texture_manager_android.h @@ -17,7 +17,7 @@ struct GpuStreamTextureMsg_MatrixChanged_Params; namespace gfx { class Size; -class SurfaceTextureBridge; +class SurfaceTexture; } namespace content { @@ -57,8 +57,8 @@ class StreamTextureManagerAndroid : public gpu::StreamTextureManager { virtual void Update() OVERRIDE; virtual gfx::Size GetSize() OVERRIDE; - scoped_refptr<gfx::SurfaceTextureBridge> surface_texture_bridge() { - return surface_texture_bridge_; + scoped_refptr<gfx::SurfaceTexture> surface_texture() { + return surface_texture_; } // Called when a new frame is available. @@ -78,7 +78,7 @@ class StreamTextureManagerAndroid : public gpu::StreamTextureManager { } private: - scoped_refptr<gfx::SurfaceTextureBridge> surface_texture_bridge_; + scoped_refptr<gfx::SurfaceTexture> surface_texture_; // Current transform matrix of the surface texture. float current_matrix_[16]; diff --git a/content/renderer/media/android/stream_texture_factory_android_synchronous_impl.cc b/content/renderer/media/android/stream_texture_factory_android_synchronous_impl.cc index e6c0cdf..1027923 100644 --- a/content/renderer/media/android/stream_texture_factory_android_synchronous_impl.cc +++ b/content/renderer/media/android/stream_texture_factory_android_synchronous_impl.cc @@ -16,7 +16,7 @@ #include "cc/output/context_provider.h" #include "content/common/android/surface_texture_peer.h" #include "third_party/WebKit/public/platform/WebGraphicsContext3D.h" -#include "ui/gl/android/surface_texture_bridge.h" +#include "ui/gl/android/surface_texture.h" namespace content { @@ -46,7 +46,7 @@ class StreamTextureProxyImpl scoped_refptr<StreamTextureFactorySynchronousImpl::ContextProvider> context_provider_; - scoped_refptr<gfx::SurfaceTextureBridge> surface_texture_; + scoped_refptr<gfx::SurfaceTexture> surface_texture_; float current_matrix_[16]; bool has_updated_; @@ -129,7 +129,7 @@ StreamTextureProxy* StreamTextureFactorySynchronousImpl::CreateProxy() { void StreamTextureFactorySynchronousImpl::EstablishPeer(int32 stream_id, int player_id) { - scoped_refptr<gfx::SurfaceTextureBridge> surface_texture = + scoped_refptr<gfx::SurfaceTexture> surface_texture = context_provider_->GetSurfaceTexture(stream_id); if (surface_texture) { SurfaceTexturePeer::GetInstance()->EstablishSurfaceTexturePeer( diff --git a/content/renderer/media/android/stream_texture_factory_android_synchronous_impl.h b/content/renderer/media/android/stream_texture_factory_android_synchronous_impl.h index 50f9e80..8b6ab6f 100644 --- a/content/renderer/media/android/stream_texture_factory_android_synchronous_impl.h +++ b/content/renderer/media/android/stream_texture_factory_android_synchronous_impl.h @@ -9,7 +9,7 @@ #include "content/renderer/media/android/stream_texture_factory_android.h" namespace gfx { -class SurfaceTextureBridge; +class SurfaceTexture; } namespace WebKit { @@ -23,7 +23,7 @@ class StreamTextureFactorySynchronousImpl : public StreamTextureFactory { public: class ContextProvider : public base::RefCountedThreadSafe<ContextProvider> { public: - virtual scoped_refptr<gfx::SurfaceTextureBridge> GetSurfaceTexture( + virtual scoped_refptr<gfx::SurfaceTexture> GetSurfaceTexture( uint32 stream_id) = 0; virtual WebKit::WebGraphicsContext3D* Context3d() = 0; diff --git a/gpu/command_buffer/client/gl_in_process_context.cc b/gpu/command_buffer/client/gl_in_process_context.cc index 984214d..a8e33b6 100644 --- a/gpu/command_buffer/client/gl_in_process_context.cc +++ b/gpu/command_buffer/client/gl_in_process_context.cc @@ -31,7 +31,7 @@ #include "ui/gl/gl_image.h" #if defined(OS_ANDROID) -#include "ui/gl/android/surface_texture_bridge.h" +#include "ui/gl/android/surface_texture.h" #endif namespace gpu { @@ -70,7 +70,7 @@ class GLInProcessContextImpl virtual gles2::GLES2Implementation* GetImplementation() OVERRIDE; #if defined(OS_ANDROID) - virtual scoped_refptr<gfx::SurfaceTextureBridge> GetSurfaceTexture( + virtual scoped_refptr<gfx::SurfaceTexture> GetSurfaceTexture( uint32 stream_id) OVERRIDE; #endif @@ -343,7 +343,7 @@ void GLInProcessContextImpl::SignalQuery( } #if defined(OS_ANDROID) -scoped_refptr<gfx::SurfaceTextureBridge> +scoped_refptr<gfx::SurfaceTexture> GLInProcessContextImpl::GetSurfaceTexture(uint32 stream_id) { return command_buffer_->GetSurfaceTexture(stream_id); } diff --git a/gpu/command_buffer/client/gl_in_process_context.h b/gpu/command_buffer/client/gl_in_process_context.h index ec7bdc5..3fe82aa 100644 --- a/gpu/command_buffer/client/gl_in_process_context.h +++ b/gpu/command_buffer/client/gl_in_process_context.h @@ -18,7 +18,7 @@ class Size; #if defined(OS_ANDROID) namespace gfx { -class SurfaceTextureBridge; +class SurfaceTexture; } #endif @@ -81,7 +81,7 @@ class GLES2_IMPL_EXPORT GLInProcessContext { virtual gles2::GLES2Implementation* GetImplementation() = 0; #if defined(OS_ANDROID) - virtual scoped_refptr<gfx::SurfaceTextureBridge> GetSurfaceTexture( + virtual scoped_refptr<gfx::SurfaceTexture> GetSurfaceTexture( uint32 stream_id) = 0; #endif }; diff --git a/gpu/command_buffer/service/in_process_command_buffer.cc b/gpu/command_buffer/service/in_process_command_buffer.cc index 6b9fe8a..3c1249a 100644 --- a/gpu/command_buffer/service/in_process_command_buffer.cc +++ b/gpu/command_buffer/service/in_process_command_buffer.cc @@ -36,7 +36,7 @@ #if defined(OS_ANDROID) #include "gpu/command_buffer/service/stream_texture_manager_in_process_android.h" -#include "ui/gl/android/surface_texture_bridge.h" +#include "ui/gl/android/surface_texture.h" #endif namespace gpu { @@ -728,7 +728,7 @@ base::Closure InProcessCommandBuffer::WrapCallback( } #if defined(OS_ANDROID) -scoped_refptr<gfx::SurfaceTextureBridge> +scoped_refptr<gfx::SurfaceTexture> InProcessCommandBuffer::GetSurfaceTexture(uint32 stream_id) { DCHECK(stream_texture_manager_); return stream_texture_manager_->GetSurfaceTexture(stream_id); diff --git a/gpu/command_buffer/service/in_process_command_buffer.h b/gpu/command_buffer/service/in_process_command_buffer.h index 3caf4aa..64b466f 100644 --- a/gpu/command_buffer/service/in_process_command_buffer.h +++ b/gpu/command_buffer/service/in_process_command_buffer.h @@ -33,7 +33,7 @@ class Size; #if defined(OS_ANDROID) namespace gfx { -class SurfaceTextureBridge; +class SurfaceTexture; } namespace gpu { class StreamTextureManagerInProcess; @@ -126,7 +126,7 @@ class GPU_EXPORT InProcessCommandBuffer : public CommandBuffer, }; #if defined(OS_ANDROID) - scoped_refptr<gfx::SurfaceTextureBridge> GetSurfaceTexture( + scoped_refptr<gfx::SurfaceTexture> GetSurfaceTexture( uint32 stream_id); #endif diff --git a/gpu/command_buffer/service/stream_texture_manager_in_process_android.cc b/gpu/command_buffer/service/stream_texture_manager_in_process_android.cc index 0a6c4c9..2fd5535 100644 --- a/gpu/command_buffer/service/stream_texture_manager_in_process_android.cc +++ b/gpu/command_buffer/service/stream_texture_manager_in_process_android.cc @@ -6,7 +6,7 @@ #include "base/bind.h" #include "ui/gfx/size.h" -#include "ui/gl/android/surface_texture_bridge.h" +#include "ui/gl/android/surface_texture.h" #include "ui/gl/gl_bindings.h" namespace gpu { @@ -14,7 +14,7 @@ namespace gpu { StreamTextureManagerInProcess::StreamTextureImpl::StreamTextureImpl( uint32 service_id, uint32 stream_id) - : surface_texture_bridge_(new gfx::SurfaceTextureBridge(service_id)), + : surface_texture_(new gfx::SurfaceTexture(service_id)), stream_id_(stream_id) {} StreamTextureManagerInProcess::StreamTextureImpl::~StreamTextureImpl() {} @@ -22,7 +22,7 @@ StreamTextureManagerInProcess::StreamTextureImpl::~StreamTextureImpl() {} void StreamTextureManagerInProcess::StreamTextureImpl::Update() { GLint texture_id = 0; glGetIntegerv(GL_TEXTURE_BINDING_EXTERNAL_OES, &texture_id); - surface_texture_bridge_->UpdateTexImage(); + surface_texture_->UpdateTexImage(); glBindTexture(GL_TEXTURE_EXTERNAL_OES, texture_id); } @@ -34,9 +34,9 @@ void StreamTextureManagerInProcess::StreamTextureImpl::SetSize(gfx::Size size) { size_ = size; } -scoped_refptr<gfx::SurfaceTextureBridge> +scoped_refptr<gfx::SurfaceTexture> StreamTextureManagerInProcess::StreamTextureImpl::GetSurfaceTexture() { - return surface_texture_bridge_; + return surface_texture_; } StreamTextureManagerInProcess::StreamTextureManagerInProcess() : next_id_(1) {} @@ -77,7 +77,7 @@ gpu::StreamTexture* StreamTextureManagerInProcess::LookupStreamTexture( return NULL; } -scoped_refptr<gfx::SurfaceTextureBridge> +scoped_refptr<gfx::SurfaceTexture> StreamTextureManagerInProcess::GetSurfaceTexture(uint32 stream_id) { base::AutoLock lock(map_lock_); for (TextureMap::iterator it = textures_.begin(); it != textures_.end(); diff --git a/gpu/command_buffer/service/stream_texture_manager_in_process_android.h b/gpu/command_buffer/service/stream_texture_manager_in_process_android.h index 70ec024..6753c13 100644 --- a/gpu/command_buffer/service/stream_texture_manager_in_process_android.h +++ b/gpu/command_buffer/service/stream_texture_manager_in_process_android.h @@ -15,7 +15,7 @@ namespace gfx { class Size; -class SurfaceTextureBridge; +class SurfaceTexture; } namespace gpu { @@ -32,7 +32,7 @@ class StreamTextureManagerInProcess virtual void DestroyStreamTexture(uint32 service_id) OVERRIDE; virtual gpu::StreamTexture* LookupStreamTexture(uint32 service_id) OVERRIDE; - scoped_refptr<gfx::SurfaceTextureBridge> GetSurfaceTexture(uint32 stream_id); + scoped_refptr<gfx::SurfaceTexture> GetSurfaceTexture(uint32 stream_id); private: class StreamTextureImpl : public gpu::StreamTexture { @@ -46,11 +46,11 @@ class StreamTextureManagerInProcess void SetSize(gfx::Size size); - scoped_refptr<gfx::SurfaceTextureBridge> GetSurfaceTexture(); + scoped_refptr<gfx::SurfaceTexture> GetSurfaceTexture(); uint32 stream_id() { return stream_id_; } private: - scoped_refptr<gfx::SurfaceTextureBridge> surface_texture_bridge_; + scoped_refptr<gfx::SurfaceTexture> surface_texture_; uint32 stream_id_; gfx::Size size_; diff --git a/gpu/command_buffer/tests/gl_unittests_android.cc b/gpu/command_buffer/tests/gl_unittests_android.cc index 870bedb..671676a 100644 --- a/gpu/command_buffer/tests/gl_unittests_android.cc +++ b/gpu/command_buffer/tests/gl_unittests_android.cc @@ -15,7 +15,7 @@ #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" #include "ui/gfx/native_widget_types.h" -#include "ui/gl/android/surface_texture_bridge.h" +#include "ui/gl/android/surface_texture.h" #include "ui/gl/gl_surface.h" namespace gpu { @@ -38,8 +38,8 @@ TEST_F(GLSurfaceTextureTest, SimpleTest) { // abstraction for the SurfaceTexture in this test. GLuint texture = 0xFEEDBEEF; - scoped_refptr<gfx::SurfaceTextureBridge> surface_texture( - new gfx::SurfaceTextureBridge(texture)); + scoped_refptr<gfx::SurfaceTexture> surface_texture( + new gfx::SurfaceTexture(texture)); gfx::AcceleratedWidget window = surface_texture->CreateSurface(); EXPECT_TRUE(window != NULL); diff --git a/media/base/android/media_source_player_unittest.cc b/media/base/android/media_source_player_unittest.cc index 02ded2d..77cca95 100644 --- a/media/base/android/media_source_player_unittest.cc +++ b/media/base/android/media_source_player_unittest.cc @@ -13,7 +13,7 @@ #include "media/base/decoder_buffer.h" #include "media/base/test_data_util.h" #include "testing/gmock/include/gmock/gmock.h" -#include "ui/gl/android/surface_texture_bridge.h" +#include "ui/gl/android/surface_texture.h" namespace media { @@ -221,8 +221,8 @@ TEST_F(MediaSourcePlayerTest, StartVideoCodecWithValidSurface) { return; // Test video decoder job will be created when surface is valid. - scoped_refptr<gfx::SurfaceTextureBridge> surface_texture( - new gfx::SurfaceTextureBridge(0)); + scoped_refptr<gfx::SurfaceTexture> surface_texture( + new gfx::SurfaceTexture(0)); gfx::ScopedJavaSurface surface(surface_texture.get()); StartVideoDecoderJob(); // Video decoder job will not be created until surface is available. @@ -242,8 +242,8 @@ TEST_F(MediaSourcePlayerTest, StartVideoCodecWithInvalidSurface) { return; // Test video decoder job will be created when surface is valid. - scoped_refptr<gfx::SurfaceTextureBridge> surface_texture( - new gfx::SurfaceTextureBridge(0)); + scoped_refptr<gfx::SurfaceTexture> surface_texture( + new gfx::SurfaceTexture(0)); gfx::ScopedJavaSurface surface(surface_texture.get()); StartVideoDecoderJob(); // Video decoder job will not be created until surface is available. @@ -283,8 +283,8 @@ TEST_F(MediaSourcePlayerTest, SetSurfaceWhileSeeking) { // Test SetVideoSurface() will not cause an extra seek while the player is // waiting for a seek ACK. - scoped_refptr<gfx::SurfaceTextureBridge> surface_texture( - new gfx::SurfaceTextureBridge(0)); + scoped_refptr<gfx::SurfaceTexture> surface_texture( + new gfx::SurfaceTexture(0)); gfx::ScopedJavaSurface surface(surface_texture.get()); StartVideoDecoderJob(); // Player is still waiting for SetVideoSurface(), so no request is sent. @@ -387,8 +387,8 @@ TEST_F(MediaSourcePlayerTest, DecoderJobsCannotStartWithoutAudio) { Start(params); EXPECT_EQ(0, manager_->num_requests()); - scoped_refptr<gfx::SurfaceTextureBridge> surface_texture( - new gfx::SurfaceTextureBridge(0)); + scoped_refptr<gfx::SurfaceTexture> surface_texture( + new gfx::SurfaceTexture(0)); gfx::ScopedJavaSurface surface(surface_texture.get()); player_->SetVideoSurface(surface.Pass()); EXPECT_EQ(1u, manager_->last_seek_request_id()); @@ -448,8 +448,8 @@ TEST_F(MediaSourcePlayerTest, NoRequestForDataAfterInputEOS) { // Test MediaSourcePlayer will not request for new data after input EOS is // reached. - scoped_refptr<gfx::SurfaceTextureBridge> surface_texture( - new gfx::SurfaceTextureBridge(0)); + scoped_refptr<gfx::SurfaceTexture> surface_texture( + new gfx::SurfaceTexture(0)); gfx::ScopedJavaSurface surface(surface_texture.get()); player_->SetVideoSurface(surface.Pass()); StartVideoDecoderJob(); diff --git a/ui/android/java/src/org/chromium/ui/gfx/SurfaceTextureBridge.java b/ui/android/java/src/org/chromium/ui/gfx/SurfaceTexturePlatformWrapper.java index 2333a01..cd8e407 100644 --- a/ui/android/java/src/org/chromium/ui/gfx/SurfaceTextureBridge.java +++ b/ui/android/java/src/org/chromium/ui/gfx/SurfaceTexturePlatformWrapper.java @@ -15,7 +15,7 @@ import org.chromium.base.JNINamespace; * provide a stable JNI API. */ @JNINamespace("gfx") -class SurfaceTextureBridge { +class SurfaceTexturePlatformWrapper { @CalledByNative private static SurfaceTexture create(int textureId) { return new SurfaceTexture(textureId); diff --git a/ui/gl/android/gl_jni_registrar.cc b/ui/gl/android/gl_jni_registrar.cc index cba90ce..91ae65f 100644 --- a/ui/gl/android/gl_jni_registrar.cc +++ b/ui/gl/android/gl_jni_registrar.cc @@ -6,7 +6,7 @@ #include "base/android/jni_android.h" #include "base/android/jni_registrar.h" -#include "ui/gl/android/surface_texture_bridge.h" +#include "ui/gl/android/surface_texture.h" #include "ui/gl/android/surface_texture_listener.h" namespace ui { @@ -14,8 +14,8 @@ namespace gl { namespace android { static base::android::RegistrationMethod kGLRegisteredMethods[] = { - { "SurfaceTextureBridge", - gfx::SurfaceTextureBridge::RegisterSurfaceTextureBridge }, + { "SurfaceTexture", + gfx::SurfaceTexture::RegisterSurfaceTexture }, { "SurfaceTextureListener", gfx::SurfaceTextureListener::RegisterSurfaceTextureListener }, }; diff --git a/ui/gl/android/scoped_java_surface.cc b/ui/gl/android/scoped_java_surface.cc index fe6a75e..36f635f 100644 --- a/ui/gl/android/scoped_java_surface.cc +++ b/ui/gl/android/scoped_java_surface.cc @@ -6,7 +6,7 @@ #include "base/logging.h" #include "jni/Surface_jni.h" -#include "ui/gl/android/surface_texture_bridge.h" +#include "ui/gl/android/surface_texture.h" namespace { @@ -37,7 +37,7 @@ ScopedJavaSurface::ScopedJavaSurface( } ScopedJavaSurface::ScopedJavaSurface( - const SurfaceTextureBridge* surface_texture) + const SurfaceTexture* surface_texture) : auto_release_(true), is_protected_(false) { JNIEnv* env = base::android::AttachCurrentThread(); diff --git a/ui/gl/android/scoped_java_surface.h b/ui/gl/android/scoped_java_surface.h index b50485b..54ed2a4 100644 --- a/ui/gl/android/scoped_java_surface.h +++ b/ui/gl/android/scoped_java_surface.h @@ -13,7 +13,7 @@ namespace gfx { -class SurfaceTextureBridge; +class SurfaceTexture; // A helper class for holding a scoped reference to a Java Surface instance. // When going out of scope, Surface.release() is called on the Java object to @@ -29,7 +29,7 @@ class GL_EXPORT ScopedJavaSurface { // Creates a Java Surface from a SurfaceTexture and wraps it in a // ScopedJavaSurface. - explicit ScopedJavaSurface(const SurfaceTextureBridge* surface_texture); + explicit ScopedJavaSurface(const SurfaceTexture* surface_texture); // Move constructor. Take the surface from another ScopedJavaSurface object, // the latter no longer owns the surface afterwards. diff --git a/ui/gl/android/surface_texture_bridge.cc b/ui/gl/android/surface_texture.cc index 9f2a337..d900972 100644 --- a/ui/gl/android/surface_texture_bridge.cc +++ b/ui/gl/android/surface_texture.cc @@ -1,8 +1,8 @@ -// Copyright (c) 2013 The Chromium Authors. All rights reserved. +// Copyright 2013 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "ui/gl/android/surface_texture_bridge.h" +#include "ui/gl/android/surface_texture.h" #include <android/native_window_jni.h> @@ -10,7 +10,7 @@ #include "base/android/build_info.h" #include "base/android/jni_android.h" #include "base/logging.h" -#include "jni/SurfaceTextureBridge_jni.h" +#include "jni/SurfaceTexturePlatformWrapper_jni.h" #include "ui/gl/android/scoped_java_surface.h" #include "ui/gl/android/surface_texture_listener.h" #include "ui/gl/gl_bindings.h" @@ -26,36 +26,38 @@ bool GlContextMethodsAvailable() { namespace gfx { -SurfaceTextureBridge::SurfaceTextureBridge(int texture_id) { +SurfaceTexture::SurfaceTexture(int texture_id) { JNIEnv* env = base::android::AttachCurrentThread(); - j_surface_texture_.Reset(Java_SurfaceTextureBridge_create(env, texture_id)); + j_surface_texture_.Reset( + Java_SurfaceTexturePlatformWrapper_create(env, texture_id)); } -SurfaceTextureBridge::~SurfaceTextureBridge() { +SurfaceTexture::~SurfaceTexture() { JNIEnv* env = base::android::AttachCurrentThread(); - Java_SurfaceTextureBridge_destroy(env, j_surface_texture_.obj()); + Java_SurfaceTexturePlatformWrapper_destroy(env, j_surface_texture_.obj()); } -void SurfaceTextureBridge::SetFrameAvailableCallback( +void SurfaceTexture::SetFrameAvailableCallback( const base::Closure& callback) { JNIEnv* env = base::android::AttachCurrentThread(); - Java_SurfaceTextureBridge_setFrameAvailableCallback( + Java_SurfaceTexturePlatformWrapper_setFrameAvailableCallback( env, j_surface_texture_.obj(), reinterpret_cast<int>(new SurfaceTextureListener(callback))); } -void SurfaceTextureBridge::UpdateTexImage() { +void SurfaceTexture::UpdateTexImage() { JNIEnv* env = base::android::AttachCurrentThread(); - Java_SurfaceTextureBridge_updateTexImage(env, j_surface_texture_.obj()); + Java_SurfaceTexturePlatformWrapper_updateTexImage(env, + j_surface_texture_.obj()); } -void SurfaceTextureBridge::GetTransformMatrix(float mtx[16]) { +void SurfaceTexture::GetTransformMatrix(float mtx[16]) { JNIEnv* env = base::android::AttachCurrentThread(); base::android::ScopedJavaLocalRef<jfloatArray> jmatrix( env, env->NewFloatArray(16)); - Java_SurfaceTextureBridge_getTransformMatrix( + Java_SurfaceTexturePlatformWrapper_getTransformMatrix( env, j_surface_texture_.obj(), jmatrix.obj()); jboolean is_copy; @@ -66,11 +68,11 @@ void SurfaceTextureBridge::GetTransformMatrix(float mtx[16]) { env->ReleaseFloatArrayElements(jmatrix.obj(), elements, JNI_ABORT); } -void SurfaceTextureBridge::SetDefaultBufferSize(int width, int height) { +void SurfaceTexture::SetDefaultBufferSize(int width, int height) { JNIEnv* env = base::android::AttachCurrentThread(); if (width > 0 && height > 0) { - Java_SurfaceTextureBridge_setDefaultBufferSize( + Java_SurfaceTexturePlatformWrapper_setDefaultBufferSize( env, j_surface_texture_.obj(), static_cast<jint>(width), static_cast<jint>(height)); } else { @@ -79,26 +81,26 @@ void SurfaceTextureBridge::SetDefaultBufferSize(int width, int height) { } } -void SurfaceTextureBridge::AttachToGLContext() { +void SurfaceTexture::AttachToGLContext() { if (GlContextMethodsAvailable()) { int texture_id; glGetIntegerv(GL_TEXTURE_BINDING_EXTERNAL_OES, &texture_id); DCHECK(texture_id); JNIEnv* env = base::android::AttachCurrentThread(); - Java_SurfaceTextureBridge_attachToGLContext( + Java_SurfaceTexturePlatformWrapper_attachToGLContext( env, j_surface_texture_.obj(), texture_id); } } -void SurfaceTextureBridge::DetachFromGLContext() { +void SurfaceTexture::DetachFromGLContext() { if (GlContextMethodsAvailable()) { JNIEnv* env = base::android::AttachCurrentThread(); - Java_SurfaceTextureBridge_detachFromGLContext( + Java_SurfaceTexturePlatformWrapper_detachFromGLContext( env, j_surface_texture_.obj()); } } -ANativeWindow* SurfaceTextureBridge::CreateSurface() { +ANativeWindow* SurfaceTexture::CreateSurface() { JNIEnv* env = base::android::AttachCurrentThread(); ScopedJavaSurface surface(this); ANativeWindow* native_window = ANativeWindow_fromSurface( @@ -107,7 +109,7 @@ ANativeWindow* SurfaceTextureBridge::CreateSurface() { } // static -bool SurfaceTextureBridge::RegisterSurfaceTextureBridge(JNIEnv* env) { +bool SurfaceTexture::RegisterSurfaceTexture(JNIEnv* env) { return RegisterNativesImpl(env); } diff --git a/ui/gl/android/surface_texture_bridge.h b/ui/gl/android/surface_texture.h index 474f0c2..62e375f 100644 --- a/ui/gl/android/surface_texture_bridge.h +++ b/ui/gl/android/surface_texture.h @@ -1,9 +1,9 @@ -// Copyright (c) 2013 The Chromium Authors. All rights reserved. +// Copyright 2013 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef UI_GL_ANDROID_SURFACE_TEXTURE_BRIDGE_H_ -#define UI_GL_ANDROID_SURFACE_TEXTURE_BRIDGE_H_ +#ifndef UI_GL_ANDROID_SURFACE_TEXTURE_H_ +#define UI_GL_ANDROID_SURFACE_TEXTURE_H_ #include <jni.h> @@ -18,10 +18,10 @@ namespace gfx { // This class serves as a bridge for native code to call java functions inside // android SurfaceTexture class. -class GL_EXPORT SurfaceTextureBridge - : public base::RefCountedThreadSafe<SurfaceTextureBridge>{ +class GL_EXPORT SurfaceTexture + : public base::RefCountedThreadSafe<SurfaceTexture>{ public: - explicit SurfaceTextureBridge(int texture_id); + explicit SurfaceTexture(int texture_id); // Set the listener callback, which will be invoked on the same thread that // is being called from here for registration. @@ -57,18 +57,18 @@ class GL_EXPORT SurfaceTextureBridge return j_surface_texture_; } - static bool RegisterSurfaceTextureBridge(JNIEnv* env); + static bool RegisterSurfaceTexture(JNIEnv* env); private: - friend class base::RefCountedThreadSafe<SurfaceTextureBridge>; - ~SurfaceTextureBridge(); + friend class base::RefCountedThreadSafe<SurfaceTexture>; + ~SurfaceTexture(); // Java SurfaceTexture instance. base::android::ScopedJavaGlobalRef<jobject> j_surface_texture_; - DISALLOW_COPY_AND_ASSIGN(SurfaceTextureBridge); + DISALLOW_COPY_AND_ASSIGN(SurfaceTexture); }; } // namespace gfx -#endif // UI_GL_ANDROID_SURFACE_TEXTURE_BRIDGE_H_ +#endif // UI_GL_ANDROID_SURFACE_TEXTURE_H_ diff --git a/ui/gl/android/surface_texture_listener.cc b/ui/gl/android/surface_texture_listener.cc index 39d8468..8e2f89c 100644 --- a/ui/gl/android/surface_texture_listener.cc +++ b/ui/gl/android/surface_texture_listener.cc @@ -8,7 +8,7 @@ #include "base/logging.h" #include "base/message_loop/message_loop_proxy.h" #include "jni/SurfaceTextureListener_jni.h" -#include "ui/gl/android/surface_texture_bridge.h" +#include "ui/gl/android/surface_texture.h" namespace gfx { diff --git a/ui/gl/android/surface_texture_listener.h b/ui/gl/android/surface_texture_listener.h index 60103aa..823bc30 100644 --- a/ui/gl/android/surface_texture_listener.h +++ b/ui/gl/android/surface_texture_listener.h @@ -33,7 +33,7 @@ class GL_EXPORT SurfaceTextureListener { SurfaceTextureListener(const base::Closure& callback); ~SurfaceTextureListener(); - friend class SurfaceTextureBridge; + friend class SurfaceTexture; base::Closure callback_; diff --git a/ui/gl/gl.gyp b/ui/gl/gl.gyp index 139a88f..bee5874 100644 --- a/ui/gl/gl.gyp +++ b/ui/gl/gl.gyp @@ -44,8 +44,8 @@ 'android/gl_jni_registrar.h', 'android/scoped_java_surface.cc', 'android/scoped_java_surface.h', - 'android/surface_texture_bridge.cc', - 'android/surface_texture_bridge.h', + 'android/surface_texture.cc', + 'android/surface_texture.h', 'android/surface_texture_listener.cc', 'android/surface_texture_listener.h', 'gl_bindings.h', @@ -328,7 +328,7 @@ 'surface_jni_headers', ], 'sources': [ - '../android/java/src/org/chromium/ui/gfx/SurfaceTextureBridge.java', + '../android/java/src/org/chromium/ui/gfx/SurfaceTexturePlatformWrapper.java', '../android/java/src/org/chromium/ui/gfx/SurfaceTextureListener.java', ], 'variables': { |