| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <set> | 10 #include <set> |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 base::Lock* TestContextProvider::GetLock() { | 139 base::Lock* TestContextProvider::GetLock() { |
| 140 return &context_lock_; | 140 return &context_lock_; |
| 141 } | 141 } |
| 142 | 142 |
| 143 void TestContextProvider::DeleteCachedResources() { | 143 void TestContextProvider::DeleteCachedResources() { |
| 144 } | 144 } |
| 145 | 145 |
| 146 void TestContextProvider::OnLostContext() { | 146 void TestContextProvider::OnLostContext() { |
| 147 DCHECK(context_thread_checker_.CalledOnValidThread()); | 147 DCHECK(context_thread_checker_.CalledOnValidThread()); |
| 148 if (!lost_context_callback_.is_null()) | 148 if (!lost_context_callback_.is_null()) |
| 149 lost_context_callback_.Run(); | 149 base::ResetAndReturn(&lost_context_callback_).Run(); |
| 150 if (gr_context_) | 150 if (gr_context_) |
| 151 gr_context_->abandonContext(); | 151 gr_context_->abandonContext(); |
| 152 } | 152 } |
| 153 | 153 |
| 154 TestWebGraphicsContext3D* TestContextProvider::TestContext3d() { | 154 TestWebGraphicsContext3D* TestContextProvider::TestContext3d() { |
| 155 DCHECK(bound_); | 155 DCHECK(bound_); |
| 156 DCHECK(context_thread_checker_.CalledOnValidThread()); | 156 DCHECK(context_thread_checker_.CalledOnValidThread()); |
| 157 | 157 |
| 158 return context3d_.get(); | 158 return context3d_.get(); |
| 159 } | 159 } |
| 160 | 160 |
| 161 TestWebGraphicsContext3D* TestContextProvider::UnboundTestContext3d() { | 161 TestWebGraphicsContext3D* TestContextProvider::UnboundTestContext3d() { |
| 162 return context3d_.get(); | 162 return context3d_.get(); |
| 163 } | 163 } |
| 164 | 164 |
| 165 void TestContextProvider::SetLostContextCallback( | 165 void TestContextProvider::SetLostContextCallback( |
| 166 const LostContextCallback& cb) { | 166 const LostContextCallback& cb) { |
| 167 DCHECK(context_thread_checker_.CalledOnValidThread()); | 167 DCHECK(context_thread_checker_.CalledOnValidThread()); |
| 168 DCHECK(lost_context_callback_.is_null() || cb.is_null()); | 168 DCHECK(lost_context_callback_.is_null() || cb.is_null()); |
| 169 lost_context_callback_ = cb; | 169 lost_context_callback_ = cb; |
| 170 } | 170 } |
| 171 | 171 |
| 172 void TestContextProvider::SetMaxTransferBufferUsageBytes( | 172 void TestContextProvider::SetMaxTransferBufferUsageBytes( |
| 173 size_t max_transfer_buffer_usage_bytes) { | 173 size_t max_transfer_buffer_usage_bytes) { |
| 174 context3d_->SetMaxTransferBufferUsageBytes(max_transfer_buffer_usage_bytes); | 174 context3d_->SetMaxTransferBufferUsageBytes(max_transfer_buffer_usage_bytes); |
| 175 } | 175 } |
| 176 | 176 |
| 177 } // namespace cc | 177 } // namespace cc |
| OLD | NEW |