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

Unified Diff: cc/output/context_provider.h

Issue 2382443012: Revert of Idle cleanup for worker context (Closed)
Patch Set: 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
« no previous file with comments | « cc/output/context_cache_controller_unittest.cc ('k') | cc/output/context_provider.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/output/context_provider.h
diff --git a/cc/output/context_provider.h b/cc/output/context_provider.h
index 0c1310b2ef66d8fb3610ea8f9965004b333be64e..3a9875589e28b3f6ed4d07dcc300d565eb20714e 100644
--- a/cc/output/context_provider.h
+++ b/cc/output/context_provider.h
@@ -12,7 +12,6 @@
#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;
@@ -27,6 +26,7 @@
}
namespace cc {
+class ContextCacheController;
struct ManagedMemoryPolicy;
class ContextProvider : public base::RefCountedThreadSafe<ContextProvider> {
@@ -36,10 +36,18 @@
// 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 CC_EXPORT ScopedContextLock {
+ class ScopedContextLock {
public:
- explicit ScopedContextLock(ContextProvider* context_provider);
- ~ScopedContextLock();
+ 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();
+ }
gpu::gles2::GLES2Interface* ContextGL() {
return context_provider_->ContextGL();
@@ -48,7 +56,6 @@
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
« no previous file with comments | « cc/output/context_cache_controller_unittest.cc ('k') | cc/output/context_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698