| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/common/gpu/client/context_provider_command_buffer.h" | 5 #include "content/common/gpu/client/context_provider_command_buffer.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/callback_helpers.h" | 10 #include "base/callback_helpers.h" |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 void ContextProviderCommandBuffer::OnLostContext() { | 165 void ContextProviderCommandBuffer::OnLostContext() { |
| 166 DCHECK(context_thread_checker_.CalledOnValidThread()); | 166 DCHECK(context_thread_checker_.CalledOnValidThread()); |
| 167 { | 167 { |
| 168 base::AutoLock lock(main_thread_lock_); | 168 base::AutoLock lock(main_thread_lock_); |
| 169 if (destroyed_) | 169 if (destroyed_) |
| 170 return; | 170 return; |
| 171 destroyed_ = true; | 171 destroyed_ = true; |
| 172 } | 172 } |
| 173 if (!lost_context_callback_.is_null()) | 173 if (!lost_context_callback_.is_null()) |
| 174 base::ResetAndReturn(&lost_context_callback_).Run(); | 174 base::ResetAndReturn(&lost_context_callback_).Run(); |
| 175 if (gr_context_) |
| 176 gr_context_->OnLostContext(); |
| 175 } | 177 } |
| 176 | 178 |
| 177 void ContextProviderCommandBuffer::OnMemoryAllocationChanged( | 179 void ContextProviderCommandBuffer::OnMemoryAllocationChanged( |
| 178 const gpu::MemoryAllocation& allocation) { | 180 const gpu::MemoryAllocation& allocation) { |
| 179 DCHECK(context_thread_checker_.CalledOnValidThread()); | 181 DCHECK(context_thread_checker_.CalledOnValidThread()); |
| 180 | 182 |
| 181 if (gr_context_) { | 183 if (gr_context_) { |
| 182 bool nonzero_allocation = !!allocation.bytes_limit_when_visible; | 184 bool nonzero_allocation = !!allocation.bytes_limit_when_visible; |
| 183 gr_context_->SetMemoryLimit(nonzero_allocation); | 185 gr_context_->SetMemoryLimit(nonzero_allocation); |
| 184 } | 186 } |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 | 221 |
| 220 void ContextProviderCommandBuffer::SetMemoryPolicyChangedCallback( | 222 void ContextProviderCommandBuffer::SetMemoryPolicyChangedCallback( |
| 221 const MemoryPolicyChangedCallback& memory_policy_changed_callback) { | 223 const MemoryPolicyChangedCallback& memory_policy_changed_callback) { |
| 222 DCHECK(context_thread_checker_.CalledOnValidThread()); | 224 DCHECK(context_thread_checker_.CalledOnValidThread()); |
| 223 DCHECK(memory_policy_changed_callback_.is_null() || | 225 DCHECK(memory_policy_changed_callback_.is_null() || |
| 224 memory_policy_changed_callback.is_null()); | 226 memory_policy_changed_callback.is_null()); |
| 225 memory_policy_changed_callback_ = memory_policy_changed_callback; | 227 memory_policy_changed_callback_ = memory_policy_changed_callback; |
| 226 } | 228 } |
| 227 | 229 |
| 228 } // namespace content | 230 } // namespace content |
| OLD | NEW |