Chromium Code Reviews| Index: content/common/gpu/client/context_provider_command_buffer.cc |
| diff --git a/content/common/gpu/client/context_provider_command_buffer.cc b/content/common/gpu/client/context_provider_command_buffer.cc |
| index cb827258a5fdf8c271bc0d3eb73874d9a5bc7fe4..e4409285f7a08eb841bc9d679a5540fbb8394857 100644 |
| --- a/content/common/gpu/client/context_provider_command_buffer.cc |
| +++ b/content/common/gpu/client/context_provider_command_buffer.cc |
| @@ -43,15 +43,19 @@ ContextProviderCommandBuffer::Create( |
| if (!context3d) |
| return NULL; |
| - return new ContextProviderCommandBuffer(context3d.Pass(), type); |
| + const bool enable_memory_allocation_callback = true; |
| + return new ContextProviderCommandBuffer(context3d.Pass(), type, |
| + enable_memory_allocation_callback); |
| } |
| ContextProviderCommandBuffer::ContextProviderCommandBuffer( |
| scoped_ptr<WebGraphicsContext3DCommandBufferImpl> context3d, |
| - CommandBufferContextType type) |
| + CommandBufferContextType type, |
| + bool enable_memory_allocation_callback) |
| : context3d_(context3d.Pass()), |
| context_type_(type), |
| debug_name_(CommandBufferContextTypeToString(type)), |
| + enable_memory_allocation_callback_(enable_memory_allocation_callback), |
| destroyed_(false) { |
| DCHECK(main_thread_checker_.CalledOnValidThread()); |
| DCHECK(context3d_); |
| @@ -105,9 +109,12 @@ bool ContextProviderCommandBuffer::BindToCurrentThread() { |
| context3d_->traceBeginCHROMIUM("gpu_toplevel", unique_context_name.c_str()); |
| lost_context_callback_proxy_.reset(new LostContextCallbackProxy(this)); |
| - context3d_->GetCommandBufferProxy()->SetMemoryAllocationChangedCallback( |
| - base::Bind(&ContextProviderCommandBuffer::OnMemoryAllocationChanged, |
| - base::Unretained(this))); |
| + |
| + if (enable_memory_allocation_callback_) { |
| + context3d_->GetCommandBufferProxy()->SetMemoryAllocationChangedCallback( |
|
no sievers
2015/08/05 22:50:32
Wait, can you just move this code to SetMemoryPoli
boliu
2015/08/06 01:30:33
Totally thought about that!
But... enabling callb
boliu
2015/08/06 01:41:37
And then I realize these two things actually happe
|
| + base::Bind(&ContextProviderCommandBuffer::OnMemoryAllocationChanged, |
| + base::Unretained(this))); |
| + } |
| return true; |
| } |