diff options
author | erg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-13 17:44:15 +0000 |
---|---|---|
committer | erg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-13 17:44:15 +0000 |
commit | bbf94a3e7f3c4372c4ff918a6811a505d8fd69b9 (patch) | |
tree | c5d2614d92182544af89d3908be118149fae185a /gpu | |
parent | 372c8e90fba9881bdf52298587f336cc083e3b17 (diff) | |
download | chromium_src-bbf94a3e7f3c4372c4ff918a6811a505d8fd69b9.zip chromium_src-bbf94a3e7f3c4372c4ff918a6811a505d8fd69b9.tar.gz chromium_src-bbf94a3e7f3c4372c4ff918a6811a505d8fd69b9.tar.bz2 |
FBTF: Fix more ctor/dtors found by clang plugin.
(1.2 megs off of Debug Linux .a files)
BUG=none
TEST=compiles everywhere
Review URL: http://codereview.chromium.org/3743001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@62420 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gpu')
20 files changed, 126 insertions, 69 deletions
diff --git a/gpu/command_buffer/client/fenced_allocator.cc b/gpu/command_buffer/client/fenced_allocator.cc index 3fc625d..f105f3a 100644 --- a/gpu/command_buffer/client/fenced_allocator.cc +++ b/gpu/command_buffer/client/fenced_allocator.cc @@ -14,6 +14,13 @@ namespace gpu { const FencedAllocator::Offset FencedAllocator::kInvalidOffset; #endif +FencedAllocator::FencedAllocator(unsigned int size, + CommandBufferHelper *helper) + : helper_(helper) { + Block block = { FREE, 0, size, kUnusedToken }; + blocks_.push_back(block); +} + FencedAllocator::~FencedAllocator() { // Free blocks pending tokens. for (unsigned int i = 0; i < blocks_.size(); ++i) { diff --git a/gpu/command_buffer/client/fenced_allocator.h b/gpu/command_buffer/client/fenced_allocator.h index fd162db41..70d85f6 100644 --- a/gpu/command_buffer/client/fenced_allocator.h +++ b/gpu/command_buffer/client/fenced_allocator.h @@ -33,11 +33,7 @@ class FencedAllocator { // Creates a FencedAllocator. Note that the size of the buffer is passed, but // not its base address: everything is handled as offsets into the buffer. FencedAllocator(unsigned int size, - CommandBufferHelper *helper) - : helper_(helper) { - Block block = { FREE, 0, size, kUnusedToken }; - blocks_.push_back(block); - } + CommandBufferHelper *helper); ~FencedAllocator(); diff --git a/gpu/command_buffer/client/mapped_memory.cc b/gpu/command_buffer/client/mapped_memory.cc index d2c4886..1a63c6f 100644 --- a/gpu/command_buffer/client/mapped_memory.cc +++ b/gpu/command_buffer/client/mapped_memory.cc @@ -22,6 +22,10 @@ MemoryChunk::MemoryChunk( allocator_(shm.size, helper, shm.ptr) { } +MappedMemoryManager::MappedMemoryManager(CommandBufferHelper* helper) + : helper_(helper) { +} + MappedMemoryManager::~MappedMemoryManager() { std::for_each(chunks_.begin(), chunks_.end(), diff --git a/gpu/command_buffer/client/mapped_memory.h b/gpu/command_buffer/client/mapped_memory.h index dcd0b58..f5f3e37 100644 --- a/gpu/command_buffer/client/mapped_memory.h +++ b/gpu/command_buffer/client/mapped_memory.h @@ -101,9 +101,7 @@ class MemoryChunk { // Manages MemoryChucks. class MappedMemoryManager { public: - explicit MappedMemoryManager(CommandBufferHelper* helper) - : helper_(helper) { - } + explicit MappedMemoryManager(CommandBufferHelper* helper); ~MappedMemoryManager(); diff --git a/gpu/command_buffer/common/id_allocator.cc b/gpu/command_buffer/common/id_allocator.cc index 6b2c0e4..68f7972 100644 --- a/gpu/command_buffer/common/id_allocator.cc +++ b/gpu/command_buffer/common/id_allocator.cc @@ -9,7 +9,35 @@ namespace gpu { -IdAllocator::IdAllocator() { +IdAllocator::IdAllocator() {} + +IdAllocator::~IdAllocator() {} + +ResourceId IdAllocator::AllocateID() { + ResourceId id = FindFirstFree(); + MarkAsUsed(id); + return id; +} + +ResourceId IdAllocator::AllocateIDAtOrAbove(ResourceId desired_id) { + GPU_DCHECK_LT(static_cast<ResourceId>(used_ids_.size()), + static_cast<ResourceId>(-1)); + for (; InUse(desired_id); ++desired_id) {} + MarkAsUsed(desired_id); + return desired_id; +} + +bool IdAllocator::MarkAsUsed(ResourceId id) { + std::pair<ResourceIdSet::iterator, bool> result = used_ids_.insert(id); + return result.second; +} + +void IdAllocator::FreeID(ResourceId id) { + used_ids_.erase(id); +} + +bool IdAllocator::InUse(ResourceId id) const { + return id == kInvalidResource || used_ids_.find(id) != used_ids_.end(); } ResourceId IdAllocator::FindFirstFree() const { @@ -24,12 +52,4 @@ ResourceId IdAllocator::FindFirstFree() const { return id; } -ResourceId IdAllocator::AllocateIDAtOrAbove(ResourceId desired_id) { - GPU_DCHECK_LT(static_cast<ResourceId>(used_ids_.size()), - static_cast<ResourceId>(-1)); - for (; InUse(desired_id); ++desired_id) {} - MarkAsUsed(desired_id); - return desired_id; -} - } // namespace gpu diff --git a/gpu/command_buffer/common/id_allocator.h b/gpu/command_buffer/common/id_allocator.h index 76edc34..05c6af07 100644 --- a/gpu/command_buffer/common/id_allocator.h +++ b/gpu/command_buffer/common/id_allocator.h @@ -22,33 +22,23 @@ static const ResourceId kInvalidResource = 0u; class IdAllocator { public: IdAllocator(); + ~IdAllocator(); // Allocates a new resource ID. - ResourceId AllocateID() { - ResourceId id = FindFirstFree(); - MarkAsUsed(id); - return id; - } + ResourceId AllocateID(); // Allocates an Id starting at or above desired_id. // Note: may wrap if it starts near limit. ResourceId AllocateIDAtOrAbove(ResourceId desired_id); // Marks an id as used. Returns false if id was already used. - bool MarkAsUsed(ResourceId id) { - std::pair<ResourceIdSet::iterator, bool> result = used_ids_.insert(id); - return result.second; - } + bool MarkAsUsed(ResourceId id); // Frees a resource ID. - void FreeID(ResourceId id) { - used_ids_.erase(id); - } + void FreeID(ResourceId id); // Checks whether or not a resource ID is in use. - bool InUse(ResourceId id) const { - return id == kInvalidResource || used_ids_.find(id) != used_ids_.end(); - } + bool InUse(ResourceId id) const; private: // TODO(gman): This would work much better with ranges or a hash table. diff --git a/gpu/command_buffer/service/buffer_manager.cc b/gpu/command_buffer/service/buffer_manager.cc index 2abc764..70c5ccb 100644 --- a/gpu/command_buffer/service/buffer_manager.cc +++ b/gpu/command_buffer/service/buffer_manager.cc @@ -10,6 +10,10 @@ namespace gpu { namespace gles2 { +BufferManager::BufferManager() + : allow_buffers_on_multiple_targets_(false) { +} + BufferManager::~BufferManager() { DCHECK(buffer_infos_.empty()); } @@ -50,6 +54,15 @@ void BufferManager::RemoveBufferInfo(GLuint client_id) { } } +BufferManager::BufferInfo::BufferInfo(GLuint service_id) + : service_id_(service_id), + target_(0), + size_(0), + shadowed_(false) { +} + +BufferManager::BufferInfo::~BufferInfo() { } + void BufferManager::BufferInfo::SetSize(GLsizeiptr size, bool shadow) { DCHECK(!IsDeleted()); if (size != size_ || shadow != shadowed_) { diff --git a/gpu/command_buffer/service/buffer_manager.h b/gpu/command_buffer/service/buffer_manager.h index f89faeb..86f6bb8 100644 --- a/gpu/command_buffer/service/buffer_manager.h +++ b/gpu/command_buffer/service/buffer_manager.h @@ -27,12 +27,7 @@ class BufferManager { public: typedef scoped_refptr<BufferInfo> Ref; - explicit BufferInfo(GLuint service_id) - : service_id_(service_id), - target_(0), - size_(0), - shadowed_(false) { - } + explicit BufferInfo(GLuint service_id); GLuint service_id() const { return service_id_; @@ -91,7 +86,7 @@ class BufferManager { GLenum type_; }; - ~BufferInfo() { } + ~BufferInfo(); GLenum target() const { return target_; @@ -140,9 +135,7 @@ class BufferManager { RangeToMaxValueMap range_set_; }; - BufferManager() - : allow_buffers_on_multiple_targets_(false) { - } + BufferManager(); ~BufferManager(); // Must call before destruction. diff --git a/gpu/command_buffer/service/common_decoder.cc b/gpu/command_buffer/service/common_decoder.cc index c28c448..ce45422 100644 --- a/gpu/command_buffer/service/common_decoder.cc +++ b/gpu/command_buffer/service/common_decoder.cc @@ -7,6 +7,10 @@ namespace gpu { +CommonDecoder::Bucket::Bucket() : size_(0) {} + +CommonDecoder::Bucket::~Bucket() {} + void* CommonDecoder::Bucket::GetData(size_t offset, size_t size) const { if (OffsetSizeValid(offset, size)) { return data_.get() + offset; @@ -47,6 +51,10 @@ bool CommonDecoder::Bucket::GetAsString(std::string* str) { return true; } +CommonDecoder::CommonDecoder() : engine_(NULL) {} + +CommonDecoder::~CommonDecoder() {} + void* CommonDecoder::GetAddressAndCheckSize(unsigned int shm_id, unsigned int offset, unsigned int size) { diff --git a/gpu/command_buffer/service/common_decoder.h b/gpu/command_buffer/service/common_decoder.h index adfdaac..7abc016 100644 --- a/gpu/command_buffer/service/common_decoder.h +++ b/gpu/command_buffer/service/common_decoder.h @@ -48,8 +48,8 @@ class CommonDecoder : public AsyncAPIInterface { // be passed across shared memory. class Bucket { public: - Bucket() : size_(0) { - } + Bucket(); + ~Bucket(); size_t size() const { return size_; @@ -92,10 +92,8 @@ class CommonDecoder : public AsyncAPIInterface { DISALLOW_COPY_AND_ASSIGN(Bucket); }; - CommonDecoder() : engine_(NULL) { - } - virtual ~CommonDecoder() { - } + CommonDecoder(); + virtual ~CommonDecoder(); // Sets the engine, to get shared memory buffers from, and to set the token // to. diff --git a/gpu/command_buffer/service/framebuffer_manager.cc b/gpu/command_buffer/service/framebuffer_manager.cc index 9b74f7f..6169a66 100644 --- a/gpu/command_buffer/service/framebuffer_manager.cc +++ b/gpu/command_buffer/service/framebuffer_manager.cc @@ -9,6 +9,8 @@ namespace gpu { namespace gles2 { +FramebufferManager::FramebufferManager() {} + FramebufferManager::~FramebufferManager() { DCHECK(framebuffer_infos_.empty()); } @@ -37,6 +39,12 @@ void FramebufferManager::CreateFramebufferInfo( DCHECK(result.second); } +FramebufferManager::FramebufferInfo::FramebufferInfo(GLuint service_id) + : service_id_(service_id) { +} + +FramebufferManager::FramebufferInfo::~FramebufferInfo() {} + bool FramebufferManager::FramebufferInfo::HasUnclearedAttachment( GLenum attachment) const { AttachmentToRenderbufferMap::const_iterator it = diff --git a/gpu/command_buffer/service/framebuffer_manager.h b/gpu/command_buffer/service/framebuffer_manager.h index 175da42..79ebb2f 100644 --- a/gpu/command_buffer/service/framebuffer_manager.h +++ b/gpu/command_buffer/service/framebuffer_manager.h @@ -24,9 +24,7 @@ class FramebufferManager { public: typedef scoped_refptr<FramebufferInfo> Ref; - explicit FramebufferInfo(GLuint service_id) - : service_id_(service_id) { - } + explicit FramebufferInfo(GLuint service_id); GLuint service_id() const { return service_id_; @@ -49,7 +47,7 @@ class FramebufferManager { friend class FramebufferManager; friend class base::RefCounted<FramebufferInfo>; - ~FramebufferInfo() { } + ~FramebufferInfo(); void MarkAsDeleted() { service_id_ = 0; @@ -65,7 +63,7 @@ class FramebufferManager { AttachmentToRenderbufferMap renderbuffers_; }; - FramebufferManager() { } + FramebufferManager(); ~FramebufferManager(); // Must call before destruction. diff --git a/gpu/command_buffer/service/id_manager.cc b/gpu/command_buffer/service/id_manager.cc index 5052864..be60d7b 100644 --- a/gpu/command_buffer/service/id_manager.cc +++ b/gpu/command_buffer/service/id_manager.cc @@ -8,6 +8,10 @@ namespace gpu { namespace gles2 { +IdManager::IdManager() {} + +IdManager::~IdManager() {} + bool IdManager::AddMapping(GLuint client_id, GLuint service_id) { std::pair<MapType::iterator, bool> result = id_map_.insert( std::make_pair(client_id, service_id)); diff --git a/gpu/command_buffer/service/id_manager.h b/gpu/command_buffer/service/id_manager.h index 9d439be..25e6ac0 100644 --- a/gpu/command_buffer/service/id_manager.h +++ b/gpu/command_buffer/service/id_manager.h @@ -18,7 +18,8 @@ namespace gles2 { // need to be shared by multiple GLES2Decoders. class IdManager { public: - IdManager() { } + IdManager(); + ~IdManager(); // Maps a client_id to a service_id. Return false if the client_id or // service_id are already mapped to something else. diff --git a/gpu/command_buffer/service/program_manager.cc b/gpu/command_buffer/service/program_manager.cc index 3460019..c19806a 100644 --- a/gpu/command_buffer/service/program_manager.cc +++ b/gpu/command_buffer/service/program_manager.cc @@ -27,12 +27,30 @@ static int ShaderTypeToIndex(GLenum shader_type) { } } + +ProgramManager::ProgramInfo::UniformInfo::UniformInfo(GLsizei _size, + GLenum _type, + const std::string& _name) + : size(_size), + type(_type), + name(_name) { +} + +ProgramManager::ProgramInfo::UniformInfo::~UniformInfo() {} + bool ProgramManager::IsInvalidPrefix(const char* name, size_t length) { static const char kInvalidPrefix[] = { 'g', 'l', '_' }; return (length >= sizeof(kInvalidPrefix) && memcmp(name, kInvalidPrefix, sizeof(kInvalidPrefix)) == 0); } +ProgramManager::ProgramInfo::ProgramInfo(GLuint service_id) + : max_attrib_name_length_(0), + max_uniform_name_length_(0), + service_id_(service_id), + valid_(false) { +} + void ProgramManager::ProgramInfo::Reset() { valid_ = false; max_uniform_name_length_ = 0; @@ -320,6 +338,10 @@ bool ProgramManager::ProgramInfo::CanLink() const { return true; } +ProgramManager::ProgramInfo::~ProgramInfo() {} + +ProgramManager::ProgramManager() {} + ProgramManager::~ProgramManager() { DCHECK(program_infos_.empty()); } diff --git a/gpu/command_buffer/service/program_manager.h b/gpu/command_buffer/service/program_manager.h index a10ba61..7fb6fa4 100644 --- a/gpu/command_buffer/service/program_manager.h +++ b/gpu/command_buffer/service/program_manager.h @@ -32,11 +32,9 @@ class ProgramManager { static const int kMaxAttachedShaders = 2; struct UniformInfo { - UniformInfo(GLsizei _size, GLenum _type, const std::string& _name) - : size(_size), - type(_type), - name(_name) { - } + UniformInfo(GLsizei _size, GLenum _type, const std::string& _name); + ~UniformInfo(); + bool IsSampler() const { return type == GL_SAMPLER_2D || type == GL_SAMPLER_CUBE; } @@ -66,12 +64,7 @@ class ProgramManager { typedef std::vector<VertexAttribInfo> AttribInfoVector; typedef std::vector<int> SamplerIndices; - explicit ProgramInfo(GLuint service_id) - : max_attrib_name_length_(0), - max_uniform_name_length_(0), - service_id_(service_id), - valid_(false) { - } + explicit ProgramInfo(GLuint service_id); GLuint service_id() const { return service_id_; @@ -154,7 +147,7 @@ class ProgramManager { friend class base::RefCounted<ProgramInfo>; friend class ProgramManager; - ~ProgramInfo() { } + ~ProgramInfo(); void MarkAsDeleted() { service_id_ = 0; @@ -195,7 +188,7 @@ class ProgramManager { std::string log_info_; }; - ProgramManager() { } + ProgramManager(); ~ProgramManager(); // Must call before destruction. diff --git a/gpu/command_buffer/service/renderbuffer_manager.cc b/gpu/command_buffer/service/renderbuffer_manager.cc index 88a2d26..954c00c 100644 --- a/gpu/command_buffer/service/renderbuffer_manager.cc +++ b/gpu/command_buffer/service/renderbuffer_manager.cc @@ -10,6 +10,8 @@ namespace gpu { namespace gles2 { +RenderbufferManager::RenderbufferManager() {} + RenderbufferManager::~RenderbufferManager() { DCHECK(renderbuffer_infos_.empty()); } diff --git a/gpu/command_buffer/service/renderbuffer_manager.h b/gpu/command_buffer/service/renderbuffer_manager.h index 939ed3f..d3fbaa8 100644 --- a/gpu/command_buffer/service/renderbuffer_manager.h +++ b/gpu/command_buffer/service/renderbuffer_manager.h @@ -74,7 +74,7 @@ class RenderbufferManager { GLenum internal_format_; }; - RenderbufferManager() { } + RenderbufferManager(); ~RenderbufferManager(); // Must call before destruction. diff --git a/gpu/command_buffer/service/shader_manager.cc b/gpu/command_buffer/service/shader_manager.cc index eb4a899..2f82ea4 100644 --- a/gpu/command_buffer/service/shader_manager.cc +++ b/gpu/command_buffer/service/shader_manager.cc @@ -8,6 +8,8 @@ namespace gpu { namespace gles2 { +ShaderManager::ShaderManager() {} + ShaderManager::~ShaderManager() { DCHECK(shader_infos_.empty()); } diff --git a/gpu/command_buffer/service/shader_manager.h b/gpu/command_buffer/service/shader_manager.h index d9b8c46..e056a3e 100644 --- a/gpu/command_buffer/service/shader_manager.h +++ b/gpu/command_buffer/service/shader_manager.h @@ -91,7 +91,7 @@ class ShaderManager { std::string log_info_; }; - ShaderManager() { } + ShaderManager(); ~ShaderManager(); // Must call before destruction. |