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

Side by Side Diff: gpu/command_buffer/service/context_group.h

Issue 10796096: Add tracing of all memory allocated in all contexts (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add global memory usage tracking Created 8 years, 4 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 13 matching lines...) Expand all
24 namespace gles2 { 24 namespace gles2 {
25 25
26 class BufferManager; 26 class BufferManager;
27 class GLES2Decoder; 27 class GLES2Decoder;
28 class FramebufferManager; 28 class FramebufferManager;
29 class MailboxManager; 29 class MailboxManager;
30 class RenderbufferManager; 30 class RenderbufferManager;
31 class ProgramManager; 31 class ProgramManager;
32 class ShaderManager; 32 class ShaderManager;
33 class TextureManager; 33 class TextureManager;
34 class MemoryTracker;
34 struct DisallowedFeatures; 35 struct DisallowedFeatures;
35 36
36 // A Context Group helps manage multiple GLES2Decoders that share 37 // A Context Group helps manage multiple GLES2Decoders that share
37 // resources. 38 // resources.
38 class GPU_EXPORT ContextGroup : public base::RefCounted<ContextGroup> { 39 class GPU_EXPORT ContextGroup : public base::RefCounted<ContextGroup> {
39 public: 40 public:
40 typedef scoped_refptr<ContextGroup> Ref; 41 typedef scoped_refptr<ContextGroup> Ref;
41 42
42 ContextGroup( 43 ContextGroup(
43 MailboxManager* mailbox_manager, 44 MailboxManager* mailbox_manager,
45 MemoryTracker* memory_tracker,
44 bool bind_generates_resource); 46 bool bind_generates_resource);
45 47
46 // This should only be called by GLES2Decoder. This must be paired with a 48 // This should only be called by GLES2Decoder. This must be paired with a
47 // call to destroy if it succeeds. 49 // call to destroy if it succeeds.
48 bool Initialize(const DisallowedFeatures& disallowed_features, 50 bool Initialize(const DisallowedFeatures& disallowed_features,
49 const char* allowed_features); 51 const char* allowed_features);
50 52
51 // Destroys all the resources when called for the last context in the group. 53 // Destroys all the resources when called for the last context in the group.
52 // It should only be called by GLES2Decoder. 54 // It should only be called by GLES2Decoder.
53 void Destroy(bool have_context); 55 void Destroy(bool have_context);
54 56
55 MailboxManager* mailbox_manager() const { 57 MailboxManager* mailbox_manager() const {
56 return mailbox_manager_.get(); 58 return mailbox_manager_.get();
57 } 59 }
58 60
61 MemoryTracker* memory_tracker() const {
62 return memory_tracker_.get();
63 }
64
59 bool bind_generates_resource() { 65 bool bind_generates_resource() {
60 return bind_generates_resource_; 66 return bind_generates_resource_;
61 } 67 }
62 68
63 uint32 max_vertex_attribs() const { 69 uint32 max_vertex_attribs() const {
64 return max_vertex_attribs_; 70 return max_vertex_attribs_;
65 } 71 }
66 72
67 uint32 max_texture_units() const { 73 uint32 max_texture_units() const {
68 return max_texture_units_; 74 return max_texture_units_;
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 private: 133 private:
128 friend class base::RefCounted<ContextGroup>; 134 friend class base::RefCounted<ContextGroup>;
129 ~ContextGroup(); 135 ~ContextGroup();
130 136
131 bool CheckGLFeature(GLint min_required, GLint* v); 137 bool CheckGLFeature(GLint min_required, GLint* v);
132 bool CheckGLFeatureU(GLint min_required, uint32* v); 138 bool CheckGLFeatureU(GLint min_required, uint32* v);
133 bool QueryGLFeature(GLenum pname, GLint min_required, GLint* v); 139 bool QueryGLFeature(GLenum pname, GLint min_required, GLint* v);
134 bool QueryGLFeatureU(GLenum pname, GLint min_required, uint32* v); 140 bool QueryGLFeatureU(GLenum pname, GLint min_required, uint32* v);
135 141
136 scoped_refptr<MailboxManager> mailbox_manager_; 142 scoped_refptr<MailboxManager> mailbox_manager_;
143 scoped_refptr<MemoryTracker> memory_tracker_;
137 scoped_ptr<TransferBufferManagerInterface> transfer_buffer_manager_; 144 scoped_ptr<TransferBufferManagerInterface> transfer_buffer_manager_;
138 145
139 // Whether or not this context is initialized. 146 // Whether or not this context is initialized.
140 int num_contexts_; 147 int num_contexts_;
141 bool enforce_gl_minimums_; 148 bool enforce_gl_minimums_;
142 bool bind_generates_resource_; 149 bool bind_generates_resource_;
143 150
144 uint32 max_vertex_attribs_; 151 uint32 max_vertex_attribs_;
145 uint32 max_texture_units_; 152 uint32 max_texture_units_;
146 uint32 max_texture_image_units_; 153 uint32 max_texture_image_units_;
(...skipping 21 matching lines...) Expand all
168 175
169 DISALLOW_COPY_AND_ASSIGN(ContextGroup); 176 DISALLOW_COPY_AND_ASSIGN(ContextGroup);
170 }; 177 };
171 178
172 } // namespace gles2 179 } // namespace gles2
173 } // namespace gpu 180 } // namespace gpu
174 181
175 #endif // GPU_COMMAND_BUFFER_SERVICE_CONTEXT_GROUP_H_ 182 #endif // GPU_COMMAND_BUFFER_SERVICE_CONTEXT_GROUP_H_
176 183
177 184
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698