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

Unified Diff: content/common/gpu/gpu_channel.cc

Issue 22824009: Remove StreamTextureManager (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address comments Created 7 years, 4 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
« no previous file with comments | « content/common/gpu/gpu_channel.h ('k') | content/common/gpu/gpu_command_buffer_stub.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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(&params.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
« no previous file with comments | « content/common/gpu/gpu_channel.h ('k') | content/common/gpu/gpu_command_buffer_stub.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698