OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 UI_GFX_GL_GL_SHARE_GROUP_H_ | 5 #ifndef UI_GFX_GL_GL_SHARE_GROUP_H_ |
6 #define UI_GFX_GL_GL_SHARE_GROUP_H_ | 6 #define UI_GFX_GL_GL_SHARE_GROUP_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <set> | 9 #include <set> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 13 #include "ui/gfx/gl/gl_export.h" |
13 | 14 |
14 namespace gfx { | 15 namespace gfx { |
15 | 16 |
16 class GLContext; | 17 class GLContext; |
17 | 18 |
18 // A group of GL contexts that share an ID namespace. | 19 // A group of GL contexts that share an ID namespace. |
19 class GLShareGroup : public base::RefCounted<GLShareGroup> { | 20 class GL_EXPORT GLShareGroup : public base::RefCounted<GLShareGroup> { |
20 public: | 21 public: |
21 GLShareGroup(); | 22 GLShareGroup(); |
22 | 23 |
23 // These two should only be called from the constructor and destructor of | 24 // These two should only be called from the constructor and destructor of |
24 // GLContext. | 25 // GLContext. |
25 void AddContext(GLContext* context); | 26 void AddContext(GLContext* context); |
26 void RemoveContext(GLContext* context); | 27 void RemoveContext(GLContext* context); |
27 | 28 |
28 // Returns a handle to any initialized context in the share group or NULL if | 29 // Returns a handle to any initialized context in the share group or NULL if |
29 // there are no initialized contexts in the share group. | 30 // there are no initialized contexts in the share group. |
30 void* GetHandle(); | 31 void* GetHandle(); |
31 | 32 |
32 private: | 33 private: |
33 friend class base::RefCounted<GLShareGroup>; | 34 friend class base::RefCounted<GLShareGroup>; |
34 ~GLShareGroup(); | 35 ~GLShareGroup(); |
35 | 36 |
36 // References to GLContext are by raw pointer to avoid a reference count | 37 // References to GLContext are by raw pointer to avoid a reference count |
37 // cycle. | 38 // cycle. |
38 typedef std::set<GLContext*> ContextSet; | 39 typedef std::set<GLContext*> ContextSet; |
39 ContextSet contexts_; | 40 ContextSet contexts_; |
40 DISALLOW_COPY_AND_ASSIGN(GLShareGroup); | 41 DISALLOW_COPY_AND_ASSIGN(GLShareGroup); |
41 }; | 42 }; |
42 | 43 |
43 } // namespace gfx | 44 } // namespace gfx |
44 | 45 |
45 #endif // UI_GFX_GL_GL_SHARE_GROUP_H_ | 46 #endif // UI_GFX_GL_GL_SHARE_GROUP_H_ |
OLD | NEW |