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..ba9f0ebfbed6a6f75196c29a7bf89da933557773 100644 |
--- a/content/common/gpu/client/context_provider_command_buffer.cc |
+++ b/content/common/gpu/client/context_provider_command_buffer.cc |
@@ -105,9 +105,6 @@ 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))); |
return true; |
} |
@@ -241,6 +238,13 @@ void ContextProviderCommandBuffer::SetMemoryPolicyChangedCallback( |
DCHECK(memory_policy_changed_callback_.is_null() || |
memory_policy_changed_callback.is_null()); |
memory_policy_changed_callback_ = memory_policy_changed_callback; |
+ |
+ if (!memory_policy_changed_callback_.is_null()) { |
+ DCHECK(context3d_->GetCommandBufferProxy()); |
+ context3d_->GetCommandBufferProxy()->SetMemoryAllocationChangedCallback( |
+ base::Bind(&ContextProviderCommandBuffer::OnMemoryAllocationChanged, |
+ base::Unretained(this))); |
+ } |
} |
} // namespace content |