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

Unified Diff: cc/output/context_provider.h

Issue 2257533006: Free worker context resources on idle. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@fix-cleanup2
Patch Set: rebase 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
« no previous file with comments | « cc/BUILD.gn ('k') | cc/test/test_context_support.h » ('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 2245b643e134b464d0db441cd4bd5dfae0ca2d2e..34db04b3564e4c9b8018f74239f08510dbed714d 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 "gpu/command_buffer/client/context_support.h"
#include "gpu/command_buffer/common/capabilities.h"
class GrContext;
@@ -35,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();
@@ -55,6 +48,7 @@ class ContextProvider : public base::RefCountedThreadSafe<ContextProvider> {
private:
ContextProvider* const context_provider_;
base::AutoLock context_lock_;
+ std::unique_ptr<gpu::ContextSupport::ScopedBusy> busy_;
};
// Bind the 3d context to the current thread. This should be called before
« no previous file with comments | « cc/BUILD.gn ('k') | cc/test/test_context_support.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698