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

Unified Diff: gpu/command_buffer/service/shader_translator.h

Issue 10694111: RefCounted types should not have public destructors (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 5 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
Index: gpu/command_buffer/service/shader_translator.h
diff --git a/gpu/command_buffer/service/shader_translator.h b/gpu/command_buffer/service/shader_translator.h
index 9173740170de0c2abb4fbadd90f967c33dbb71b9..c38feb8f489101bee54263ea782761be40012c8d 100644
--- a/gpu/command_buffer/service/shader_translator.h
+++ b/gpu/command_buffer/service/shader_translator.h
@@ -32,7 +32,25 @@ class ShaderTranslatorInterface {
kGlslBuiltInFunctionEmulated
};
- virtual ~ShaderTranslatorInterface() { }
+ struct VariableInfo {
+ VariableInfo()
+ : type(0),
+ size(0) {
+ }
+
+ VariableInfo(int _type, int _size, std::string _name)
+ : type(_type),
+ size(_size),
+ name(_name) {
+ }
+
+ int type;
+ int size;
+ std::string name; // name in the original shader source.
+ };
+
+ // Mapping between variable name and info.
+ typedef base::hash_map<std::string, VariableInfo> VariableMap;
// Initializes the translator.
// Must be called once before using the translator object.
@@ -54,24 +72,11 @@ class ShaderTranslatorInterface {
virtual const char* translated_shader() const = 0;
virtual const char* info_log() const = 0;
- struct VariableInfo {
- VariableInfo()
- : type(0),
- size(0) {
- }
- VariableInfo(int _type, int _size, std::string _name)
- : type(_type),
- size(_size),
- name(_name) {
- }
- int type;
- int size;
- std::string name; // name in the original shader source.
- };
- // Mapping between variable name and info.
- typedef base::hash_map<std::string, VariableInfo> VariableMap;
virtual const VariableMap& attrib_map() const = 0;
virtual const VariableMap& uniform_map() const = 0;
+
+ protected:
+ virtual ~ShaderTranslatorInterface() {}
};
// Implementation of ShaderTranslatorInterface
@@ -85,6 +90,7 @@ class GPU_EXPORT ShaderTranslator
virtual ~DestructionObserver();
virtual void OnDestruct(ShaderTranslator* translator) = 0;
+
private:
DISALLOW_COPY_AND_ASSIGN(DestructionObserver);
};
@@ -114,6 +120,7 @@ class GPU_EXPORT ShaderTranslator
void RemoveDestructionObserver(DestructionObserver* observer);
private:
+ friend class base::RefCounted<ShaderTranslator>;
virtual ~ShaderTranslator();
void ClearResults();

Powered by Google App Engine
This is Rietveld 408576698