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