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

Unified Diff: gpu/command_buffer/client/share_group.h

Issue 9918027: Make ShareGroup thread safe (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add id==0 check Created 8 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gpu/command_buffer/client/program_info_manager.cc ('k') | gpu/command_buffer/client/share_group.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gpu/command_buffer/client/share_group.h
diff --git a/gpu/command_buffer/client/share_group.h b/gpu/command_buffer/client/share_group.h
index 8ce940ab6bb2a46124baa326300da1d089aa481e..cf3c44b0083ff7fc828e52aaab1ca3196687b207 100644
--- a/gpu/command_buffer/client/share_group.h
+++ b/gpu/command_buffer/client/share_group.h
@@ -5,24 +5,79 @@
#ifndef GPU_COMMAND_BUFFER_CLIENT_SHARE_GROUP_H_
#define GPU_COMMAND_BUFFER_CLIENT_SHARE_GROUP_H_
+#include <GLES2/gl2.h>
#include "../client/ref_counted.h"
+#include "../common/gles2_cmd_format.h"
+#include "../common/scoped_ptr.h"
#include "gles2_impl_export.h"
namespace gpu {
namespace gles2 {
+class GLES2Implementation;
+class ProgramInfoManager;
+
+// Base class for IdHandlers
+class IdHandlerInterface {
+ public:
+ IdHandlerInterface() { }
+ virtual ~IdHandlerInterface() { }
+
+ // Free everything.
+ virtual void Destroy(GLES2Implementation* gl_impl) = 0;
+
+ // Makes some ids at or above id_offset.
+ virtual void MakeIds(
+ GLES2Implementation* gl_impl,
+ GLuint id_offset, GLsizei n, GLuint* ids) = 0;
+
+ // Frees some ids.
+ virtual bool FreeIds(
+ GLES2Implementation* gl_impl, GLsizei n, const GLuint* ids) = 0;
+
+ // Marks an id as used for glBind functions. id = 0 does nothing.
+ virtual bool MarkAsUsedForBind(GLuint id) = 0;
+};
+
// ShareGroup manages shared resources for contexts that are sharing resources.
class GLES2_IMPL_EXPORT ShareGroup
: public gpu::RefCountedThreadSafe<ShareGroup> {
public:
typedef scoped_refptr<ShareGroup> Ref;
- ShareGroup();
+ ShareGroup(bool share_resources, bool bind_generates_resource);
~ShareGroup();
+ void SetGLES2ImplementationForDestruction(GLES2Implementation* gl_impl);
+
+ bool sharing_resources() const {
+ return sharing_resources_;
+ }
+
+ bool bind_generates_resource() const {
+ return bind_generates_resource_;
+ }
+
bool Initialize();
+ IdHandlerInterface* GetIdHandler(int namespace_id) const {
+ return id_handlers_[namespace_id].get();
+ }
+
+ ProgramInfoManager* program_info_manager() {
+ return program_info_manager_.get();
+ }
+
private:
+ scoped_ptr<IdHandlerInterface> id_handlers_[id_namespaces::kNumIdNamespaces];
+ scoped_ptr<ProgramInfoManager> program_info_manager_;
+
+ // Whether or not this context is sharing resources.
+ bool sharing_resources_;
+ bool bind_generates_resource_;
+
+ GLES2Implementation* gles2_;
+
DISALLOW_COPY_AND_ASSIGN(ShareGroup);
};
« no previous file with comments | « gpu/command_buffer/client/program_info_manager.cc ('k') | gpu/command_buffer/client/share_group.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698