OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef GPU_COMMAND_BUFFER_SERVICE_CONTEXT_GROUP_H_ | 5 #ifndef GPU_COMMAND_BUFFER_SERVICE_CONTEXT_GROUP_H_ |
6 #define GPU_COMMAND_BUFFER_SERVICE_CONTEXT_GROUP_H_ | 6 #define GPU_COMMAND_BUFFER_SERVICE_CONTEXT_GROUP_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/hash_tables.h" | 10 #include "base/hash_tables.h" |
(...skipping 22 matching lines...) Expand all Loading... |
33 struct DisallowedFeatures; | 33 struct DisallowedFeatures; |
34 | 34 |
35 // A Context Group helps manage multiple GLES2Decoders that share | 35 // A Context Group helps manage multiple GLES2Decoders that share |
36 // resources. | 36 // resources. |
37 class GPU_EXPORT ContextGroup : public base::RefCounted<ContextGroup> { | 37 class GPU_EXPORT ContextGroup : public base::RefCounted<ContextGroup> { |
38 public: | 38 public: |
39 typedef scoped_refptr<ContextGroup> Ref; | 39 typedef scoped_refptr<ContextGroup> Ref; |
40 | 40 |
41 explicit ContextGroup(MailboxManager* mailbox_manager, | 41 explicit ContextGroup(MailboxManager* mailbox_manager, |
42 bool bind_generates_resource); | 42 bool bind_generates_resource); |
43 ~ContextGroup(); | |
44 | 43 |
45 // This should only be called by GLES2Decoder. This must be paired with a | 44 // This should only be called by GLES2Decoder. This must be paired with a |
46 // call to destroy if it succeeds. | 45 // call to destroy if it succeeds. |
47 bool Initialize(const DisallowedFeatures& disallowed_features, | 46 bool Initialize(const DisallowedFeatures& disallowed_features, |
48 const char* allowed_features); | 47 const char* allowed_features); |
49 | 48 |
50 // Destroys all the resources when called for the last context in the group. | 49 // Destroys all the resources when called for the last context in the group. |
51 // It should only be called by GLES2Decoder. | 50 // It should only be called by GLES2Decoder. |
52 void Destroy(bool have_context); | 51 void Destroy(bool have_context); |
53 | 52 |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 return program_manager_.get(); | 110 return program_manager_.get(); |
112 } | 111 } |
113 | 112 |
114 ShaderManager* shader_manager() const { | 113 ShaderManager* shader_manager() const { |
115 return shader_manager_.get(); | 114 return shader_manager_.get(); |
116 } | 115 } |
117 | 116 |
118 IdAllocatorInterface* GetIdAllocator(unsigned namespace_id); | 117 IdAllocatorInterface* GetIdAllocator(unsigned namespace_id); |
119 | 118 |
120 private: | 119 private: |
| 120 friend class base::RefCounted<ContextGroup>; |
| 121 ~ContextGroup(); |
| 122 |
121 bool CheckGLFeature(GLint min_required, GLint* v); | 123 bool CheckGLFeature(GLint min_required, GLint* v); |
122 bool CheckGLFeatureU(GLint min_required, uint32* v); | 124 bool CheckGLFeatureU(GLint min_required, uint32* v); |
123 bool QueryGLFeature(GLenum pname, GLint min_required, GLint* v); | 125 bool QueryGLFeature(GLenum pname, GLint min_required, GLint* v); |
124 bool QueryGLFeatureU(GLenum pname, GLint min_required, uint32* v); | 126 bool QueryGLFeatureU(GLenum pname, GLint min_required, uint32* v); |
125 | 127 |
126 scoped_refptr<MailboxManager> mailbox_manager_; | 128 scoped_refptr<MailboxManager> mailbox_manager_; |
127 | 129 |
128 // Whether or not this context is initialized. | 130 // Whether or not this context is initialized. |
129 int num_contexts_; | 131 int num_contexts_; |
130 bool enforce_gl_minimums_; | 132 bool enforce_gl_minimums_; |
(...skipping 26 matching lines...) Expand all Loading... |
157 | 159 |
158 DISALLOW_COPY_AND_ASSIGN(ContextGroup); | 160 DISALLOW_COPY_AND_ASSIGN(ContextGroup); |
159 }; | 161 }; |
160 | 162 |
161 } // namespace gles2 | 163 } // namespace gles2 |
162 } // namespace gpu | 164 } // namespace gpu |
163 | 165 |
164 #endif // GPU_COMMAND_BUFFER_SERVICE_CONTEXT_GROUP_H_ | 166 #endif // GPU_COMMAND_BUFFER_SERVICE_CONTEXT_GROUP_H_ |
165 | 167 |
166 | 168 |
OLD | NEW |