| Index: content/common/gpu/gpu_channel.cc
|
| diff --git a/content/common/gpu/gpu_channel.cc b/content/common/gpu/gpu_channel.cc
|
| index 2e26fac38c8d46fd40989c96e341067b1deff168..2439be94cce3cf257f4070817fafe9479b7b6775 100644
|
| --- a/content/common/gpu/gpu_channel.cc
|
| +++ b/content/common/gpu/gpu_channel.cc
|
| @@ -38,7 +38,8 @@
|
| #endif
|
|
|
| #if defined(OS_ANDROID)
|
| -#include "content/common/gpu/stream_texture_manager_android.h"
|
| +#include "content/common/android/surface_texture_peer.h"
|
| +#include "ui/gl/android/gl_image_stream.h"
|
| #endif
|
|
|
| namespace content {
|
| @@ -456,9 +457,6 @@ GpuChannel::GpuChannel(GpuChannelManager* gpu_channel_manager,
|
| log_messages_ = command_line->HasSwitch(switches::kLogPluginMessages);
|
| disallowed_features_.multisampling =
|
| command_line->HasSwitch(switches::kDisableGLMultisampling);
|
| -#if defined(OS_ANDROID)
|
| - stream_texture_manager_.reset(new StreamTextureManagerAndroid(this));
|
| -#endif
|
| }
|
|
|
|
|
| @@ -900,24 +898,74 @@ void GpuChannel::OnDestroyCommandBuffer(int32 route_id) {
|
| }
|
|
|
| #if defined(OS_ANDROID)
|
| +namespace {
|
| +
|
| +void SendFrameAvailable(const base::WeakPtr<GpuChannel>& channel,
|
| + int32 route_id) {
|
| + if (channel)
|
| + channel->Send(new GpuStreamTextureMsg_FrameAvailable(route_id));
|
| +}
|
| +
|
| +void SendMatrixChanged(const base::WeakPtr<GpuChannel>& channel,
|
| + int32 route_id,
|
| + const gfx::GLImageStream::Matrix& matrix) {
|
| + if (channel) {
|
| + GpuStreamTextureMsg_MatrixChanged_Params params;
|
| + memcpy(¶ms.m00, matrix.components, sizeof(matrix.components));
|
| + channel->Send(new GpuStreamTextureMsg_MatrixChanged(route_id, params));
|
| + }
|
| +}
|
| +
|
| +} // anonymous namespace
|
| +
|
| void GpuChannel::OnRegisterStreamTextureProxy(
|
| int32 stream_id, int32* route_id) {
|
| - // Note that route_id is only used for notifications sent out from here.
|
| - // StreamTextureManager owns all texture objects and for incoming messages
|
| - // it finds the correct object based on stream_id.
|
| *route_id = GenerateRouteID();
|
| - stream_texture_manager_->RegisterStreamTextureProxy(stream_id, *route_id);
|
| + scoped_refptr<gfx::GLImage> image(image_manager_->LookupImage(stream_id));
|
| + if (!image)
|
| + return;
|
| +
|
| + scoped_refptr<gfx::GLImageStream> stream(image->AsGLImageStream());
|
| + if (!stream)
|
| + return;
|
| +
|
| + base::Closure frame_callback =
|
| + base::Bind(&SendFrameAvailable, weak_factory_.GetWeakPtr(), *route_id);
|
| + gfx::GLImageStream::MatrixChangedCallBack matrix_callback =
|
| + base::Bind(&SendMatrixChanged, weak_factory_.GetWeakPtr(), *route_id);
|
| +
|
| + stream->SetMatrixChangedCallback(matrix_callback);
|
| + stream->SetFrameAvailableCallback(frame_callback);
|
| }
|
|
|
| void GpuChannel::OnEstablishStreamTexture(
|
| int32 stream_id, int32 primary_id, int32 secondary_id) {
|
| - stream_texture_manager_->EstablishStreamTexture(
|
| - stream_id, primary_id, secondary_id);
|
| + scoped_refptr<gfx::GLImage> image(image_manager_->LookupImage(stream_id));
|
| + if (!image)
|
| + return;
|
| +
|
| + scoped_refptr<gfx::GLImageStream> stream(image->AsGLImageStream());
|
| + if (!stream)
|
| + return;
|
| +
|
| + SurfaceTexturePeer::GetInstance()->EstablishSurfaceTexturePeer(
|
| + renderer_pid(),
|
| + stream->GetSurfaceTexture(),
|
| + primary_id,
|
| + secondary_id);
|
| }
|
|
|
| void GpuChannel::OnSetStreamTextureSize(
|
| int32 stream_id, const gfx::Size& size) {
|
| - stream_texture_manager_->SetStreamTextureSize(stream_id, size);
|
| + scoped_refptr<gfx::GLImage> image(image_manager_->LookupImage(stream_id));
|
| + if (!image)
|
| + return;
|
| +
|
| + scoped_refptr<gfx::GLImageStream> stream(image->AsGLImageStream());
|
| + if (!stream)
|
| + return;
|
| +
|
| + stream->SetSize(size);
|
| }
|
| #endif
|
|
|
|
|