diff options
| author | rsleevi@chromium.org <rsleevi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-18 21:37:04 +0000 |
|---|---|---|
| committer | rsleevi@chromium.org <rsleevi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-18 21:37:04 +0000 |
| commit | 6cac5e0d44fe709949fb9e51f08a5a1d9141fe46 (patch) | |
| tree | 9a9983acfef5154308dd932da6af083558aa1b63 /gpu | |
| parent | fe6db703db974286f322d3aa310d7c8febbd2067 (diff) | |
| download | chromium_src-6cac5e0d44fe709949fb9e51f08a5a1d9141fe46.zip chromium_src-6cac5e0d44fe709949fb9e51f08a5a1d9141fe46.tar.gz chromium_src-6cac5e0d44fe709949fb9e51f08a5a1d9141fe46.tar.bz2 | |
RefCounted types should not have public destructors, media/ and gpu/ edition
BUG=123295
TEST=none
Review URL: https://chromiumcodereview.appspot.com/10067035
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@137966 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gpu')
| -rw-r--r-- | gpu/command_buffer/client/share_group.cc | 11 | ||||
| -rw-r--r-- | gpu/command_buffer/client/share_group.h | 4 | ||||
| -rw-r--r-- | gpu/command_buffer/service/context_group.cc | 78 | ||||
| -rw-r--r-- | gpu/command_buffer/service/context_group.h | 4 | ||||
| -rw-r--r-- | gpu/command_buffer/service/feature_info.cc | 6 | ||||
| -rw-r--r-- | gpu/command_buffer/service/feature_info.h | 4 | ||||
| -rw-r--r-- | gpu/command_buffer/service/framebuffer_manager.cc | 10 | ||||
| -rw-r--r-- | gpu/command_buffer/service/framebuffer_manager.h | 5 | ||||
| -rw-r--r-- | gpu/command_buffer/service/query_manager.cc | 44 | ||||
| -rw-r--r-- | gpu/command_buffer/service/query_manager.h | 5 |
10 files changed, 93 insertions, 78 deletions
diff --git a/gpu/command_buffer/client/share_group.cc b/gpu/command_buffer/client/share_group.cc index e57ec60..39d9b85 100644 --- a/gpu/command_buffer/client/share_group.cc +++ b/gpu/command_buffer/client/share_group.cc @@ -223,6 +223,11 @@ ShareGroup::ShareGroup(bool share_resources, bool bind_generates_resource) program_info_manager_.reset(ProgramInfoManager::Create(false)); } +void ShareGroup::SetGLES2ImplementationForDestruction( + GLES2Implementation* gl_impl) { + gles2_ = gl_impl; +} + ShareGroup::~ShareGroup() { for (int i = 0; i < id_namespaces::kNumIdNamespaces; ++i) { id_handlers_[i]->Destroy(gles2_); @@ -230,11 +235,5 @@ ShareGroup::~ShareGroup() { } } -void ShareGroup::SetGLES2ImplementationForDestruction( - GLES2Implementation* gl_impl) { - gles2_ = gl_impl; -} - - } // namespace gles2 } // namespace gpu diff --git a/gpu/command_buffer/client/share_group.h b/gpu/command_buffer/client/share_group.h index 3a0df32..6762ff6 100644 --- a/gpu/command_buffer/client/share_group.h +++ b/gpu/command_buffer/client/share_group.h @@ -49,7 +49,6 @@ class GLES2_IMPL_EXPORT ShareGroup typedef scoped_refptr<ShareGroup> Ref; ShareGroup(bool share_resources, bool bind_generates_resource); - ~ShareGroup(); void SetGLES2ImplementationForDestruction(GLES2Implementation* gl_impl); @@ -72,6 +71,9 @@ class GLES2_IMPL_EXPORT ShareGroup } private: + friend class gpu::RefCountedThreadSafe<ShareGroup>; + ~ShareGroup(); + scoped_ptr<IdHandlerInterface> id_handlers_[id_namespaces::kNumIdNamespaces]; scoped_ptr<ProgramInfoManager> program_info_manager_; diff --git a/gpu/command_buffer/service/context_group.cc b/gpu/command_buffer/service/context_group.cc index d873ace..2b6c8ef 100644 --- a/gpu/command_buffer/service/context_group.cc +++ b/gpu/command_buffer/service/context_group.cc @@ -47,51 +47,12 @@ ContextGroup::ContextGroup(MailboxManager* mailbox_manager, id_namespaces_[id_namespaces::kQueries].reset(new IdAllocator); } -ContextGroup::~ContextGroup() { - CHECK(num_contexts_ == 0); -} - static void GetIntegerv(GLenum pname, uint32* var) { GLint value = 0; glGetIntegerv(pname, &value); *var = value; } -bool ContextGroup::CheckGLFeature(GLint min_required, GLint* v) { - GLint value = *v; - if (enforce_gl_minimums_) { - value = std::min(min_required, value); - } - *v = value; - return value >= min_required; -} - -bool ContextGroup::CheckGLFeatureU(GLint min_required, uint32* v) { - GLint value = *v; - if (enforce_gl_minimums_) { - value = std::min(min_required, value); - } - *v = value; - return value >= min_required; -} - -bool ContextGroup::QueryGLFeature( - GLenum pname, GLint min_required, GLint* v) { - GLint value = 0; - glGetIntegerv(pname, &value); - *v = value; - return CheckGLFeature(min_required, v); -} - -bool ContextGroup::QueryGLFeatureU( - GLenum pname, GLint min_required, uint32* v) { - uint32 value = 0; - GetIntegerv(pname, &value); - bool result = CheckGLFeatureU(min_required, &value); - *v = value; - return result; -} - bool ContextGroup::Initialize(const DisallowedFeatures& disallowed_features, const char* allowed_features) { if (num_contexts_ > 0) { @@ -270,6 +231,45 @@ IdAllocatorInterface* ContextGroup::GetIdAllocator(unsigned namespace_id) { return id_namespaces_[namespace_id].get(); } +ContextGroup::~ContextGroup() { + CHECK(num_contexts_ == 0); +} + +bool ContextGroup::CheckGLFeature(GLint min_required, GLint* v) { + GLint value = *v; + if (enforce_gl_minimums_) { + value = std::min(min_required, value); + } + *v = value; + return value >= min_required; +} + +bool ContextGroup::CheckGLFeatureU(GLint min_required, uint32* v) { + GLint value = *v; + if (enforce_gl_minimums_) { + value = std::min(min_required, value); + } + *v = value; + return value >= min_required; +} + +bool ContextGroup::QueryGLFeature( + GLenum pname, GLint min_required, GLint* v) { + GLint value = 0; + glGetIntegerv(pname, &value); + *v = value; + return CheckGLFeature(min_required, v); +} + +bool ContextGroup::QueryGLFeatureU( + GLenum pname, GLint min_required, uint32* v) { + uint32 value = 0; + GetIntegerv(pname, &value); + bool result = CheckGLFeatureU(min_required, &value); + *v = value; + return result; +} + } // namespace gles2 } // namespace gpu diff --git a/gpu/command_buffer/service/context_group.h b/gpu/command_buffer/service/context_group.h index 8c5477e..7b9118f 100644 --- a/gpu/command_buffer/service/context_group.h +++ b/gpu/command_buffer/service/context_group.h @@ -40,7 +40,6 @@ class GPU_EXPORT ContextGroup : public base::RefCounted<ContextGroup> { explicit ContextGroup(MailboxManager* mailbox_manager, bool bind_generates_resource); - ~ContextGroup(); // This should only be called by GLES2Decoder. This must be paired with a // call to destroy if it succeeds. @@ -118,6 +117,9 @@ class GPU_EXPORT ContextGroup : public base::RefCounted<ContextGroup> { IdAllocatorInterface* GetIdAllocator(unsigned namespace_id); private: + friend class base::RefCounted<ContextGroup>; + ~ContextGroup(); + bool CheckGLFeature(GLint min_required, GLint* v); bool CheckGLFeatureU(GLint min_required, uint32* v); bool QueryGLFeature(GLenum pname, GLint min_required, GLint* v); diff --git a/gpu/command_buffer/service/feature_info.cc b/gpu/command_buffer/service/feature_info.cc index 8738cac..a7a1ab4 100644 --- a/gpu/command_buffer/service/feature_info.cc +++ b/gpu/command_buffer/service/feature_info.cc @@ -21,9 +21,6 @@ namespace gles2 { FeatureInfo::FeatureInfo() { } -FeatureInfo::~FeatureInfo() { -} - // Helps query for extensions. class ExtensionHelper { public: @@ -510,5 +507,8 @@ void FeatureInfo::AddExtensionString(const std::string& str) { } } +FeatureInfo::~FeatureInfo() { +} + } // namespace gles2 } // namespace gpu diff --git a/gpu/command_buffer/service/feature_info.h b/gpu/command_buffer/service/feature_info.h index da98c86..b626441 100644 --- a/gpu/command_buffer/service/feature_info.h +++ b/gpu/command_buffer/service/feature_info.h @@ -62,7 +62,6 @@ class GPU_EXPORT FeatureInfo : public base::RefCounted<FeatureInfo> { }; FeatureInfo(); - ~FeatureInfo(); // If allowed features = NULL or "*", all features are allowed. Otherwise // only features that match the strings in allowed_features are allowed. @@ -87,6 +86,9 @@ class GPU_EXPORT FeatureInfo : public base::RefCounted<FeatureInfo> { } private: + friend class base::RefCounted<FeatureInfo>; + ~FeatureInfo(); + void AddExtensionString(const std::string& str); Validators validators_; diff --git a/gpu/command_buffer/service/framebuffer_manager.cc b/gpu/command_buffer/service/framebuffer_manager.cc index 4680a37..7ed551b 100644 --- a/gpu/command_buffer/service/framebuffer_manager.cc +++ b/gpu/command_buffer/service/framebuffer_manager.cc @@ -17,8 +17,6 @@ class RenderbufferAttachment : renderbuffer_(renderbuffer) { } - virtual ~RenderbufferAttachment() { } - virtual GLsizei width() const { return renderbuffer_->width(); } @@ -73,6 +71,9 @@ class RenderbufferAttachment return renderbuffer_.get(); } + protected: + virtual ~RenderbufferAttachment() { } + private: RenderbufferManager::RenderbufferInfo::Ref renderbuffer_; @@ -89,8 +90,6 @@ class TextureAttachment level_(level) { } - virtual ~TextureAttachment() { } - virtual GLsizei width() const { GLsizei temp_width = 0; GLsizei temp_height = 0; @@ -159,6 +158,9 @@ class TextureAttachment return (need & have) != 0; } + protected: + virtual ~TextureAttachment() { } + private: TextureManager::TextureInfo::Ref texture_; GLenum target_; diff --git a/gpu/command_buffer/service/framebuffer_manager.h b/gpu/command_buffer/service/framebuffer_manager.h index d2dcee5..cc2cefb 100644 --- a/gpu/command_buffer/service/framebuffer_manager.h +++ b/gpu/command_buffer/service/framebuffer_manager.h @@ -30,7 +30,6 @@ class GPU_EXPORT FramebufferManager { public: typedef scoped_refptr<Attachment> Ref; - virtual ~Attachment() { } virtual GLsizei width() const = 0; virtual GLsizei height() const = 0; virtual GLenum internal_format() const = 0; @@ -45,6 +44,10 @@ class GPU_EXPORT FramebufferManager { virtual bool CanRenderTo() const = 0; virtual void DetachFromFramebuffer() = 0; virtual bool ValidForAttachmentType(GLenum attachment_type) = 0; + + protected: + friend class base::RefCounted<Attachment>; + virtual ~Attachment() {} }; FramebufferInfo(FramebufferManager* manager, GLuint service_id); diff --git a/gpu/command_buffer/service/query_manager.cc b/gpu/command_buffer/service/query_manager.cc index 81ac83e..14a4ab4 100644 --- a/gpu/command_buffer/service/query_manager.cc +++ b/gpu/command_buffer/service/query_manager.cc @@ -18,12 +18,14 @@ class AllSamplesPassedQuery : public QueryManager::Query { AllSamplesPassedQuery( QueryManager* manager, GLenum target, int32 shm_id, uint32 shm_offset, GLuint service_id); - virtual ~AllSamplesPassedQuery(); virtual bool Begin() OVERRIDE; virtual bool End(uint32 submit_count) OVERRIDE; virtual bool Process() OVERRIDE; virtual void Destroy(bool have_context) OVERRIDE; + protected: + virtual ~AllSamplesPassedQuery(); + private: // Service side query id. GLuint service_id_; @@ -36,16 +38,6 @@ AllSamplesPassedQuery::AllSamplesPassedQuery( service_id_(service_id) { } -AllSamplesPassedQuery::~AllSamplesPassedQuery() { -} - -void AllSamplesPassedQuery::Destroy(bool have_context) { - if (have_context && !IsDeleted()) { - glDeleteQueriesARB(1, &service_id_); - MarkAsDeleted(); - } -} - bool AllSamplesPassedQuery::Begin() { BeginQueryHelper(target(), service_id_); return true; @@ -70,17 +62,29 @@ bool AllSamplesPassedQuery::Process() { return MarkAsCompleted(result != 0); } +void AllSamplesPassedQuery::Destroy(bool have_context) { + if (have_context && !IsDeleted()) { + glDeleteQueriesARB(1, &service_id_); + MarkAsDeleted(); + } +} + +AllSamplesPassedQuery::~AllSamplesPassedQuery() { +} + class CommandsIssuedQuery : public QueryManager::Query { public: CommandsIssuedQuery( QueryManager* manager, GLenum target, int32 shm_id, uint32 shm_offset); - virtual ~CommandsIssuedQuery(); virtual bool Begin() OVERRIDE; virtual bool End(uint32 submit_count) OVERRIDE; virtual bool Process() OVERRIDE; virtual void Destroy(bool have_context) OVERRIDE; + protected: + virtual ~CommandsIssuedQuery(); + private: base::TimeTicks begin_time_; }; @@ -90,14 +94,6 @@ CommandsIssuedQuery::CommandsIssuedQuery( : Query(manager, target, shm_id, shm_offset) { } -CommandsIssuedQuery::~CommandsIssuedQuery() { -} - -bool CommandsIssuedQuery::Process() { - NOTREACHED(); - return true; -} - bool CommandsIssuedQuery::Begin() { begin_time_ = base::TimeTicks::HighResNow(); return true; @@ -110,12 +106,20 @@ bool CommandsIssuedQuery::End(uint32 submit_count) { std::min(elapsed.InMicroseconds(), static_cast<int64>(0xFFFFFFFFL))); } +bool CommandsIssuedQuery::Process() { + NOTREACHED(); + return true; +} + void CommandsIssuedQuery::Destroy(bool /* have_context */) { if (!IsDeleted()) { MarkAsDeleted(); } } +CommandsIssuedQuery::~CommandsIssuedQuery() { +} + QueryManager::QueryManager( CommonDecoder* decoder, FeatureInfo* feature_info) diff --git a/gpu/command_buffer/service/query_manager.h b/gpu/command_buffer/service/query_manager.h index 1560a94..7e3f38d 100644 --- a/gpu/command_buffer/service/query_manager.h +++ b/gpu/command_buffer/service/query_manager.h @@ -32,8 +32,7 @@ class GPU_EXPORT QueryManager { typedef scoped_refptr<Query> Ref; Query( - QueryManager* manager, GLenum target, int32 shm_id, uint32 shm_offset); - virtual ~Query(); + QueryManager* manager, GLenum target, int32 shm_id, uint32 shm_offset); GLenum target() const { return target_; @@ -71,6 +70,8 @@ class GPU_EXPORT QueryManager { virtual void Destroy(bool have_context) = 0; protected: + virtual ~Query(); + QueryManager* manager() const { return manager_; } |
