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 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 DCHECK(bound_); | 152 DCHECK(bound_); |
153 DCHECK(context_thread_checker_.CalledOnValidThread()); | 153 DCHECK(context_thread_checker_.CalledOnValidThread()); |
154 | 154 |
155 return context3d_.get(); | 155 return context3d_.get(); |
156 } | 156 } |
157 | 157 |
158 TestWebGraphicsContext3D* TestContextProvider::UnboundTestContext3d() { | 158 TestWebGraphicsContext3D* TestContextProvider::UnboundTestContext3d() { |
159 return context3d_.get(); | 159 return context3d_.get(); |
160 } | 160 } |
161 | 161 |
| 162 void TestContextProvider::SetMemoryAllocation( |
| 163 const ManagedMemoryPolicy& policy) { |
| 164 if (memory_policy_changed_callback_.is_null()) |
| 165 return; |
| 166 memory_policy_changed_callback_.Run(policy); |
| 167 } |
| 168 |
162 void TestContextProvider::SetLostContextCallback( | 169 void TestContextProvider::SetLostContextCallback( |
163 const LostContextCallback& cb) { | 170 const LostContextCallback& cb) { |
164 DCHECK(context_thread_checker_.CalledOnValidThread()); | 171 DCHECK(context_thread_checker_.CalledOnValidThread()); |
165 DCHECK(lost_context_callback_.is_null() || cb.is_null()); | 172 DCHECK(lost_context_callback_.is_null() || cb.is_null()); |
166 lost_context_callback_ = cb; | 173 lost_context_callback_ = cb; |
167 } | 174 } |
168 | 175 |
| 176 void TestContextProvider::SetMemoryPolicyChangedCallback( |
| 177 const MemoryPolicyChangedCallback& cb) { |
| 178 DCHECK(context_thread_checker_.CalledOnValidThread()); |
| 179 DCHECK(memory_policy_changed_callback_.is_null() || cb.is_null()); |
| 180 memory_policy_changed_callback_ = cb; |
| 181 } |
| 182 |
169 void TestContextProvider::SetMaxTransferBufferUsageBytes( | 183 void TestContextProvider::SetMaxTransferBufferUsageBytes( |
170 size_t max_transfer_buffer_usage_bytes) { | 184 size_t max_transfer_buffer_usage_bytes) { |
171 context3d_->SetMaxTransferBufferUsageBytes(max_transfer_buffer_usage_bytes); | 185 context3d_->SetMaxTransferBufferUsageBytes(max_transfer_buffer_usage_bytes); |
172 } | 186 } |
173 | 187 |
174 } // namespace cc | 188 } // namespace cc |
OLD | NEW |