| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "blimp/client/compositor/blimp_context_provider.h" | 5 #include "blimp/client/compositor/blimp_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 "gpu/command_buffer/client/gl_in_process_context.h" | 10 #include "gpu/command_buffer/client/gl_in_process_context.h" |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 base::AutoLock lock(destroyed_lock_); | 156 base::AutoLock lock(destroyed_lock_); |
| 157 return destroyed_; | 157 return destroyed_; |
| 158 } | 158 } |
| 159 | 159 |
| 160 void BlimpContextProvider::SetLostContextCallback( | 160 void BlimpContextProvider::SetLostContextCallback( |
| 161 const LostContextCallback& lost_context_callback) { | 161 const LostContextCallback& lost_context_callback) { |
| 162 DCHECK(context_thread_checker_.CalledOnValidThread()); | 162 DCHECK(context_thread_checker_.CalledOnValidThread()); |
| 163 lost_context_callback_ = lost_context_callback; | 163 lost_context_callback_ = lost_context_callback; |
| 164 } | 164 } |
| 165 | 165 |
| 166 void BlimpContextProvider::SetMemoryPolicyChangedCallback( | |
| 167 const MemoryPolicyChangedCallback& memory_policy_changed_callback) { | |
| 168 // There's no memory manager for the in-process implementation. | |
| 169 // TODO(dtrainor): Figure out if we need a memory manager for Blimp. | |
| 170 } | |
| 171 | |
| 172 void BlimpContextProvider::OnLostContext() { | 166 void BlimpContextProvider::OnLostContext() { |
| 173 DCHECK(context_thread_checker_.CalledOnValidThread()); | 167 DCHECK(context_thread_checker_.CalledOnValidThread()); |
| 174 | 168 |
| 175 { | 169 { |
| 176 base::AutoLock lock(destroyed_lock_); | 170 base::AutoLock lock(destroyed_lock_); |
| 177 if (destroyed_) | 171 if (destroyed_) |
| 178 return; | 172 return; |
| 179 destroyed_ = true; | 173 destroyed_ = true; |
| 180 } | 174 } |
| 181 | 175 |
| 182 if (!lost_context_callback_.is_null()) | 176 if (!lost_context_callback_.is_null()) |
| 183 base::ResetAndReturn(&lost_context_callback_).Run(); | 177 base::ResetAndReturn(&lost_context_callback_).Run(); |
| 184 if (gr_context_) | 178 if (gr_context_) |
| 185 gr_context_->abandonContext(); | 179 gr_context_->abandonContext(); |
| 186 } | 180 } |
| 187 | 181 |
| 188 } // namespace blimp | 182 } // namespace blimp |
| OLD | NEW |