diff options
author | thakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-11-06 01:12:21 +0000 |
---|---|---|
committer | thakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-11-06 01:12:21 +0000 |
commit | 17486bd07b5320175b43baa9491e0a4b0275d9cf (patch) | |
tree | 3760461d1acdd7c7ee2c6863d9718bf76a0249fd /gpu | |
parent | 5e92af6f15d095c43dbda917e3e15e6a2644abf2 (diff) | |
download | chromium_src-17486bd07b5320175b43baa9491e0a4b0275d9cf.zip chromium_src-17486bd07b5320175b43baa9491e0a4b0275d9cf.tar.gz chromium_src-17486bd07b5320175b43baa9491e0a4b0275d9cf.tar.bz2 |
Delete gpu/command_buffer/client/atomicops.h
command_buffer was historically included in nacl-compiled things, and base
wasn't. These days, base is included in nacl-compiled things too, so the
duplication can be removed.
BUG=none
R=piman@chromium.org
Review URL: https://codereview.chromium.org/59383006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@233171 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gpu')
-rw-r--r-- | gpu/command_buffer/client/atomicops.cc | 92 | ||||
-rw-r--r-- | gpu/command_buffer/client/atomicops.h | 49 | ||||
-rw-r--r-- | gpu/command_buffer/client/buffer_tracker.cc | 1 | ||||
-rw-r--r-- | gpu/command_buffer/client/program_info_manager.cc | 16 | ||||
-rw-r--r-- | gpu/command_buffer/client/query_tracker.cc | 1 | ||||
-rw-r--r-- | gpu/command_buffer/client/share_group.cc | 10 | ||||
-rw-r--r-- | gpu/command_buffer/service/gles2_cmd_decoder.cc | 4 | ||||
-rw-r--r-- | gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc | 1 | ||||
-rw-r--r-- | gpu/command_buffer_client.gypi | 2 |
9 files changed, 13 insertions, 163 deletions
diff --git a/gpu/command_buffer/client/atomicops.cc b/gpu/command_buffer/client/atomicops.cc deleted file mode 100644 index c66fc05..0000000 --- a/gpu/command_buffer/client/atomicops.cc +++ /dev/null @@ -1,92 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "gpu/command_buffer/client/atomicops.h" - -#include "base/logging.h" - -#if !defined(__native_client__) -#include "base/atomicops.h" -#include "base/synchronization/lock.h" -#else -#include <pthread.h> -#endif - -namespace gpu { - -#if defined(__native_client__) - -class LockImpl { - public: - LockImpl() - : acquired_(false) { - pthread_mutex_init(&mutex_, NULL); - } - - ~LockImpl() { - pthread_mutex_destroy(&mutex_); - } - - void Acquire() { - pthread_mutex_lock(&mutex_); - acquired_ = true; - } - - void Release() { - DCHECK(acquired_); - acquired_ = false; - pthread_mutex_unlock(&mutex_); - } - - bool Try() { - bool acquired = pthread_mutex_trylock(&mutex_) == 0; - if (acquired) { - acquired_ = true; - } - return acquired; - } - - void AssertAcquired() const { - DCHECK(acquired_); - } - - private: - bool acquired_; - pthread_mutex_t mutex_; - - DISALLOW_COPY_AND_ASSIGN(LockImpl); -}; - -#else // !__native_client__ - -class LockImpl : public base::Lock { -}; - -#endif // !__native_client__ - -Lock::Lock() - : lock_(new LockImpl()) { -} - -Lock::~Lock() { -} - -void Lock::Acquire() { - lock_->Acquire(); -} - -void Lock::Release() { - lock_->Release(); -} - -bool Lock::Try() { - return lock_->Try(); -} - -void Lock::AssertAcquired() const { - return lock_->AssertAcquired(); -} - -} // namespace gpu - diff --git a/gpu/command_buffer/client/atomicops.h b/gpu/command_buffer/client/atomicops.h deleted file mode 100644 index 43044b6..0000000 --- a/gpu/command_buffer/client/atomicops.h +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef GPU_COMMAND_BUFFER_CLIENT_ATOMICOPS_H_ -#define GPU_COMMAND_BUFFER_CLIENT_ATOMICOPS_H_ - -#include "base/memory/scoped_ptr.h" -#include "gpu/command_buffer/common/types.h" -#include "gpu/gpu_export.h" - -namespace gpu { - -class LockImpl; -class GPU_EXPORT Lock { - public: - Lock(); - ~Lock(); - void Acquire(); - void Release(); - bool Try(); - void AssertAcquired() const; - - private: - scoped_ptr<LockImpl> lock_; - - DISALLOW_COPY_AND_ASSIGN(Lock); -}; - -// A helper class that acquires the given Lock while the AutoLock is in scope. -class GPU_EXPORT AutoLock { - public: - explicit AutoLock(Lock& lock) : lock_(lock) { - lock_.Acquire(); - } - - ~AutoLock() { - lock_.AssertAcquired(); - lock_.Release(); - } - - private: - Lock& lock_; - DISALLOW_COPY_AND_ASSIGN(AutoLock); -}; - -} // namespace gpu - -#endif // GPU_COMMAND_BUFFER_CLIENT_ATOMICOPS_H_ diff --git a/gpu/command_buffer/client/buffer_tracker.cc b/gpu/command_buffer/client/buffer_tracker.cc index 2768429..18cedb9 100644 --- a/gpu/command_buffer/client/buffer_tracker.cc +++ b/gpu/command_buffer/client/buffer_tracker.cc @@ -4,7 +4,6 @@ #include "gpu/command_buffer/client/buffer_tracker.h" -#include "gpu/command_buffer/client/atomicops.h" #include "gpu/command_buffer/client/cmd_buffer_helper.h" #include "gpu/command_buffer/client/mapped_memory.h" diff --git a/gpu/command_buffer/client/program_info_manager.cc b/gpu/command_buffer/client/program_info_manager.cc index 02b273a..1b5a348d 100644 --- a/gpu/command_buffer/client/program_info_manager.cc +++ b/gpu/command_buffer/client/program_info_manager.cc @@ -7,7 +7,7 @@ #include <map> #include "base/compiler_specific.h" -#include "gpu/command_buffer/client/atomicops.h" +#include "base/synchronization/lock.h" #include "gpu/command_buffer/client/gles2_implementation.h" #include "gpu/command_buffer/common/gles2_cmd_utils.h" @@ -221,7 +221,7 @@ class CachedProgramInfoManager : public ProgramInfoManager { ProgramInfoMap program_infos_; - mutable Lock lock_; + mutable base::Lock lock_; }; CachedProgramInfoManager::Program::UniformInfo::UniformInfo( @@ -393,7 +393,7 @@ CachedProgramInfoManager::Program* } void CachedProgramInfoManager::CreateInfo(GLuint program) { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); DeleteInfo(program); std::pair<ProgramInfoMap::iterator, bool> result = program_infos_.insert(std::make_pair(program, Program())); @@ -407,7 +407,7 @@ void CachedProgramInfoManager::DeleteInfo(GLuint program) { bool CachedProgramInfoManager::GetProgramiv( GLES2Implementation* gl, GLuint program, GLenum pname, GLint* params) { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); Program* info = GetProgramInfo(gl, program); if (!info) { return false; @@ -417,7 +417,7 @@ bool CachedProgramInfoManager::GetProgramiv( GLint CachedProgramInfoManager::GetAttribLocation( GLES2Implementation* gl, GLuint program, const char* name) { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); Program* info = GetProgramInfo(gl, program); if (info) { return info->GetAttribLocation(name); @@ -427,7 +427,7 @@ GLint CachedProgramInfoManager::GetAttribLocation( GLint CachedProgramInfoManager::GetUniformLocation( GLES2Implementation* gl, GLuint program, const char* name) { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); Program* info = GetProgramInfo(gl, program); if (info) { return info->GetUniformLocation(name); @@ -439,7 +439,7 @@ bool CachedProgramInfoManager::GetActiveAttrib( GLES2Implementation* gl, GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name) { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); Program* info = GetProgramInfo(gl, program); if (info) { const Program::VertexAttrib* attrib_info = @@ -474,7 +474,7 @@ bool CachedProgramInfoManager::GetActiveUniform( GLES2Implementation* gl, GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name) { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); Program* info = GetProgramInfo(gl, program); if (info) { const Program::UniformInfo* uniform_info = info->GetUniformInfo(index); diff --git a/gpu/command_buffer/client/query_tracker.cc b/gpu/command_buffer/client/query_tracker.cc index ac9d3f9..2855605 100644 --- a/gpu/command_buffer/client/query_tracker.cc +++ b/gpu/command_buffer/client/query_tracker.cc @@ -8,7 +8,6 @@ #include <GLES2/gl2ext.h> #include <GLES2/gl2extchromium.h> -#include "gpu/command_buffer/client/atomicops.h" #include "gpu/command_buffer/client/gles2_cmd_helper.h" #include "gpu/command_buffer/client/gles2_implementation.h" #include "gpu/command_buffer/client/mapped_memory.h" diff --git a/gpu/command_buffer/client/share_group.cc b/gpu/command_buffer/client/share_group.cc index e61083d..cb9f9bc 100644 --- a/gpu/command_buffer/client/share_group.cc +++ b/gpu/command_buffer/client/share_group.cc @@ -5,7 +5,7 @@ #include "gpu/command_buffer/client/share_group.h" #include "base/logging.h" -#include "gpu/command_buffer/client/atomicops.h" +#include "base/synchronization/lock.h" #include "gpu/command_buffer/client/gles2_implementation.h" #include "gpu/command_buffer/client/program_info_manager.h" #include "gpu/command_buffer/common/id_allocator.h" @@ -157,7 +157,7 @@ class ThreadSafeIdHandlerWrapper : public IdHandlerInterface { GLuint id_offset, GLsizei n, GLuint* ids) OVERRIDE { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); id_handler_->MakeIds(gl_impl, id_offset, n, ids); } @@ -166,19 +166,19 @@ class ThreadSafeIdHandlerWrapper : public IdHandlerInterface { GLsizei n, const GLuint* ids, DeleteFn delete_fn) OVERRIDE { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); return id_handler_->FreeIds(gl_impl, n, ids, delete_fn); } // Overridden from IdHandlerInterface. virtual bool MarkAsUsedForBind(GLuint id) OVERRIDE { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); return id_handler_->MarkAsUsedForBind(id); } private: scoped_ptr<IdHandlerInterface> id_handler_; - Lock lock_; + base::Lock lock_; }; ShareGroup::ShareGroup(bool bind_generates_resource) diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc index be0ee10..0af257a 100644 --- a/gpu/command_buffer/service/gles2_cmd_decoder.cc +++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc @@ -14,13 +14,9 @@ #include <vector> #include "base/at_exit.h" -#include "base/atomicops.h" #include "base/bind.h" #include "base/command_line.h" #include "base/debug/trace_event.h" -#if defined(OS_MACOSX) -#include "base/mac/scoped_cftyperef.h" -#endif #include "base/memory/scoped_ptr.h" #include "base/strings/string_number_conversions.h" #include "build/build_config.h" diff --git a/gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc b/gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc index af127bf..578d672 100644 --- a/gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc +++ b/gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc @@ -4,7 +4,6 @@ #include "gpu/command_buffer/service/gles2_cmd_decoder.h" -#include "base/atomicops.h" #include "gpu/command_buffer/common/gles2_cmd_format.h" #include "gpu/command_buffer/common/gles2_cmd_utils.h" #include "gpu/command_buffer/common/id_allocator.h" diff --git a/gpu/command_buffer_client.gypi b/gpu/command_buffer_client.gypi index 366f5b7..cb52ee7 100644 --- a/gpu/command_buffer_client.gypi +++ b/gpu/command_buffer_client.gypi @@ -15,8 +15,6 @@ '../third_party/khronos/khronos.gyp:khronos_headers', ], 'sources': [ - 'command_buffer/client/atomicops.cc', - 'command_buffer/client/atomicops.h', 'command_buffer/client/cmd_buffer_helper.cc', 'command_buffer/client/cmd_buffer_helper.h', 'command_buffer/client/fenced_allocator.cc', |