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..c97f253b5db57cdc81eff987ecc35ad08942fb1e 100644 |
--- a/android_webview/browser/aw_render_thread_context_provider.cc |
+++ b/android_webview/browser/aw_render_thread_context_provider.cc |
@@ -8,6 +8,7 @@ |
#include "base/callback_helpers.h" |
#include "base/lazy_instance.h" |
#include "base/trace_event/trace_event.h" |
+#include "cc/output/context_cache_controller.h" |
#include "cc/output/managed_memory_policy.h" |
#include "gpu/command_buffer/client/gl_in_process_context.h" |
#include "gpu/command_buffer/client/gles2_implementation.h" |
@@ -66,6 +67,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 +118,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(); |
} |
+cc::ContextCacheController* AwRenderThreadContextProvider::CacheController() { |
+ DCHECK(main_thread_checker_.CalledOnValidThread()); |
+ return cache_controller_.get(); |
+} |
+ |
void AwRenderThreadContextProvider::InvalidateGrContext(uint32_t state) { |
DCHECK(main_thread_checker_.CalledOnValidThread()); |
@@ -130,16 +140,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; |