Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1154)

Unified Diff: android_webview/browser/aw_render_thread_context_provider.cc

Issue 2278283003: Refactor client visibility handling (Closed)
Patch Set: feedback Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: android_webview/browser/aw_render_thread_context_provider.cc
diff --git a/android_webview/browser/aw_render_thread_context_provider.cc b/android_webview/browser/aw_render_thread_context_provider.cc
index 8e82beda8d49de7cfa64f0edcceb5f7e5a5807f8..6c689df7ebea884bb566a82d9b0484ae9ddeb91a 100644
--- a/android_webview/browser/aw_render_thread_context_provider.cc
+++ b/android_webview/browser/aw_render_thread_context_provider.cc
@@ -66,6 +66,9 @@ AwRenderThreadContextProvider::AwRenderThreadContextProvider(
context_->GetImplementation()->SetLostContextCallback(base::Bind(
&AwRenderThreadContextProvider::OnLostContext, base::Unretained(this)));
+
+ cache_controller_.reset(
+ new cc::ContextCacheController(context_->GetImplementation()));
}
AwRenderThreadContextProvider::~AwRenderThreadContextProvider() {
@@ -114,9 +117,15 @@ class GrContext* AwRenderThreadContextProvider::GrContext() {
gr_context_ = sk_sp<::GrContext>(GrContext::Create(
// GrContext takes ownership of |interface|.
kOpenGL_GrBackend, reinterpret_cast<GrBackendContext>(interface.get())));
+ cache_controller_->SetGrContext(gr_context_.get());
return gr_context_.get();
}
+gpu::ContextSupport* AwRenderThreadContextProvider::CacheController() {
+ DCHECK(main_thread_checker_.CalledOnValidThread());
+ return cache_controller_.get();
+}
+
void AwRenderThreadContextProvider::InvalidateGrContext(uint32_t state) {
DCHECK(main_thread_checker_.CalledOnValidThread());
@@ -130,16 +139,6 @@ base::Lock* AwRenderThreadContextProvider::GetLock() {
return nullptr;
}
-void AwRenderThreadContextProvider::DeleteCachedResources() {
- DCHECK(main_thread_checker_.CalledOnValidThread());
-
- if (gr_context_) {
- TRACE_EVENT_INSTANT0("gpu", "GrContext::freeGpuResources",
- TRACE_EVENT_SCOPE_THREAD);
- gr_context_->freeGpuResources();
- }
-}
-
void AwRenderThreadContextProvider::SetLostContextCallback(
const LostContextCallback& lost_context_callback) {
lost_context_callback_ = lost_context_callback;

Powered by Google App Engine
This is Rietveld 408576698