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

Unified Diff: blimp/client/feature/compositor/blimp_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: blimp/client/feature/compositor/blimp_context_provider.cc
diff --git a/blimp/client/feature/compositor/blimp_context_provider.cc b/blimp/client/feature/compositor/blimp_context_provider.cc
index 8c68d7b9b957b7a060788544f76756f3903aaa3b..8f343fd7fc0b389091aacc6e818ec8cf922ccfdd 100644
--- a/blimp/client/feature/compositor/blimp_context_provider.cc
+++ b/blimp/client/feature/compositor/blimp_context_provider.cc
@@ -7,6 +7,7 @@
#include "base/bind.h"
#include "base/callback_helpers.h"
#include "base/lazy_instance.h"
+#include "cc/output/context_cache_controller.h"
#include "gpu/command_buffer/client/gl_in_process_context.h"
#include "gpu/command_buffer/client/gles2_implementation.h"
#include "gpu/command_buffer/client/gles2_lib.h"
@@ -48,6 +49,9 @@ BlimpContextProvider::BlimpContextProvider(
gpu_memory_buffer_manager, nullptr /* memory_limits */));
context_->GetImplementation()->SetLostContextCallback(
base::Bind(&BlimpContextProvider::OnLostContext, base::Unretained(this)));
+
+ cache_controller_.reset(
+ new cc::ContextCacheController(context_->GetImplementation()));
}
BlimpContextProvider::~BlimpContextProvider() {
@@ -86,10 +90,15 @@ class GrContext* BlimpContextProvider::GrContext() {
return gr_context_->get();
gr_context_.reset(new skia_bindings::GrContextForGLES2Interface(ContextGL()));
-
+ cache_controller_->SetGrContext(gr_context_->get());
return gr_context_->get();
}
+cc::ContextCacheController* BlimpContextProvider::CacheController() {
+ DCHECK(context_thread_checker_.CalledOnValidThread());
+ return cache_controller_.get();
+}
+
void BlimpContextProvider::InvalidateGrContext(uint32_t state) {
DCHECK(context_thread_checker_.CalledOnValidThread());
@@ -103,13 +112,6 @@ base::Lock* BlimpContextProvider::GetLock() {
return nullptr;
}
-void BlimpContextProvider::DeleteCachedResources() {
- DCHECK(context_thread_checker_.CalledOnValidThread());
-
- if (gr_context_)
- gr_context_->FreeGpuResources();
-}
-
void BlimpContextProvider::SetLostContextCallback(
const LostContextCallback& lost_context_callback) {
DCHECK(context_thread_checker_.CalledOnValidThread());

Powered by Google App Engine
This is Rietveld 408576698