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_CLIENT_SHARE_GROUP_H_ | 5 #ifndef GPU_COMMAND_BUFFER_CLIENT_SHARE_GROUP_H_ |
6 #define GPU_COMMAND_BUFFER_CLIENT_SHARE_GROUP_H_ | 6 #define GPU_COMMAND_BUFFER_CLIENT_SHARE_GROUP_H_ |
7 | 7 |
8 #include <GLES2/gl2.h> | 8 #include <GLES2/gl2.h> |
9 #include "../client/ref_counted.h" | 9 #include "../client/ref_counted.h" |
10 #include "../common/gles2_cmd_format.h" | 10 #include "../common/gles2_cmd_format.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 virtual bool MarkAsUsedForBind(GLuint id) = 0; | 42 virtual bool MarkAsUsedForBind(GLuint id) = 0; |
43 }; | 43 }; |
44 | 44 |
45 // ShareGroup manages shared resources for contexts that are sharing resources. | 45 // ShareGroup manages shared resources for contexts that are sharing resources. |
46 class GLES2_IMPL_EXPORT ShareGroup | 46 class GLES2_IMPL_EXPORT ShareGroup |
47 : public gpu::RefCountedThreadSafe<ShareGroup> { | 47 : public gpu::RefCountedThreadSafe<ShareGroup> { |
48 public: | 48 public: |
49 typedef scoped_refptr<ShareGroup> Ref; | 49 typedef scoped_refptr<ShareGroup> Ref; |
50 | 50 |
51 ShareGroup(bool share_resources, bool bind_generates_resource); | 51 ShareGroup(bool share_resources, bool bind_generates_resource); |
52 ~ShareGroup(); | |
53 | 52 |
54 void SetGLES2ImplementationForDestruction(GLES2Implementation* gl_impl); | 53 void SetGLES2ImplementationForDestruction(GLES2Implementation* gl_impl); |
55 | 54 |
56 bool sharing_resources() const { | 55 bool sharing_resources() const { |
57 return sharing_resources_; | 56 return sharing_resources_; |
58 } | 57 } |
59 | 58 |
60 bool bind_generates_resource() const { | 59 bool bind_generates_resource() const { |
61 return bind_generates_resource_; | 60 return bind_generates_resource_; |
62 } | 61 } |
63 | 62 |
64 bool Initialize(); | 63 bool Initialize(); |
65 | 64 |
66 IdHandlerInterface* GetIdHandler(int namespace_id) const { | 65 IdHandlerInterface* GetIdHandler(int namespace_id) const { |
67 return id_handlers_[namespace_id].get(); | 66 return id_handlers_[namespace_id].get(); |
68 } | 67 } |
69 | 68 |
70 ProgramInfoManager* program_info_manager() { | 69 ProgramInfoManager* program_info_manager() { |
71 return program_info_manager_.get(); | 70 return program_info_manager_.get(); |
72 } | 71 } |
73 | 72 |
74 private: | 73 private: |
| 74 friend class gpu::RefCountedThreadSafe<ShareGroup>; |
| 75 ~ShareGroup(); |
| 76 |
75 scoped_ptr<IdHandlerInterface> id_handlers_[id_namespaces::kNumIdNamespaces]; | 77 scoped_ptr<IdHandlerInterface> id_handlers_[id_namespaces::kNumIdNamespaces]; |
76 scoped_ptr<ProgramInfoManager> program_info_manager_; | 78 scoped_ptr<ProgramInfoManager> program_info_manager_; |
77 | 79 |
78 // Whether or not this context is sharing resources. | 80 // Whether or not this context is sharing resources. |
79 bool sharing_resources_; | 81 bool sharing_resources_; |
80 bool bind_generates_resource_; | 82 bool bind_generates_resource_; |
81 | 83 |
82 GLES2Implementation* gles2_; | 84 GLES2Implementation* gles2_; |
83 | 85 |
84 DISALLOW_COPY_AND_ASSIGN(ShareGroup); | 86 DISALLOW_COPY_AND_ASSIGN(ShareGroup); |
85 }; | 87 }; |
86 | 88 |
87 } // namespace gles2 | 89 } // namespace gles2 |
88 } // namespace gpu | 90 } // namespace gpu |
89 | 91 |
90 #endif // GPU_COMMAND_BUFFER_CLIENT_SHARE_GROUP_H_ | 92 #endif // GPU_COMMAND_BUFFER_CLIENT_SHARE_GROUP_H_ |
OLD | NEW |