Don't add an aura tooltip to bubble close buttons on Windows.
[chromium-blink-merge.git] / gpu / command_buffer / service / vertex_array_manager.h
blob97ecc1a5353a90fcd301c405dd82e2f916f56789
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
3 // found in the LICENSE file.
5 #ifndef GPU_COMMAND_BUFFER_SERVICE_VERTEX_ARRAY_MANAGER_H_
6 #define GPU_COMMAND_BUFFER_SERVICE_VERTEX_ARRAY_MANAGER_H_
8 #include "base/basictypes.h"
9 #include "base/containers/hash_tables.h"
10 #include "base/logging.h"
11 #include "base/memory/ref_counted.h"
12 #include "base/memory/scoped_ptr.h"
13 #include "gpu/command_buffer/service/gl_utils.h"
14 #include "gpu/gpu_export.h"
16 namespace gpu {
17 namespace gles2 {
19 class VertexAttribManager;
21 // This class keeps track of the vertex arrays and their sizes so we can do
22 // bounds checking.
23 class GPU_EXPORT VertexArrayManager {
24 public:
25 VertexArrayManager();
26 ~VertexArrayManager();
28 // Must call before destruction.
29 void Destroy(bool have_context);
31 // Creates a VertexAttribManager and if client_visible,
32 // maps it to the client_id.
33 scoped_refptr<VertexAttribManager> CreateVertexAttribManager(
34 GLuint client_id,
35 GLuint service_id,
36 uint32 num_vertex_attribs,
37 bool client_visible);
39 // Gets the vertex attrib manager for the given vertex array.
40 VertexAttribManager* GetVertexAttribManager(GLuint client_id);
42 // Removes the vertex attrib manager for the given vertex array.
43 void RemoveVertexAttribManager(GLuint client_id);
45 // Gets a client id for a given service id.
46 bool GetClientId(GLuint service_id, GLuint* client_id) const;
48 private:
49 friend class VertexAttribManager;
51 void StartTracking(VertexAttribManager* vertex_attrib_manager);
52 void StopTracking(VertexAttribManager* vertex_attrib_manager);
54 // Info for each vertex array in the system.
55 typedef base::hash_map<GLuint, scoped_refptr<VertexAttribManager> >
56 VertexAttribManagerMap;
57 VertexAttribManagerMap vertex_attrib_managers_;
59 // Counts the number of VertexArrayInfo allocated with 'this' as its manager.
60 // Allows to check no VertexArrayInfo will outlive this.
61 unsigned int vertex_attrib_manager_count_;
63 bool have_context_;
65 DISALLOW_COPY_AND_ASSIGN(VertexArrayManager);
68 } // namespace gles2
69 } // namespace gpu
71 #endif // GPU_COMMAND_BUFFER_SERVICE_VERTEX_ARRAY_MANAGER_H_