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

Side by Side Diff: third_party/WebKit/Source/modules/webgl/WebGLObject.h

Issue 2671553003: Remove uses of VisitDOMWrapper (Closed)
Patch Set: Add DependentLifetime when removing Custom=VisitDOMWrapper Created 3 years, 10 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Apple Inc. All rights reserved. 2 * Copyright (C) 2009 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 // is specifically not. This is done in order to allow WebGLObjects to 90 // is specifically not. This is done in order to allow WebGLObjects to
91 // refer back to their owning context in their destructor to delete their 91 // refer back to their owning context in their destructor to delete their
92 // resources if they are GC'd before the context is. 92 // resources if they are GC'd before the context is.
93 EAGERLY_FINALIZE(); 93 EAGERLY_FINALIZE();
94 94
95 DEFINE_INLINE_VIRTUAL_TRACE() {} 95 DEFINE_INLINE_VIRTUAL_TRACE() {}
96 96
97 DECLARE_VIRTUAL_TRACE_WRAPPERS(); 97 DECLARE_VIRTUAL_TRACE_WRAPPERS();
98 98
99 protected: 99 protected:
100 // To allow WebGL[2]RenderingContextBase to call visitChildDOMWrappers.
101 friend class WebGLRenderingContextBase;
102 friend class WebGL2RenderingContextBase;
103
104 explicit WebGLObject(WebGLRenderingContextBase*); 100 explicit WebGLObject(WebGLRenderingContextBase*);
105 101
106 // deleteObjectImpl should be only called once to delete the OpenGL resource. 102 // deleteObjectImpl should be only called once to delete the OpenGL resource.
107 // After calling deleteObjectImpl, hasObject() should return false. 103 // After calling deleteObjectImpl, hasObject() should return false.
108 virtual void deleteObjectImpl(gpu::gles2::GLES2Interface*) = 0; 104 virtual void deleteObjectImpl(gpu::gles2::GLES2Interface*) = 0;
109 105
110 virtual bool hasGroupOrContext() const = 0; 106 virtual bool hasGroupOrContext() const = 0;
111 107
112 // Return the current number of context losses associated with this 108 // Return the current number of context losses associated with this
113 // object's context group (if it's a shared object), or its 109 // object's context group (if it's a shared object), or its
114 // context's context group (if it's a per-context object). 110 // context's context group (if it's a per-context object).
115 virtual uint32_t currentNumberOfContextLosses() const = 0; 111 virtual uint32_t currentNumberOfContextLosses() const = 0;
116 112
117 uint32_t cachedNumberOfContextLosses() const; 113 uint32_t cachedNumberOfContextLosses() const;
118 114
119 void detach(); 115 void detach();
120 void detachAndDeleteObject(); 116 void detachAndDeleteObject();
121 117
122 virtual gpu::gles2::GLES2Interface* getAGLInterface() const = 0; 118 virtual gpu::gles2::GLES2Interface* getAGLInterface() const = 0;
123 119
124 virtual void visitChildDOMWrappers(v8::Isolate*,
125 const v8::Persistent<v8::Object>&) {}
126
127 // Used by leaf subclasses to run the destruction sequence -- what would 120 // Used by leaf subclasses to run the destruction sequence -- what would
128 // be in the destructor of the base class, if it could be. Must be called 121 // be in the destructor of the base class, if it could be. Must be called
129 // no more than once. 122 // no more than once.
130 void runDestructor(); 123 void runDestructor();
131 124
132 // Indicates to subclasses that the destructor is being run. 125 // Indicates to subclasses that the destructor is being run.
133 bool destructionInProgress() const; 126 bool destructionInProgress() const;
134 127
135 private: 128 private:
136 // This was the number of context losses of the object's associated 129 // This was the number of context losses of the object's associated
137 // WebGLContextGroup at the time this object was created. Contexts 130 // WebGLContextGroup at the time this object was created. Contexts
138 // no longer refer to all the objects that they ever created, so 131 // no longer refer to all the objects that they ever created, so
139 // it's necessary to check this count when validating each object. 132 // it's necessary to check this count when validating each object.
140 uint32_t m_cachedNumberOfContextLosses; 133 uint32_t m_cachedNumberOfContextLosses;
141 134
142 unsigned m_attachmentCount; 135 unsigned m_attachmentCount;
143 136
144 // Indicates whether the WebGL context's deletion function for this 137 // Indicates whether the WebGL context's deletion function for this
145 // object (deleteBuffer, deleteTexture, etc.) has been called. 138 // object (deleteBuffer, deleteTexture, etc.) has been called.
146 bool m_deleted; 139 bool m_deleted;
147 140
148 // Indicates whether the destructor has been entered and we therefore 141 // Indicates whether the destructor has been entered and we therefore
149 // need to be careful in subclasses to not touch other on-heap objects. 142 // need to be careful in subclasses to not touch other on-heap objects.
150 bool m_destructionInProgress; 143 bool m_destructionInProgress;
151 }; 144 };
152 145
153 } // namespace blink 146 } // namespace blink
154 147
155 #endif // WebGLObject_h 148 #endif // WebGLObject_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/modules/webgl/WebGLFramebuffer.cpp ('k') | third_party/WebKit/Source/modules/webgl/WebGLProgram.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698