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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 return result; | 61 return result; |
62 } | 62 } |
63 | 63 |
64 class WebGLObject : public GarbageCollectedFinalized<WebGLObject>, public Script
Wrappable { | 64 class WebGLObject : public GarbageCollectedFinalized<WebGLObject>, public Script
Wrappable { |
65 public: | 65 public: |
66 virtual ~WebGLObject(); | 66 virtual ~WebGLObject(); |
67 | 67 |
68 // deleteObject may not always delete the OpenGL resource. For programs and | 68 // deleteObject may not always delete the OpenGL resource. For programs and |
69 // shaders, deletion is delayed until they are no longer attached. | 69 // shaders, deletion is delayed until they are no longer attached. |
70 // FIXME: revisit this when resource sharing between contexts are implemente
d. | 70 // FIXME: revisit this when resource sharing between contexts are implemente
d. |
71 void deleteObject(WebGraphicsContext3D*, gpu::gles2::GLES2Interface*); | 71 void deleteObject(gpu::gles2::GLES2Interface*); |
72 | 72 |
73 void onAttached() { ++m_attachmentCount; } | 73 void onAttached() { ++m_attachmentCount; } |
74 void onDetached(WebGraphicsContext3D*, gpu::gles2::GLES2Interface*); | 74 void onDetached(gpu::gles2::GLES2Interface*); |
75 | 75 |
76 // This indicates whether the client side issue a delete call already, not | 76 // This indicates whether the client side issue a delete call already, not |
77 // whether the OpenGL resource is deleted. | 77 // whether the OpenGL resource is deleted. |
78 // object()==0 indicates the OpenGL resource is deleted. | 78 // object()==0 indicates the OpenGL resource is deleted. |
79 bool isDeleted() { return m_deleted; } | 79 bool isDeleted() { return m_deleted; } |
80 | 80 |
81 // True if this object belongs to the group or context. | 81 // True if this object belongs to the group or context. |
82 virtual bool validate(const WebGLContextGroup*, const WebGLRenderingContextB
ase*) const = 0; | 82 virtual bool validate(const WebGLContextGroup*, const WebGLRenderingContextB
ase*) const = 0; |
83 virtual bool hasObject() const = 0; | 83 virtual bool hasObject() const = 0; |
84 | 84 |
85 DEFINE_INLINE_VIRTUAL_TRACE() { } | 85 DEFINE_INLINE_VIRTUAL_TRACE() { } |
86 | 86 |
87 protected: | 87 protected: |
88 explicit WebGLObject(WebGLRenderingContextBase*); | 88 explicit WebGLObject(WebGLRenderingContextBase*); |
89 | 89 |
90 // deleteObjectImpl should be only called once to delete the OpenGL resource
. | 90 // deleteObjectImpl should be only called once to delete the OpenGL resource
. |
91 // After calling deleteObjectImpl, hasObject() should return false. | 91 // After calling deleteObjectImpl, hasObject() should return false. |
92 virtual void deleteObjectImpl(blink::WebGraphicsContext3D*, gpu::gles2::GLES
2Interface*) = 0; | 92 virtual void deleteObjectImpl(gpu::gles2::GLES2Interface*) = 0; |
93 | 93 |
94 virtual bool hasGroupOrContext() const = 0; | 94 virtual bool hasGroupOrContext() const = 0; |
95 | 95 |
96 void detach(); | 96 void detach(); |
97 void detachAndDeleteObject(); | 97 void detachAndDeleteObject(); |
98 | 98 |
99 virtual WebGraphicsContext3D* getAWebGraphicsContext3D() const = 0; | 99 virtual gpu::gles2::GLES2Interface* getAGLInterface() const = 0; |
100 | 100 |
101 private: | 101 private: |
102 unsigned m_attachmentCount; | 102 unsigned m_attachmentCount; |
103 bool m_deleted; | 103 bool m_deleted; |
104 }; | 104 }; |
105 | 105 |
106 } // namespace blink | 106 } // namespace blink |
107 | 107 |
108 #endif // WebGLObject_h | 108 #endif // WebGLObject_h |
OLD | NEW |