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 DCHECK(context_thread_checker_.CalledOnValidThread()); | 221 // Note: no thread check here as this should not change the thread for which |
| 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. |
222 { | 224 { |
223 base::AutoLock lock(destroyed_lock_); | 225 base::AutoLock lock(destroyed_lock_); |
224 if (destroyed_) | 226 if (destroyed_) |
225 return; | 227 return; |
226 destroyed_ = true; | 228 destroyed_ = true; |
227 } | 229 } |
228 if (!lost_context_callback_.is_null()) | 230 if (!lost_context_callback_.is_null()) |
229 base::ResetAndReturn(&lost_context_callback_).Run(); | 231 base::ResetAndReturn(&lost_context_callback_).Run(); |
230 if (gr_context_) | 232 if (gr_context_) |
231 gr_context_->abandonContext(); | 233 gr_context_->abandonContext(); |
232 } | 234 } |
233 | 235 |
234 } // namespace ui | 236 } // namespace ui |
OLD | NEW |