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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 // finalized first. With Oilpan not enabled, it always will be, | 50 // finalized first. With Oilpan not enabled, it always will be, |
51 // but with Oilpan enabled, the WebGLBuffer might end up being | 51 // but with Oilpan enabled, the WebGLBuffer might end up being |
52 // finalized first. In which case detachment is needed to ensure | 52 // finalized first. In which case detachment is needed to ensure |
53 // that the platform object is indeed deleted. | 53 // that the platform object is indeed deleted. |
54 // | 54 // |
55 // To keep the code regular, the trivial detach()ment is always | 55 // To keep the code regular, the trivial detach()ment is always |
56 // performed. | 56 // performed. |
57 detachAndDeleteObject(); | 57 detachAndDeleteObject(); |
58 } | 58 } |
59 | 59 |
60 void WebGLBuffer::deleteObjectImpl(blink::WebGraphicsContext3D* context3d) | 60 void WebGLBuffer::deleteObjectImpl(WebGraphicsContext3D* context3d) |
61 { | 61 { |
62 context3d->deleteBuffer(m_object); | 62 context3d->deleteBuffer(m_object); |
63 m_object = 0; | 63 m_object = 0; |
64 } | 64 } |
65 | 65 |
66 void WebGLBuffer::setTarget(GLenum target) | 66 void WebGLBuffer::setTarget(GLenum target) |
67 { | 67 { |
68 // In WebGL, a buffer is bound to one target in its lifetime | 68 // In WebGL, a buffer is bound to one target in its lifetime |
69 if (m_target) | 69 if (m_target) |
70 return; | 70 return; |
71 if (target == GL_ARRAY_BUFFER || target == GL_ELEMENT_ARRAY_BUFFER) | 71 if (target == GL_ARRAY_BUFFER || target == GL_ELEMENT_ARRAY_BUFFER) |
72 m_target = target; | 72 m_target = target; |
73 } | 73 } |
74 | 74 |
75 } | 75 } // namespace blink |
OLD | NEW |