| OLD | NEW |
| 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 11 matching lines...) Expand all Loading... |
| 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 24 */ | 24 */ |
| 25 | 25 |
| 26 #ifndef WebGLObject_h | 26 #ifndef WebGLObject_h |
| 27 #define WebGLObject_h | 27 #define WebGLObject_h |
| 28 | 28 |
| 29 #include "bindings/core/v8/ScriptWrappable.h" | 29 #include "bindings/core/v8/ScriptWrappable.h" |
| 30 #include "platform/graphics/GraphicsTypes3D.h" | 30 #include "platform/graphics/GraphicsTypes3D.h" |
| 31 #include "platform/heap/Handle.h" | 31 #include "platform/heap/Handle.h" |
| 32 #include "wtf/Assertions.h" |
| 32 #include "wtf/RefCounted.h" | 33 #include "wtf/RefCounted.h" |
| 33 | 34 |
| 34 namespace blink { | 35 namespace blink { |
| 35 class WebGraphicsContext3D; | 36 class WebGraphicsContext3D; |
| 36 } | 37 } |
| 37 | 38 |
| 38 namespace gpu { | 39 namespace gpu { |
| 39 namespace gles2 { | 40 namespace gles2 { |
| 40 class GLES2Interface; | 41 class GLES2Interface; |
| 41 } | 42 } |
| 42 } | 43 } |
| 43 | 44 |
| 44 namespace blink { | 45 namespace blink { |
| 45 | 46 |
| 46 class WebGLContextGroup; | 47 class WebGLContextGroup; |
| 47 class WebGLRenderingContextBase; | 48 class WebGLRenderingContextBase; |
| 48 | 49 |
| 49 template <typename T> | 50 template <typename T> |
| 50 Platform3DObject objectOrZero(const T* object) | 51 GLuint objectOrZero(const T* object) |
| 51 { | 52 { |
| 52 return object ? object->object() : 0; | 53 return object ? object->object() : 0; |
| 53 } | 54 } |
| 54 | 55 |
| 56 template <typename T> |
| 57 GLuint objectNonZero(const T* object) |
| 58 { |
| 59 GLuint result = object->object(); |
| 60 DCHECK(result); |
| 61 return result; |
| 62 } |
| 63 |
| 55 class WebGLObject : public GarbageCollectedFinalized<WebGLObject>, public Script
Wrappable { | 64 class WebGLObject : public GarbageCollectedFinalized<WebGLObject>, public Script
Wrappable { |
| 56 public: | 65 public: |
| 57 virtual ~WebGLObject(); | 66 virtual ~WebGLObject(); |
| 58 | 67 |
| 59 // deleteObject may not always delete the OpenGL resource. For programs and | 68 // deleteObject may not always delete the OpenGL resource. For programs and |
| 60 // shaders, deletion is delayed until they are no longer attached. | 69 // shaders, deletion is delayed until they are no longer attached. |
| 61 // FIXME: revisit this when resource sharing between contexts are implemente
d. | 70 // FIXME: revisit this when resource sharing between contexts are implemente
d. |
| 62 void deleteObject(WebGraphicsContext3D*, gpu::gles2::GLES2Interface*); | 71 void deleteObject(WebGraphicsContext3D*, gpu::gles2::GLES2Interface*); |
| 63 | 72 |
| 64 void onAttached() { ++m_attachmentCount; } | 73 void onAttached() { ++m_attachmentCount; } |
| (...skipping 25 matching lines...) Expand all Loading... |
| 90 virtual WebGraphicsContext3D* getAWebGraphicsContext3D() const = 0; | 99 virtual WebGraphicsContext3D* getAWebGraphicsContext3D() const = 0; |
| 91 | 100 |
| 92 private: | 101 private: |
| 93 unsigned m_attachmentCount; | 102 unsigned m_attachmentCount; |
| 94 bool m_deleted; | 103 bool m_deleted; |
| 95 }; | 104 }; |
| 96 | 105 |
| 97 } // namespace blink | 106 } // namespace blink |
| 98 | 107 |
| 99 #endif // WebGLObject_h | 108 #endif // WebGLObject_h |
| OLD | NEW |