| 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 return object ? object->object() : 0; | 46 return object ? object->object() : 0; |
| 47 } | 47 } |
| 48 | 48 |
| 49 class WebGLObject : public RefCountedWillBeGarbageCollectedFinalized<WebGLObject
>, public ScriptWrappable { | 49 class WebGLObject : public RefCountedWillBeGarbageCollectedFinalized<WebGLObject
>, public ScriptWrappable { |
| 50 public: | 50 public: |
| 51 virtual ~WebGLObject(); | 51 virtual ~WebGLObject(); |
| 52 | 52 |
| 53 // deleteObject may not always delete the OpenGL resource. For programs and | 53 // deleteObject may not always delete the OpenGL resource. For programs and |
| 54 // shaders, deletion is delayed until they are no longer attached. | 54 // shaders, deletion is delayed until they are no longer attached. |
| 55 // FIXME: revisit this when resource sharing between contexts are implemente
d. | 55 // FIXME: revisit this when resource sharing between contexts are implemente
d. |
| 56 void deleteObject(blink::WebGraphicsContext3D*); | 56 void deleteObject(WebGraphicsContext3D*); |
| 57 | 57 |
| 58 void onAttached() { ++m_attachmentCount; } | 58 void onAttached() { ++m_attachmentCount; } |
| 59 void onDetached(blink::WebGraphicsContext3D*); | 59 void onDetached(WebGraphicsContext3D*); |
| 60 | 60 |
| 61 // This indicates whether the client side issue a delete call already, not | 61 // This indicates whether the client side issue a delete call already, not |
| 62 // whether the OpenGL resource is deleted. | 62 // whether the OpenGL resource is deleted. |
| 63 // object()==0 indicates the OpenGL resource is deleted. | 63 // object()==0 indicates the OpenGL resource is deleted. |
| 64 bool isDeleted() { return m_deleted; } | 64 bool isDeleted() { return m_deleted; } |
| 65 | 65 |
| 66 // True if this object belongs to the group or context. | 66 // True if this object belongs to the group or context. |
| 67 virtual bool validate(const WebGLContextGroup*, const WebGLRenderingContextB
ase*) const = 0; | 67 virtual bool validate(const WebGLContextGroup*, const WebGLRenderingContextB
ase*) const = 0; |
| 68 virtual bool hasObject() const = 0; | 68 virtual bool hasObject() const = 0; |
| 69 | 69 |
| 70 DEFINE_INLINE_VIRTUAL_TRACE() { } | 70 DEFINE_INLINE_VIRTUAL_TRACE() { } |
| 71 | 71 |
| 72 protected: | 72 protected: |
| 73 explicit WebGLObject(WebGLRenderingContextBase*); | 73 explicit WebGLObject(WebGLRenderingContextBase*); |
| 74 | 74 |
| 75 // deleteObjectImpl should be only called once to delete the OpenGL resource
. | 75 // deleteObjectImpl should be only called once to delete the OpenGL resource
. |
| 76 // After calling deleteObjectImpl, hasObject() should return false. | 76 // After calling deleteObjectImpl, hasObject() should return false. |
| 77 virtual void deleteObjectImpl(blink::WebGraphicsContext3D*) = 0; | 77 virtual void deleteObjectImpl(blink::WebGraphicsContext3D*) = 0; |
| 78 | 78 |
| 79 virtual bool hasGroupOrContext() const = 0; | 79 virtual bool hasGroupOrContext() const = 0; |
| 80 | 80 |
| 81 void detach(); | 81 void detach(); |
| 82 void detachAndDeleteObject(); | 82 void detachAndDeleteObject(); |
| 83 | 83 |
| 84 virtual blink::WebGraphicsContext3D* getAWebGraphicsContext3D() const = 0; | 84 virtual WebGraphicsContext3D* getAWebGraphicsContext3D() const = 0; |
| 85 | 85 |
| 86 private: | 86 private: |
| 87 unsigned m_attachmentCount; | 87 unsigned m_attachmentCount; |
| 88 bool m_deleted; | 88 bool m_deleted; |
| 89 }; | 89 }; |
| 90 | 90 |
| 91 } // namespace blink | 91 } // namespace blink |
| 92 | 92 |
| 93 #endif // WebGLObject_h | 93 #endif // WebGLObject_h |
| OLD | NEW |