| 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 "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/callback_helpers.h" | 8 #include "base/callback_helpers.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "cc/debug/test_web_graphics_context_3d.h" | 10 #include "cc/debug/test_web_graphics_context_3d.h" |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 if (!lost_context_callback_.is_null()) | 168 if (!lost_context_callback_.is_null()) |
| 169 base::ResetAndReturn(&lost_context_callback_).Run(); | 169 base::ResetAndReturn(&lost_context_callback_).Run(); |
| 170 } | 170 } |
| 171 | 171 |
| 172 void TestContextProvider::OnSwapBuffersComplete() { | 172 void TestContextProvider::OnSwapBuffersComplete() { |
| 173 DCHECK(context_thread_checker_.CalledOnValidThread()); | 173 DCHECK(context_thread_checker_.CalledOnValidThread()); |
| 174 if (!swap_buffers_complete_callback_.is_null()) | 174 if (!swap_buffers_complete_callback_.is_null()) |
| 175 swap_buffers_complete_callback_.Run(); | 175 swap_buffers_complete_callback_.Run(); |
| 176 } | 176 } |
| 177 | 177 |
| 178 TestWebGraphicsContext3D* TestContextProvider::TestContext3d() { |
| 179 DCHECK(context3d_); |
| 180 DCHECK(bound_); |
| 181 DCHECK(context_thread_checker_.CalledOnValidThread()); |
| 182 |
| 183 return context3d_.get(); |
| 184 } |
| 185 |
| 186 TestWebGraphicsContext3D* TestContextProvider::UnboundTestContext3d() { |
| 187 DCHECK(context3d_); |
| 188 DCHECK(context_thread_checker_.CalledOnValidThread()); |
| 189 |
| 190 return context3d_.get(); |
| 191 } |
| 192 |
| 178 void TestContextProvider::SetMemoryAllocation( | 193 void TestContextProvider::SetMemoryAllocation( |
| 179 const ManagedMemoryPolicy& policy, | 194 const ManagedMemoryPolicy& policy, |
| 180 bool discard_backbuffer_when_not_visible) { | 195 bool discard_backbuffer_when_not_visible) { |
| 181 if (memory_policy_changed_callback_.is_null()) | 196 if (memory_policy_changed_callback_.is_null()) |
| 182 return; | 197 return; |
| 183 memory_policy_changed_callback_.Run( | 198 memory_policy_changed_callback_.Run( |
| 184 policy, discard_backbuffer_when_not_visible); | 199 policy, discard_backbuffer_when_not_visible); |
| 185 } | 200 } |
| 186 | 201 |
| 187 void TestContextProvider::SetLostContextCallback( | 202 void TestContextProvider::SetLostContextCallback( |
| (...skipping 11 matching lines...) Expand all Loading... |
| 199 } | 214 } |
| 200 | 215 |
| 201 void TestContextProvider::SetMemoryPolicyChangedCallback( | 216 void TestContextProvider::SetMemoryPolicyChangedCallback( |
| 202 const MemoryPolicyChangedCallback& cb) { | 217 const MemoryPolicyChangedCallback& cb) { |
| 203 DCHECK(context_thread_checker_.CalledOnValidThread()); | 218 DCHECK(context_thread_checker_.CalledOnValidThread()); |
| 204 DCHECK(memory_policy_changed_callback_.is_null() || cb.is_null()); | 219 DCHECK(memory_policy_changed_callback_.is_null() || cb.is_null()); |
| 205 memory_policy_changed_callback_ = cb; | 220 memory_policy_changed_callback_ = cb; |
| 206 } | 221 } |
| 207 | 222 |
| 208 } // namespace cc | 223 } // namespace cc |
| OLD | NEW |