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

Unified Diff: gpu/command_buffer/client/gl_in_process_context.cc

Issue 935333002: Update from https://crrev.com/316786 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 10 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 | « gpu/command_buffer/client/gl_in_process_context.h ('k') | gpu/command_buffer/client/gles2_c_lib_autogen.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gpu/command_buffer/client/gl_in_process_context.cc
diff --git a/gpu/command_buffer/client/gl_in_process_context.cc b/gpu/command_buffer/client/gl_in_process_context.cc
index f10695ed10f71f097b3482b850ba48120fceab93..5d8049bceee7458b2671e143537bc40d79a91d5e 100644
--- a/gpu/command_buffer/client/gl_in_process_context.cc
+++ b/gpu/command_buffer/client/gl_in_process_context.cc
@@ -66,6 +66,7 @@ class GLInProcessContextImpl
void SetContextLostCallback(const base::Closure& callback) override;
gles2::GLES2Implementation* GetImplementation() override;
size_t GetMappedMemoryLimit() override;
+ void SetLock(base::Lock* lock) override;
#if defined(OS_ANDROID)
scoped_refptr<gfx::SurfaceTexture> GetSurfaceTexture(
@@ -85,6 +86,7 @@ class GLInProcessContextImpl
const GLInProcessContextSharedMemoryLimits mem_limits_;
bool context_lost_;
base::Closure context_lost_callback_;
+ base::Lock* lock_;
DISALLOW_COPY_AND_ASSIGN(GLInProcessContextImpl);
};
@@ -96,7 +98,7 @@ base::LazyInstance<std::set<GLInProcessContextImpl*> > g_all_shared_contexts =
GLInProcessContextImpl::GLInProcessContextImpl(
const GLInProcessContextSharedMemoryLimits& mem_limits)
- : mem_limits_(mem_limits), context_lost_(false) {
+ : mem_limits_(mem_limits), context_lost_(false), lock_(nullptr) {
}
GLInProcessContextImpl::~GLInProcessContextImpl() {
@@ -115,12 +117,20 @@ size_t GLInProcessContextImpl::GetMappedMemoryLimit() {
return mem_limits_.mapped_memory_reclaim_limit;
}
+void GLInProcessContextImpl::SetLock(base::Lock* lock) {
+ command_buffer_->SetLock(lock);
+ lock_ = lock;
+}
+
void GLInProcessContextImpl::SetContextLostCallback(
const base::Closure& callback) {
context_lost_callback_ = callback;
}
void GLInProcessContextImpl::OnContextLost() {
+ scoped_ptr<base::AutoLock> lock;
+ if (lock_)
+ lock.reset(new base::AutoLock(*lock_));
context_lost_ = true;
if (!context_lost_callback_.is_null()) {
context_lost_callback_.Run();
« no previous file with comments | « gpu/command_buffer/client/gl_in_process_context.h ('k') | gpu/command_buffer/client/gles2_c_lib_autogen.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698