diff options
author | piman@chromium.org <piman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-04 00:30:52 +0000 |
---|---|---|
committer | piman@chromium.org <piman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-04 00:30:52 +0000 |
commit | 15c16be96c04ab9fa99ee36bddb83616ec923390 (patch) | |
tree | d805cfa0ebed57949df8d0821c8b603196b76099 /content/common | |
parent | 27e2d6d0edec99e8af428489c4ac503406d9c009 (diff) | |
download | chromium_src-15c16be96c04ab9fa99ee36bddb83616ec923390.zip chromium_src-15c16be96c04ab9fa99ee36bddb83616ec923390.tar.gz chromium_src-15c16be96c04ab9fa99ee36bddb83616ec923390.tar.bz2 |
Remove TransportTexture, it's unused
BUG=None
TEST=compiles
Review URL: http://codereview.chromium.org/9049013
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@116235 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/common')
-rw-r--r-- | content/common/gpu/gpu_channel.cc | 32 | ||||
-rw-r--r-- | content/common/gpu/gpu_channel.h | 16 | ||||
-rw-r--r-- | content/common/gpu/gpu_messages.h | 41 | ||||
-rw-r--r-- | content/common/gpu/transport_texture.cc | 108 | ||||
-rw-r--r-- | content/common/gpu/transport_texture.h | 100 |
5 files changed, 3 insertions, 294 deletions
diff --git a/content/common/gpu/gpu_channel.cc b/content/common/gpu/gpu_channel.cc index 177a5e4..2d2d2a7 100644 --- a/content/common/gpu/gpu_channel.cc +++ b/content/common/gpu/gpu_channel.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 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. @@ -16,7 +16,6 @@ #include "content/common/child_process.h" #include "content/common/gpu/gpu_channel_manager.h" #include "content/common/gpu/gpu_messages.h" -#include "content/common/gpu/transport_texture.h" #include "content/public/common/content_client.h" #include "content/public/common/content_switches.h" #include "ui/gfx/gl/gl_context.h" @@ -62,15 +61,6 @@ GpuChannel::~GpuChannel() { #endif } -TransportTexture* GpuChannel::GetTransportTexture(int32 route_id) { - return transport_textures_.Lookup(route_id); -} - -void GpuChannel::DestroyTransportTexture(int32 route_id) { - transport_textures_.Remove(route_id); - router_.RemoveRoute(route_id); -} - bool GpuChannel::OnMessageReceived(const IPC::Message& message) { if (log_messages_) { DVLOG(1) << "received message @" << &message << " on channel @" << this @@ -227,8 +217,6 @@ bool GpuChannel::OnControlMessageReceived(const IPC::Message& msg) { OnCreateOffscreenCommandBuffer) IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuChannelMsg_DestroyCommandBuffer, OnDestroyCommandBuffer) - IPC_MESSAGE_HANDLER(GpuChannelMsg_CreateTransportTexture, - OnCreateTransportTexture) IPC_MESSAGE_HANDLER(GpuChannelMsg_Echo, OnEcho); IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuChannelMsg_WillGpuSwitchOccur, OnWillGpuSwitchOccur) @@ -374,24 +362,6 @@ void GpuChannel::OnDestroyCommandBuffer(int32 route_id, Send(reply_message); } -void GpuChannel::OnCreateTransportTexture(int32 context_route_id, - int32 host_id) { - #if defined(ENABLE_GPU) - GpuCommandBufferStub* stub = stubs_.Lookup(context_route_id); - int32 route_id = GenerateRouteID(); - - scoped_ptr<TransportTexture> transport( - new TransportTexture(this, channel_.get(), stub->decoder(), - host_id, route_id)); - router_.AddRoute(route_id, transport.get()); - transport_textures_.AddWithID(transport.release(), route_id); - - IPC::Message* msg = new GpuTransportTextureHostMsg_TransportTextureCreated( - host_id, route_id); - Send(msg); - #endif -} - void GpuChannel::OnEcho(const IPC::Message& message) { TRACE_EVENT0("gpu", "GpuCommandBufferStub::OnEcho"); Send(new IPC::Message(message)); diff --git a/content/common/gpu/gpu_channel.h b/content/common/gpu/gpu_channel.h index bc642ac..59acdb1 100644 --- a/content/common/gpu/gpu_channel.h +++ b/content/common/gpu/gpu_channel.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 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. @@ -26,7 +26,6 @@ class GpuChannelManager; struct GPUCreateCommandBufferConfig; class GpuWatchdog; -class TransportTexture; namespace base { class MessageLoopProxy; @@ -97,13 +96,6 @@ class GpuChannel : public IPC::Channel::Listener, // Destroy channel and all contained contexts. void DestroySoon(); - // Get the TransportTexture by ID. - TransportTexture* GetTransportTexture(int32 route_id); - - // Destroy the TransportTexture by ID. This method is only called by - // TransportTexture to delete and detach itself. - void DestroyTransportTexture(int32 route_id); - // Generate a route ID guaranteed to be unique for this channel. int GenerateRouteID(); @@ -130,8 +122,6 @@ class GpuChannel : public IPC::Channel::Listener, IPC::Message* reply_message); void OnDestroyCommandBuffer(int32 route_id, IPC::Message* reply_message); - void OnCreateTransportTexture(int32 context_route_id, int32 host_id); - void OnEcho(const IPC::Message& message); void OnWillGpuSwitchOccur(bool is_creating_context, @@ -172,10 +162,6 @@ class GpuChannel : public IPC::Channel::Listener, StubMap stubs_; #endif // defined (ENABLE_GPU) - // A collection of transport textures created. - typedef IDMap<TransportTexture, IDMapOwnPointer> TransportTextureMap; - TransportTextureMap transport_textures_; - bool log_messages_; // True if we should log sent and received messages. gpu::gles2::DisallowedFeatures disallowed_features_; GpuWatchdog* watchdog_; diff --git a/content/common/gpu/gpu_messages.h b/content/common/gpu/gpu_messages.h index bc01c61..b8aa94f 100644 --- a/content/common/gpu/gpu_messages.h +++ b/content/common/gpu/gpu_messages.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 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. @@ -286,11 +286,6 @@ IPC_SYNC_MESSAGE_CONTROL2_1(GpuChannelMsg_CreateOffscreenCommandBuffer, IPC_SYNC_MESSAGE_CONTROL1_0(GpuChannelMsg_DestroyCommandBuffer, int32 /* instance_id */) -// Create a TransportTexture corresponding to |host_id|. -IPC_MESSAGE_CONTROL2(GpuChannelMsg_CreateTransportTexture, - int32, /* context_route_id */ - int32 /* host_id */) - // Request that the GPU process reply with the given message. IPC_MESSAGE_CONTROL1(GpuChannelMsg_Echo, IPC::Message /* reply */) @@ -424,40 +419,6 @@ IPC_MESSAGE_ROUTED0(GpuCommandBufferMsg_EchoAck) IPC_MESSAGE_ROUTED1(GpuCommandBufferMsg_SetSurfaceVisible, bool /* visible */) -// -------------------------------------------------------------------------- -// TransportTexture messages -// -// These are messages sent from renderer process to the GPU proess. - -// Destroy corresponding TransportTexture in the GPU process. -IPC_MESSAGE_ROUTED0(GpuTransportTextureMsg_Destroy) - -// Notify that the textures have been created. IDs are in client context. -IPC_MESSAGE_ROUTED1(GpuTransportTextureMsg_TexturesCreated, - std::vector<int> /* texture IDs */) - -// -------------------------------------------------------------------------- -// -// These are messages sent from GPU process to the renderer process. - -// TransportTexture is created in the GPU process with the ID. -IPC_MESSAGE_ROUTED1(GpuTransportTextureHostMsg_TransportTextureCreated, - int32 /* id */) - -// Allocate video frames for output of the hardware video decoder. -IPC_MESSAGE_ROUTED4(GpuTransportTextureHostMsg_CreateTextures, - int32, /* Number of texturess to generate */ - uint32, /* Width of the texture */ - uint32, /* Height of the texture */ - int32 /* Format of the texture */) - -// Instruct the renderer to release all generated textures. -IPC_MESSAGE_ROUTED0(GpuTransportTextureHostMsg_ReleaseTextures) - -// Notify a texture has been updated. The texture id is in the client context. -IPC_MESSAGE_ROUTED1(GpuTransportTextureHostMsg_TextureUpdated, - int /* texture_id */) - //------------------------------------------------------------------------------ // Accelerated Video Decoder Messages // These messages are sent from Renderer process to GPU process. diff --git a/content/common/gpu/transport_texture.cc b/content/common/gpu/transport_texture.cc deleted file mode 100644 index 3084549..0000000 --- a/content/common/gpu/transport_texture.cc +++ /dev/null @@ -1,108 +0,0 @@ -// Copyright (c) 2011 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 "content/common/gpu/gpu_channel.h" -#include "content/common/gpu/gpu_messages.h" -#include "content/common/gpu/transport_texture.h" - -TransportTexture::TransportTexture(GpuChannel* channel, - IPC::Message::Sender* sender, - gpu::gles2::GLES2Decoder* decoder, - int32 host_id, - int32 route_id) - : channel_(channel), - sender_(sender), - decoder_(decoder), - host_id_(host_id), - route_id_(route_id), - output_textures_(NULL) { -} - -TransportTexture::~TransportTexture() { -} - -void TransportTexture::CreateTextures( - int n, int width, int height, Format format, std::vector<int>* textures, - const base::Closure& callback) { - output_textures_ = textures; - DCHECK(create_callback_.is_null()); - create_callback_ = callback; - - bool ret = sender_->Send(new GpuTransportTextureHostMsg_CreateTextures( - host_id_, n, width, height, static_cast<int>(format))); - if (!ret) { - DLOG(ERROR) << "GpuTransportTexture_CreateTextures failed"; - } -} - -void TransportTexture::ReleaseTextures() { - texture_map_.clear(); - - bool ret = sender_->Send(new GpuTransportTextureHostMsg_ReleaseTextures( - host_id_)); - if (!ret) { - DLOG(ERROR) << "GpuTransportTexture_ReleaseTextures failed"; - } -} - -void TransportTexture::TextureUpdated(int texture_id) { - TextureMap::iterator iter = texture_map_.find(texture_id); - if (iter == texture_map_.end()) { - DLOG(ERROR) << "Texture not found: " << texture_id; - return; - } - - bool ret = sender_->Send(new GpuTransportTextureHostMsg_TextureUpdated( - host_id_, iter->second)); - if (!ret) { - DLOG(ERROR) << "GpuTransportTexture_TextureUpdated failed"; - } -} - -void TransportTexture::OnChannelConnected(int32 peer_pid) { -} - -void TransportTexture::OnChannelError() { -} - -bool TransportTexture::OnMessageReceived(const IPC::Message& msg) { - bool handled = true; - IPC_BEGIN_MESSAGE_MAP(TransportTexture, msg) - IPC_MESSAGE_HANDLER(GpuTransportTextureMsg_Destroy, - OnDestroy) - IPC_MESSAGE_HANDLER(GpuTransportTextureMsg_TexturesCreated, - OnTexturesCreated) - IPC_MESSAGE_UNHANDLED(handled = false) - IPC_END_MESSAGE_MAP() - DCHECK(handled); - return handled; -} - -void TransportTexture::OnDestroy() { - channel_->DestroyTransportTexture(route_id_); -} - -void TransportTexture::OnTexturesCreated(const std::vector<int>& textures) { - bool ret = decoder_->MakeCurrent(); - if (!ret) { - DLOG(ERROR) << "Failed to switch context"; - return; - } - - output_textures_->clear(); - for (size_t i = 0; i < textures.size(); ++i) { - uint32 gl_texture = 0; - - // Translate the client texture id to service texture id. - ret = decoder_->GetServiceTextureId(textures[i], &gl_texture); - DCHECK(ret) << "Cannot translate client texture ID to service ID"; - output_textures_->push_back(gl_texture); - texture_map_.insert(std::make_pair(gl_texture, textures[i])); - } - - // Notify user that textures are ready. - create_callback_.Run(); - create_callback_.Reset(); - output_textures_ = NULL; -} diff --git a/content/common/gpu/transport_texture.h b/content/common/gpu/transport_texture.h deleted file mode 100644 index 9f13ec4..0000000 --- a/content/common/gpu/transport_texture.h +++ /dev/null @@ -1,100 +0,0 @@ -// Copyright (c) 2011 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. - -// This clasis used together with TansportTextureHost in the renderer process -// to provide a mechanism for an object in the GPU process to create textures -// and be used in the renderer process. -// -// See content/gpu/transport_texture_host.h for usage and details. - -#ifndef CONTENT_COMMON_GPU_TRANSPORT_TEXTURE_H_ -#define CONTENT_COMMON_GPU_TRANSPORT_TEXTURE_H_ - -#include <vector> -#include <map> - -#include "base/basictypes.h" -#include "base/memory/scoped_ptr.h" -#include "base/task.h" -#include "ipc/ipc_channel.h" - -class GpuChannel; - -namespace gpu { -namespace gles2 { -class GLES2Decoder; -} // namespace gles2 -} // namespace gpu - -class TransportTexture : public IPC::Channel::Listener { - public: - enum Format { - RGBA, // GL_RGBA - }; - - // |channel| is the owner of this object. - // |sender| is used to send send IPC messages. - // |decoder| is the decoder for GLES2 command buffer, used to convert texture - // IDs. - // |host_id| is ID of TransportTextureHost in Renderer process. - // |id| is ID of this object in GpuChannel. - TransportTexture(GpuChannel* channel, - IPC::Message::Sender* sender, - gpu::gles2::GLES2Decoder* decoder, - int32 host_id, - int32 route_id); - virtual ~TransportTexture(); - - // Create a set of textures of specified size and format. They will be - // stored in |textures| and |callback| will be called. - // Textures IDs stored in |textures| are in the system GL context. - void CreateTextures(int n, int width, int height, Format format, - std::vector<int>* textures, - const base::Closure& callback); - - - // Release all textures that have previously been allocated. - void ReleaseTextures(); - - // Notify that the texture has been updated. Notification will be sent to the - // renderer process. - void TextureUpdated(int texture_id); - - // IPC::Channel::Listener implementation. - virtual void OnChannelConnected(int32 peer_pid) OVERRIDE; - virtual void OnChannelError() OVERRIDE; - virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE; - - private: - // Mapping from service (GPU) IDs to client (Renderer) IDs. - typedef std::map<int, int> TextureMap; - - /////////////////////////////////////////////////////////////////////////// - // IPC Message Handlers - void OnDestroy(); - void OnTexturesCreated(const std::vector<int>& textures); - - GpuChannel* channel_; - IPC::Message::Sender* sender_; - gpu::gles2::GLES2Decoder* decoder_; - - // ID of TransportTextureHost in the Renderer process. - int32 host_id_; - - // ID of this object in GpuChannel. - int32 route_id_; - - // Output pointer to write generated textures. - std::vector<int>* output_textures_; - - // Callback that gets called when textures are generated. - base::Closure create_callback_; - - // Mapping between service (GPU) IDs to client (Renderer) IDs. - TextureMap texture_map_; - - DISALLOW_COPY_AND_ASSIGN(TransportTexture); -}; - -#endif // CONTENT_COMMON_GPU_TRANSPORT_TEXTURE_H_ |