| 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/test/test_context_provider.h" | 5 #include "cc/test/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 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 DCHECK(bound_); | 178 DCHECK(bound_); |
| 179 DCHECK(context_thread_checker_.CalledOnValidThread()); | 179 DCHECK(context_thread_checker_.CalledOnValidThread()); |
| 180 | 180 |
| 181 return context3d_.get(); | 181 return context3d_.get(); |
| 182 } | 182 } |
| 183 | 183 |
| 184 TestWebGraphicsContext3D* TestContextProvider::UnboundTestContext3d() { | 184 TestWebGraphicsContext3D* TestContextProvider::UnboundTestContext3d() { |
| 185 return context3d_.get(); | 185 return context3d_.get(); |
| 186 } | 186 } |
| 187 | 187 |
| 188 void TestContextProvider::SetMemoryAllocation( | |
| 189 const ManagedMemoryPolicy& policy) { | |
| 190 if (memory_policy_changed_callback_.is_null()) | |
| 191 return; | |
| 192 memory_policy_changed_callback_.Run(policy); | |
| 193 } | |
| 194 | |
| 195 void TestContextProvider::SetLostContextCallback( | 188 void TestContextProvider::SetLostContextCallback( |
| 196 const LostContextCallback& cb) { | 189 const LostContextCallback& cb) { |
| 197 DCHECK(context_thread_checker_.CalledOnValidThread()); | 190 DCHECK(context_thread_checker_.CalledOnValidThread()); |
| 198 DCHECK(lost_context_callback_.is_null() || cb.is_null()); | 191 DCHECK(lost_context_callback_.is_null() || cb.is_null()); |
| 199 lost_context_callback_ = cb; | 192 lost_context_callback_ = cb; |
| 200 } | 193 } |
| 201 | 194 |
| 202 void TestContextProvider::SetMemoryPolicyChangedCallback( | |
| 203 const MemoryPolicyChangedCallback& cb) { | |
| 204 DCHECK(context_thread_checker_.CalledOnValidThread()); | |
| 205 DCHECK(memory_policy_changed_callback_.is_null() || cb.is_null()); | |
| 206 memory_policy_changed_callback_ = cb; | |
| 207 } | |
| 208 | |
| 209 void TestContextProvider::SetMaxTransferBufferUsageBytes( | 195 void TestContextProvider::SetMaxTransferBufferUsageBytes( |
| 210 size_t max_transfer_buffer_usage_bytes) { | 196 size_t max_transfer_buffer_usage_bytes) { |
| 211 context3d_->SetMaxTransferBufferUsageBytes(max_transfer_buffer_usage_bytes); | 197 context3d_->SetMaxTransferBufferUsageBytes(max_transfer_buffer_usage_bytes); |
| 212 } | 198 } |
| 213 | 199 |
| 214 } // namespace cc | 200 } // namespace cc |
| OLD | NEW |