| 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/support/compositor/blimp_context_provider.h" | 5 #include "blimp/client/support/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 "cc/output/context_cache_controller.h" | 10 #include "cc/output/context_cache_controller.h" |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 } | 100 } |
| 101 | 101 |
| 102 void BlimpContextProvider::InvalidateGrContext(uint32_t state) { | 102 void BlimpContextProvider::InvalidateGrContext(uint32_t state) { |
| 103 DCHECK(context_thread_checker_.CalledOnValidThread()); | 103 DCHECK(context_thread_checker_.CalledOnValidThread()); |
| 104 | 104 |
| 105 if (gr_context_) | 105 if (gr_context_) |
| 106 gr_context_->ResetContext(state); | 106 gr_context_->ResetContext(state); |
| 107 } | 107 } |
| 108 | 108 |
| 109 base::Lock* BlimpContextProvider::GetLock() { | 109 base::Lock* BlimpContextProvider::GetLock() { |
| 110 // This context provider is not used on multiple threads. | 110 return &context_lock_; |
| 111 NOTREACHED(); | |
| 112 return nullptr; | |
| 113 } | 111 } |
| 114 | 112 |
| 115 void BlimpContextProvider::SetLostContextCallback( | 113 void BlimpContextProvider::SetLostContextCallback( |
| 116 const LostContextCallback& lost_context_callback) { | 114 const LostContextCallback& lost_context_callback) { |
| 117 DCHECK(context_thread_checker_.CalledOnValidThread()); | 115 DCHECK(context_thread_checker_.CalledOnValidThread()); |
| 118 lost_context_callback_ = lost_context_callback; | 116 lost_context_callback_ = lost_context_callback; |
| 119 } | 117 } |
| 120 | 118 |
| 121 void BlimpContextProvider::OnLostContext() { | 119 void BlimpContextProvider::OnLostContext() { |
| 122 DCHECK(context_thread_checker_.CalledOnValidThread()); | 120 DCHECK(context_thread_checker_.CalledOnValidThread()); |
| 123 if (!lost_context_callback_.is_null()) | 121 if (!lost_context_callback_.is_null()) |
| 124 lost_context_callback_.Run(); | 122 lost_context_callback_.Run(); |
| 125 if (gr_context_) | 123 if (gr_context_) |
| 126 gr_context_->OnLostContext(); | 124 gr_context_->OnLostContext(); |
| 127 } | 125 } |
| 128 | 126 |
| 129 } // namespace client | 127 } // namespace client |
| 130 } // namespace blimp | 128 } // namespace blimp |
| OLD | NEW |