summaryrefslogtreecommitdiffstats
path: root/gpu/command_buffer/service/context_group.h
diff options
context:
space:
mode:
authorapatrick@chromium.org <apatrick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-05 19:42:41 +0000
committerapatrick@chromium.org <apatrick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-05 19:42:41 +0000
commit3ae01938b23545caf941c7fcaa655a17db77351b (patch)
treebdd9f3ecf59f1e6c2e244d576879b82dffde6bf4 /gpu/command_buffer/service/context_group.h
parent2974287a9ca47547a00347b786c651b4953ecc82 (diff)
downloadchromium_src-3ae01938b23545caf941c7fcaa655a17db77351b.zip
chromium_src-3ae01938b23545caf941c7fcaa655a17db77351b.tar.gz
chromium_src-3ae01938b23545caf941c7fcaa655a17db77351b.tar.bz2
Ensure that ContextGroup is destroyed when an appropriate GL context is current.
Before it relied on the destructor being invoked and this was not always true. I think the subsequent invalid GL commands might have caused memory corruption that lead to the bug referenced below. Now the ContextGroup is destroyed explicitly when the context is known to be correct. BUG=97775 Review URL: http://codereview.chromium.org/8135014 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@104157 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gpu/command_buffer/service/context_group.h')
-rw-r--r--gpu/command_buffer/service/context_group.h16
1 files changed, 6 insertions, 10 deletions
diff --git a/gpu/command_buffer/service/context_group.h b/gpu/command_buffer/service/context_group.h
index 1700423..48fac44 100644
--- a/gpu/command_buffer/service/context_group.h
+++ b/gpu/command_buffer/service/context_group.h
@@ -39,14 +39,14 @@ class ContextGroup : public base::RefCounted<ContextGroup> {
explicit ContextGroup(bool bind_generates_resource);
~ContextGroup();
- // This should only be called by GLES2Decoder.
+ // This should only be called by GLES2Decoder. This must be paired with a
+ // call to destroy if it succeeds.
bool Initialize(const DisallowedFeatures& disallowed_features,
const char* allowed_features);
- // Sets the ContextGroup has having a lost context.
- void set_have_context(bool have_context) {
- have_context_ = have_context;
- }
+ // Destroys all the resources when called for the last context in the group.
+ // It should only be called by GLES2Decoder.
+ void Destroy(bool have_context);
bool bind_generates_resource() {
return bind_generates_resource_;
@@ -111,12 +111,8 @@ class ContextGroup : public base::RefCounted<ContextGroup> {
IdAllocatorInterface* GetIdAllocator(unsigned namespace_id);
private:
- // Destroys all the resources.
- void Destroy();
-
// Whether or not this context is initialized.
- bool initialized_;
- bool have_context_;
+ int num_contexts_;
bool bind_generates_resource_;
uint32 max_vertex_attribs_;