| 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 "ui/compositor/test/in_process_context_provider.h" | 5 #include "ui/compositor/test/in_process_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/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
| 10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 const LostContextCallback& lost_context_callback) { | 211 const LostContextCallback& lost_context_callback) { |
| 212 lost_context_callback_ = lost_context_callback; | 212 lost_context_callback_ = lost_context_callback; |
| 213 } | 213 } |
| 214 | 214 |
| 215 void InProcessContextProvider::SetMemoryPolicyChangedCallback( | 215 void InProcessContextProvider::SetMemoryPolicyChangedCallback( |
| 216 const MemoryPolicyChangedCallback& memory_policy_changed_callback) { | 216 const MemoryPolicyChangedCallback& memory_policy_changed_callback) { |
| 217 // There's no memory manager for the in-process implementation. | 217 // There's no memory manager for the in-process implementation. |
| 218 } | 218 } |
| 219 | 219 |
| 220 void InProcessContextProvider::OnLostContext() { | 220 void InProcessContextProvider::OnLostContext() { |
| 221 // Note: no thread check here as this should not change the thread for which | 221 DCHECK(context_thread_checker_.CalledOnValidThread()); |
| 222 // this context is currently bound. e.g. a worker context might be unbound | |
| 223 // and this should not result in it being bound to the current thread. | |
| 224 { | 222 { |
| 225 base::AutoLock lock(destroyed_lock_); | 223 base::AutoLock lock(destroyed_lock_); |
| 226 if (destroyed_) | 224 if (destroyed_) |
| 227 return; | 225 return; |
| 228 destroyed_ = true; | 226 destroyed_ = true; |
| 229 } | 227 } |
| 230 if (!lost_context_callback_.is_null()) | 228 if (!lost_context_callback_.is_null()) |
| 231 base::ResetAndReturn(&lost_context_callback_).Run(); | 229 base::ResetAndReturn(&lost_context_callback_).Run(); |
| 232 if (gr_context_) | 230 if (gr_context_) |
| 233 gr_context_->abandonContext(); | 231 gr_context_->abandonContext(); |
| 234 } | 232 } |
| 235 | 233 |
| 236 } // namespace ui | 234 } // namespace ui |
| OLD | NEW |