| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "cc/debug/test_context_provider.h" | 5 #include "cc/debug/test_context_provider.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 } | 184 } |
| 185 | 185 |
| 186 TestWebGraphicsContext3D* TestContextProvider::UnboundTestContext3d() { | 186 TestWebGraphicsContext3D* TestContextProvider::UnboundTestContext3d() { |
| 187 DCHECK(context3d_); | 187 DCHECK(context3d_); |
| 188 DCHECK(context_thread_checker_.CalledOnValidThread()); | 188 DCHECK(context_thread_checker_.CalledOnValidThread()); |
| 189 | 189 |
| 190 return context3d_.get(); | 190 return context3d_.get(); |
| 191 } | 191 } |
| 192 | 192 |
| 193 void TestContextProvider::SetMemoryAllocation( | 193 void TestContextProvider::SetMemoryAllocation( |
| 194 const ManagedMemoryPolicy& policy, | 194 const ManagedMemoryPolicy& policy) { |
| 195 bool discard_backbuffer_when_not_visible) { | |
| 196 if (memory_policy_changed_callback_.is_null()) | 195 if (memory_policy_changed_callback_.is_null()) |
| 197 return; | 196 return; |
| 198 memory_policy_changed_callback_.Run( | 197 memory_policy_changed_callback_.Run(policy); |
| 199 policy, discard_backbuffer_when_not_visible); | |
| 200 } | 198 } |
| 201 | 199 |
| 202 void TestContextProvider::SetLostContextCallback( | 200 void TestContextProvider::SetLostContextCallback( |
| 203 const LostContextCallback& cb) { | 201 const LostContextCallback& cb) { |
| 204 DCHECK(context_thread_checker_.CalledOnValidThread()); | 202 DCHECK(context_thread_checker_.CalledOnValidThread()); |
| 205 DCHECK(lost_context_callback_.is_null() || cb.is_null()); | 203 DCHECK(lost_context_callback_.is_null() || cb.is_null()); |
| 206 lost_context_callback_ = cb; | 204 lost_context_callback_ = cb; |
| 207 } | 205 } |
| 208 | 206 |
| 209 void TestContextProvider::SetSwapBuffersCompleteCallback( | 207 void TestContextProvider::SetSwapBuffersCompleteCallback( |
| 210 const SwapBuffersCompleteCallback& cb) { | 208 const SwapBuffersCompleteCallback& cb) { |
| 211 DCHECK(context_thread_checker_.CalledOnValidThread()); | 209 DCHECK(context_thread_checker_.CalledOnValidThread()); |
| 212 DCHECK(swap_buffers_complete_callback_.is_null() || cb.is_null()); | 210 DCHECK(swap_buffers_complete_callback_.is_null() || cb.is_null()); |
| 213 swap_buffers_complete_callback_ = cb; | 211 swap_buffers_complete_callback_ = cb; |
| 214 } | 212 } |
| 215 | 213 |
| 216 void TestContextProvider::SetMemoryPolicyChangedCallback( | 214 void TestContextProvider::SetMemoryPolicyChangedCallback( |
| 217 const MemoryPolicyChangedCallback& cb) { | 215 const MemoryPolicyChangedCallback& cb) { |
| 218 DCHECK(context_thread_checker_.CalledOnValidThread()); | 216 DCHECK(context_thread_checker_.CalledOnValidThread()); |
| 219 DCHECK(memory_policy_changed_callback_.is_null() || cb.is_null()); | 217 DCHECK(memory_policy_changed_callback_.is_null() || cb.is_null()); |
| 220 memory_policy_changed_callback_ = cb; | 218 memory_policy_changed_callback_ = cb; |
| 221 } | 219 } |
| 222 | 220 |
| 223 void TestContextProvider::SetMaxTransferBufferUsageBytes( | 221 void TestContextProvider::SetMaxTransferBufferUsageBytes( |
| 224 size_t max_transfer_buffer_usage_bytes) { | 222 size_t max_transfer_buffer_usage_bytes) { |
| 225 context3d_->SetMaxTransferBufferUsageBytes(max_transfer_buffer_usage_bytes); | 223 context3d_->SetMaxTransferBufferUsageBytes(max_transfer_buffer_usage_bytes); |
| 226 } | 224 } |
| 227 | 225 |
| 228 } // namespace cc | 226 } // namespace cc |
| OLD | NEW |