Index: content/common/gpu/gpu_command_buffer_stub.cc |
diff --git a/content/common/gpu/gpu_command_buffer_stub.cc b/content/common/gpu/gpu_command_buffer_stub.cc |
index 37f50a8cdf4c5b597c27a323d10d63d07bfffefd..b7496318fb6234576767c98479dbde559c05d8df 100644 |
--- a/content/common/gpu/gpu_command_buffer_stub.cc |
+++ b/content/common/gpu/gpu_command_buffer_stub.cc |
@@ -14,6 +14,7 @@ |
#include "content/common/gpu/gpu_channel.h" |
#include "content/common/gpu/gpu_channel_manager.h" |
#include "content/common/gpu/gpu_command_buffer_stub.h" |
+#include "content/common/gpu/gpu_memory_buffer_factory.h" |
#include "content/common/gpu/gpu_memory_manager.h" |
#include "content/common/gpu/gpu_memory_tracking.h" |
#include "content/common/gpu/gpu_messages.h" |
@@ -28,7 +29,6 @@ |
#include "gpu/command_buffer/common/mailbox.h" |
#include "gpu/command_buffer/service/gl_context_virtual.h" |
#include "gpu/command_buffer/service/gl_state_restorer_impl.h" |
-#include "gpu/command_buffer/service/gpu_control_service.h" |
#include "gpu/command_buffer/service/image_manager.h" |
#include "gpu/command_buffer/service/logger.h" |
#include "gpu/command_buffer/service/mailbox_manager.h" |
@@ -118,7 +118,6 @@ GpuCommandBufferStub::GpuCommandBufferStub( |
GpuCommandBufferStub* share_group, |
const gfx::GLSurfaceHandle& handle, |
gpu::gles2::MailboxManager* mailbox_manager, |
- gpu::gles2::ImageManager* image_manager, |
const gfx::Size& size, |
const gpu::gles2::DisallowedFeatures& disallowed_features, |
const std::vector<int32>& attribs, |
@@ -160,7 +159,6 @@ GpuCommandBufferStub::GpuCommandBufferStub( |
} else { |
context_group_ = new gpu::gles2::ContextGroup( |
mailbox_manager, |
- image_manager, |
new GpuCommandBufferMemoryTracker(channel), |
channel_->gpu_channel_manager()->shader_translator_cache(), |
NULL, |
@@ -540,9 +538,6 @@ void GpuCommandBufferStub::OnInitialize( |
return; |
} |
- gpu_control_service_.reset( |
- new gpu::GpuControlService(context_group_->image_manager(), NULL)); |
- |
if (CommandLine::ForCurrentProcess()->HasSwitch( |
switches::kEnableGPUServiceLogging)) { |
decoder_->set_log_commands(true); |
@@ -917,7 +912,7 @@ void GpuCommandBufferStub::OnSetClientHasMemoryAllocationChangedCallback( |
void GpuCommandBufferStub::OnRegisterGpuMemoryBuffer( |
int32 id, |
- gfx::GpuMemoryBufferHandle gpu_memory_buffer, |
+ gfx::GpuMemoryBufferHandle handle, |
uint32 width, |
uint32 height, |
uint32 internalformat) { |
@@ -931,16 +926,36 @@ void GpuCommandBufferStub::OnRegisterGpuMemoryBuffer( |
return; |
} |
#endif |
- if (gpu_control_service_) { |
- gpu_control_service_->RegisterGpuMemoryBuffer( |
- id, gpu_memory_buffer, width, height, internalformat); |
+ |
+ GpuChannelManager* manager = channel_->gpu_channel_manager(); |
+ scoped_refptr<gfx::GLImage> image = |
+ manager->gpu_memory_buffer_factory()->CreateImageForGpuMemoryBuffer( |
+ handle, |
+ gfx::Size(width, height), |
+ internalformat, |
+ channel()->client_id()); |
+ if (!image) |
+ return; |
+ |
+ // For Android specific workaround. |
+ if (context_group_->feature_info()->workarounds().release_image_after_use) |
+ image->SetReleaseAfterUse(); |
+ |
+ if (decoder_) { |
+ gpu::gles2::ImageManager* image_manager = decoder_->GetImageManager(); |
+ if (image_manager) |
+ image_manager->AddImage(image, id); |
} |
} |
void GpuCommandBufferStub::OnDestroyGpuMemoryBuffer(int32 id) { |
TRACE_EVENT0("gpu", "GpuCommandBufferStub::OnDestroyGpuMemoryBuffer"); |
- if (gpu_control_service_) |
- gpu_control_service_->UnregisterGpuMemoryBuffer(id); |
+ |
+ if (decoder_) { |
+ gpu::gles2::ImageManager* image_manager = decoder_->GetImageManager(); |
+ if (image_manager) |
+ image_manager->RemoveImage(id); |
+ } |
} |
void GpuCommandBufferStub::SendConsoleMessage( |