| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "content/browser/android/in_process/context_provider_in_process.h" | 5 #include "content/browser/android/in_process/context_provider_in_process.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 void ContextProviderInProcess::DeleteCachedResources() { | 163 void ContextProviderInProcess::DeleteCachedResources() { |
| 164 DCHECK(context_thread_checker_.CalledOnValidThread()); | 164 DCHECK(context_thread_checker_.CalledOnValidThread()); |
| 165 | 165 |
| 166 if (gr_context_) | 166 if (gr_context_) |
| 167 gr_context_->FreeGpuResources(); | 167 gr_context_->FreeGpuResources(); |
| 168 } | 168 } |
| 169 | 169 |
| 170 void ContextProviderInProcess::OnLostContext() { | 170 void ContextProviderInProcess::OnLostContext() { |
| 171 DCHECK(context_thread_checker_.CalledOnValidThread()); | 171 DCHECK(context_thread_checker_.CalledOnValidThread()); |
| 172 if (!lost_context_callback_.is_null()) | 172 if (!lost_context_callback_.is_null()) |
| 173 lost_context_callback_.Run(); | 173 base::ResetAndReturn(&lost_context_callback_).Run(); |
| 174 if (gr_context_) | 174 if (gr_context_) |
| 175 gr_context_->OnLostContext(); | 175 gr_context_->OnLostContext(); |
| 176 } | 176 } |
| 177 | 177 |
| 178 void ContextProviderInProcess::SetLostContextCallback( | 178 void ContextProviderInProcess::SetLostContextCallback( |
| 179 const LostContextCallback& lost_context_callback) { | 179 const LostContextCallback& lost_context_callback) { |
| 180 DCHECK(context_thread_checker_.CalledOnValidThread()); | 180 DCHECK(context_thread_checker_.CalledOnValidThread()); |
| 181 DCHECK(lost_context_callback_.is_null() || | 181 DCHECK(lost_context_callback_.is_null() || |
| 182 lost_context_callback.is_null()); | 182 lost_context_callback.is_null()); |
| 183 lost_context_callback_ = lost_context_callback; | 183 lost_context_callback_ = lost_context_callback; |
| 184 } | 184 } |
| 185 | 185 |
| 186 } // namespace content | 186 } // namespace content |
| OLD | NEW |