Chromium Code Reviews| 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 ff485a74dcf36996da8fe032202a001bbca35d47..ec65f8ed88a4d59b9276f57edea29adf31c4ac2e 100644 |
| --- a/content/common/gpu/gpu_command_buffer_stub.cc |
| +++ b/content/common/gpu/gpu_command_buffer_stub.cc |
| @@ -9,10 +9,13 @@ |
| #include "base/command_line.h" |
| #include "base/debug/trace_event.h" |
| #include "base/shared_memory.h" |
| +#include "base/time.h" |
| #include "build/build_config.h" |
| #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_allocation.h" |
| +#include "content/common/gpu/gpu_memory_manager.h" |
| #include "content/common/gpu/gpu_messages.h" |
| #include "content/common/gpu/gpu_watchdog.h" |
| #include "content/common/gpu/image_transport_surface.h" |
| @@ -20,6 +23,14 @@ |
| #include "ui/gfx/gl/gl_bindings.h" |
| #include "ui/gfx/gl/gl_switches.h" |
| +GpuCommandBufferStub::SurfaceState::SurfaceState(int32 surface_id, |
| + bool visible, |
|
nduca
2012/02/01 00:01:17
Awkward indent.
|
| + base::TimeTicks last_used_time) |
| + : surface_id(surface_id), |
| + visible(visible), |
| + last_used_time(last_used_time) { |
| +} |
| + |
| GpuCommandBufferStub::GpuCommandBufferStub( |
| GpuChannel* channel, |
| GpuCommandBufferStub* share_group, |
| @@ -43,7 +54,8 @@ GpuCommandBufferStub::GpuCommandBufferStub( |
| route_id_(route_id), |
| software_(software), |
| last_flush_count_(0), |
| - surface_id_(surface_id), |
| + surface_state_(), |
|
nduca
2012/02/01 00:01:17
not needed since its an scoped_ptr.
|
| + affected_surface_ids_(), |
|
nduca
2012/02/01 00:01:17
not needed.
|
| parent_stub_for_initialization_(), |
| parent_texture_for_initialization_(0), |
| watchdog_(watchdog) { |
| @@ -54,13 +66,16 @@ GpuCommandBufferStub::GpuCommandBufferStub( |
| bool bind_generates_resource = true; |
| context_group_ = new gpu::gles2::ContextGroup(bind_generates_resource); |
| } |
| + if (surface_id != 0) |
| + surface_state_.reset(new GpuCommandBufferStubBase::SurfaceState( |
| + surface_id, true, base::TimeTicks::Now())); |
| } |
| GpuCommandBufferStub::~GpuCommandBufferStub() { |
| Destroy(); |
| GpuChannelManager* gpu_channel_manager = channel_->gpu_channel_manager(); |
| - gpu_channel_manager->Send(new GpuHostMsg_DestroyCommandBuffer(surface_id_)); |
| + gpu_channel_manager->Send(new GpuHostMsg_DestroyCommandBuffer(surface_id())); |
| } |
| bool GpuCommandBufferStub::OnMessageReceived(const IPC::Message& message) { |
| @@ -153,6 +168,8 @@ void GpuCommandBufferStub::Destroy() { |
| context_ = NULL; |
| surface_ = NULL; |
| + |
| + channel_->gpu_channel_manager()->gpu_memory_manager()->ScheduleManage(); |
| } |
| void GpuCommandBufferStub::OnInitializeFailed(IPC::Message* reply_message) { |
| @@ -274,6 +291,8 @@ void GpuCommandBufferStub::OnInitialize( |
| GpuCommandBufferMsg_Initialize::WriteReplyParams(reply_message, true); |
| Send(reply_message); |
| + |
| + channel_->gpu_channel_manager()->gpu_memory_manager()->ScheduleManage(); |
| } |
| void GpuCommandBufferStub::OnSetGetBuffer( |
| @@ -496,6 +515,10 @@ void GpuCommandBufferStub::OnDestroyVideoDecoder(int decoder_route_id) { |
| void GpuCommandBufferStub::OnSetSurfaceVisible(bool visible) { |
| surface_->SetVisible(visible); |
| + DCHECK(surface_state_.get()); |
| + surface_state_->visible = visible; |
| + surface_state_->last_used_time = base::TimeTicks::Now(); |
| + channel_->gpu_channel_manager()->gpu_memory_manager()->ScheduleManage(); |
| } |
| void GpuCommandBufferStub::SendConsoleMessage( |
| @@ -510,4 +533,17 @@ void GpuCommandBufferStub::SendConsoleMessage( |
| Send(msg); |
| } |
| +GpuCommandBufferStubBase::SurfaceState* GpuCommandBufferStub::surface_state() { |
| + return surface_state_.get(); |
| +} |
| + |
| +const std::vector<int32>& GpuCommandBufferStub::affected_surface_ids() { |
| + return affected_surface_ids_; |
| +} |
| + |
| +void GpuCommandBufferStub::SendMemoryAllocationToProxy( |
| + const GpuMemoryAllocation& allocation) { |
| + // TODO(mmocny): Send callback once gl extensions are added. |
| +} |
| + |
| #endif // defined(ENABLE_GPU) |