| 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 "android_webview/browser/aw_render_thread_context_provider.h" | 5 #include "android_webview/browser/aw_render_thread_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/trace_event/trace_event.h" | 10 #include "base/trace_event/trace_event.h" |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 } | 150 } |
| 151 | 151 |
| 152 void AwRenderThreadContextProvider::SetupLock() { | 152 void AwRenderThreadContextProvider::SetupLock() { |
| 153 context_->SetLock(&context_lock_); | 153 context_->SetLock(&context_lock_); |
| 154 } | 154 } |
| 155 | 155 |
| 156 base::Lock* AwRenderThreadContextProvider::GetLock() { | 156 base::Lock* AwRenderThreadContextProvider::GetLock() { |
| 157 return &context_lock_; | 157 return &context_lock_; |
| 158 } | 158 } |
| 159 | 159 |
| 160 bool AwRenderThreadContextProvider::IsContextLost() { | |
| 161 DCHECK(main_thread_checker_.CalledOnValidThread()); | |
| 162 | |
| 163 return destroyed_; | |
| 164 } | |
| 165 | |
| 166 void AwRenderThreadContextProvider::VerifyContexts() { | 160 void AwRenderThreadContextProvider::VerifyContexts() { |
| 167 } | 161 } |
| 168 | 162 |
| 169 void AwRenderThreadContextProvider::DeleteCachedResources() { | 163 void AwRenderThreadContextProvider::DeleteCachedResources() { |
| 170 DCHECK(main_thread_checker_.CalledOnValidThread()); | 164 DCHECK(main_thread_checker_.CalledOnValidThread()); |
| 171 | 165 |
| 172 if (gr_context_) { | 166 if (gr_context_) { |
| 173 TRACE_EVENT_INSTANT0("gpu", "GrContext::freeGpuResources", | 167 TRACE_EVENT_INSTANT0("gpu", "GrContext::freeGpuResources", |
| 174 TRACE_EVENT_SCOPE_THREAD); | 168 TRACE_EVENT_SCOPE_THREAD); |
| 175 gr_context_->freeGpuResources(); | 169 gr_context_->freeGpuResources(); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 199 return; | 193 return; |
| 200 destroyed_ = true; | 194 destroyed_ = true; |
| 201 | 195 |
| 202 if (!lost_context_callback_.is_null()) | 196 if (!lost_context_callback_.is_null()) |
| 203 base::ResetAndReturn(&lost_context_callback_).Run(); | 197 base::ResetAndReturn(&lost_context_callback_).Run(); |
| 204 if (gr_context_) | 198 if (gr_context_) |
| 205 gr_context_->abandonContext(); | 199 gr_context_->abandonContext(); |
| 206 } | 200 } |
| 207 | 201 |
| 208 } // namespace android_webview | 202 } // namespace android_webview |
| OLD | NEW |