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

Unified Diff: cc/output/context_provider.h

Issue 2353033003: Idle cleanup for worker context (Closed)
Patch Set: fix windows build Created 4 years, 3 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: cc/output/context_provider.h
diff --git a/cc/output/context_provider.h b/cc/output/context_provider.h
index 3a9875589e28b3f6ed4d07dcc300d565eb20714e..0c1310b2ef66d8fb3610ea8f9965004b333be64e 100644
--- a/cc/output/context_provider.h
+++ b/cc/output/context_provider.h
@@ -12,6 +12,7 @@
#include "base/memory/ref_counted.h"
#include "base/synchronization/lock.h"
#include "cc/base/cc_export.h"
+#include "cc/output/context_cache_controller.h"
#include "gpu/command_buffer/common/capabilities.h"
class GrContext;
@@ -26,7 +27,6 @@ namespace gles2 { class GLES2Interface; }
}
namespace cc {
-class ContextCacheController;
struct ManagedMemoryPolicy;
class ContextProvider : public base::RefCountedThreadSafe<ContextProvider> {
@@ -36,18 +36,10 @@ class ContextProvider : public base::RefCountedThreadSafe<ContextProvider> {
// lock from GetLock(), so is not always supported. Most use of
// ContextProvider should be single-thread only on the thread that
// BindToCurrentThread is run on.
- class ScopedContextLock {
+ class CC_EXPORT ScopedContextLock {
public:
- explicit ScopedContextLock(ContextProvider* context_provider)
- : context_provider_(context_provider),
- context_lock_(*context_provider_->GetLock()) {
- // Allow current thread to use |context_provider_|.
- context_provider_->DetachFromThread();
- }
- ~ScopedContextLock() {
- // Allow usage by thread for which |context_provider_| is bound to.
- context_provider_->DetachFromThread();
- }
+ explicit ScopedContextLock(ContextProvider* context_provider);
+ ~ScopedContextLock();
gpu::gles2::GLES2Interface* ContextGL() {
return context_provider_->ContextGL();
@@ -56,6 +48,7 @@ class ContextProvider : public base::RefCountedThreadSafe<ContextProvider> {
private:
ContextProvider* const context_provider_;
base::AutoLock context_lock_;
+ std::unique_ptr<ContextCacheController::ScopedBusy> busy_;
};
// Bind the 3d context to the current thread. This should be called before

Powered by Google App Engine
This is Rietveld 408576698