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 22 matching lines...) Expand all Loading... |
33 | 33 |
34 PassRefPtrWillBeRawPtr<WebGLBuffer> WebGLBuffer::create(WebGLRenderingContextBas
e* ctx) | 34 PassRefPtrWillBeRawPtr<WebGLBuffer> WebGLBuffer::create(WebGLRenderingContextBas
e* ctx) |
35 { | 35 { |
36 return adoptRefWillBeNoop(new WebGLBuffer(ctx)); | 36 return adoptRefWillBeNoop(new WebGLBuffer(ctx)); |
37 } | 37 } |
38 | 38 |
39 WebGLBuffer::WebGLBuffer(WebGLRenderingContextBase* ctx) | 39 WebGLBuffer::WebGLBuffer(WebGLRenderingContextBase* ctx) |
40 : WebGLSharedObject(ctx) | 40 : WebGLSharedObject(ctx) |
41 , m_target(0) | 41 , m_target(0) |
42 { | 42 { |
43 ScriptWrappable::init(this); | |
44 setObject(ctx->webContext()->createBuffer()); | 43 setObject(ctx->webContext()->createBuffer()); |
45 } | 44 } |
46 | 45 |
47 WebGLBuffer::~WebGLBuffer() | 46 WebGLBuffer::~WebGLBuffer() |
48 { | 47 { |
49 // Delete the buffer's platform object. This object will have been | 48 // Delete the buffer's platform object. This object will have been |
50 // detached from the WebGLContextGroup if the group object was | 49 // detached from the WebGLContextGroup if the group object was |
51 // finalized first. With Oilpan not enabled, it always will be, | 50 // finalized first. With Oilpan not enabled, it always will be, |
52 // but with Oilpan enabled, the WebGLBuffer might end up being | 51 // but with Oilpan enabled, the WebGLBuffer might end up being |
53 // finalized first. In which case detachment is needed to ensure | 52 // finalized first. In which case detachment is needed to ensure |
(...skipping 12 matching lines...) Expand all Loading... |
66 void WebGLBuffer::setTarget(GLenum target) | 65 void WebGLBuffer::setTarget(GLenum target) |
67 { | 66 { |
68 // In WebGL, a buffer is bound to one target in its lifetime | 67 // In WebGL, a buffer is bound to one target in its lifetime |
69 if (m_target) | 68 if (m_target) |
70 return; | 69 return; |
71 if (target == GL_ARRAY_BUFFER || target == GL_ELEMENT_ARRAY_BUFFER) | 70 if (target == GL_ARRAY_BUFFER || target == GL_ELEMENT_ARRAY_BUFFER) |
72 m_target = target; | 71 m_target = target; |
73 } | 72 } |
74 | 73 |
75 } | 74 } |
OLD | NEW |