Chromium Code Reviews| Index: cc/output/context_provider.h |
| diff --git a/cc/output/context_provider.h b/cc/output/context_provider.h |
| index c024e02328e9a3930b7593e54b986bdff3566ae5..b3e721498334dee5b1e85d9db09d0cf81f8f8284 100644 |
| --- a/cc/output/context_provider.h |
| +++ b/cc/output/context_provider.h |
| @@ -32,16 +32,20 @@ class ContextProvider : public base::RefCountedThreadSafe<ContextProvider> { |
| explicit ScopedContextLock(ContextProvider* context_provider) |
| : context_provider_(context_provider), |
| context_lock_(*context_provider_->GetLock()) { |
| - // Allow current thread to bind to |context_provider|. |
| + // Allow current thread to use |context_provider_|. |
| context_provider_->DetachFromThread(); |
| } |
| ~ScopedContextLock() { |
| - // Allow a different thread to bind to |context_provider|. |
| + // Allow usage by thread for which |context_provider_| is bound to. |
| context_provider_->DetachFromThread(); |
| } |
| + // Returns a raw pointer to the GLES2Interface or null if context has been |
| + // destroyed. |
| gpu::gles2::GLES2Interface* ContextGL() { |
| - return context_provider_->ContextGL(); |
| + return context_provider_->HasBeenDestroyed() |
| + ? nullptr |
| + : context_provider_->ContextGL(); |
| } |
| private: |
| @@ -107,6 +111,9 @@ class ContextProvider : public base::RefCountedThreadSafe<ContextProvider> { |
| virtual void SetMemoryPolicyChangedCallback( |
| const MemoryPolicyChangedCallback& memory_policy_changed_callback) = 0; |
| + // Return true if the context inside the provider is no longer valid. |
|
danakj
2015/09/04 18:28:07
Can we maybe make this clear that this function is
reveman
2015/09/04 18:55:50
I prefer to have this function be consistent with
danakj
2015/09/04 20:02:15
My concern is that this adds a whole other state t
|
| + virtual bool HasBeenDestroyed() = 0; |
| + |
| protected: |
| friend class base::RefCountedThreadSafe<ContextProvider>; |
| virtual ~ContextProvider() {} |