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 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 skia::AdoptRef(skia_bindings::CreateCommandBufferSkiaGLBinding()); | 158 skia::AdoptRef(skia_bindings::CreateCommandBufferSkiaGLBinding()); |
159 interface->fCallback = BindGrContextCallback; | 159 interface->fCallback = BindGrContextCallback; |
160 interface->fCallbackData = reinterpret_cast<GrGLInterfaceCallbackData>(this); | 160 interface->fCallbackData = reinterpret_cast<GrGLInterfaceCallbackData>(this); |
161 | 161 |
162 gr_context_ = skia::AdoptRef(GrContext::Create( | 162 gr_context_ = skia::AdoptRef(GrContext::Create( |
163 kOpenGL_GrBackend, reinterpret_cast<GrBackendContext>(interface.get()))); | 163 kOpenGL_GrBackend, reinterpret_cast<GrBackendContext>(interface.get()))); |
164 | 164 |
165 return gr_context_.get(); | 165 return gr_context_.get(); |
166 } | 166 } |
167 | 167 |
| 168 void InProcessContextProvider::InvalidateGrContext(uint32_t state) { |
| 169 DCHECK(context_thread_checker_.CalledOnValidThread()); |
| 170 |
| 171 if (gr_context_) |
| 172 gr_context_.get()->resetContext(state); |
| 173 } |
| 174 |
168 void InProcessContextProvider::SetupLock() { | 175 void InProcessContextProvider::SetupLock() { |
169 } | 176 } |
170 | 177 |
171 base::Lock* InProcessContextProvider::GetLock() { | 178 base::Lock* InProcessContextProvider::GetLock() { |
172 return &context_lock_; | 179 return &context_lock_; |
173 } | 180 } |
174 | 181 |
175 bool InProcessContextProvider::IsContextLost() { | 182 bool InProcessContextProvider::IsContextLost() { |
176 DCHECK(context_thread_checker_.CalledOnValidThread()); | 183 DCHECK(context_thread_checker_.CalledOnValidThread()); |
177 | 184 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 return; | 224 return; |
218 destroyed_ = true; | 225 destroyed_ = true; |
219 } | 226 } |
220 if (!lost_context_callback_.is_null()) | 227 if (!lost_context_callback_.is_null()) |
221 base::ResetAndReturn(&lost_context_callback_).Run(); | 228 base::ResetAndReturn(&lost_context_callback_).Run(); |
222 if (gr_context_) | 229 if (gr_context_) |
223 gr_context_->abandonContext(); | 230 gr_context_->abandonContext(); |
224 } | 231 } |
225 | 232 |
226 } // namespace ui | 233 } // namespace ui |
OLD | NEW |