Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(52)

Side by Side Diff: Source/core/html/canvas/WebGLBuffer.cpp

Issue 15481002: Make WebGL objects scriptwrappable so that binding integrity checks may be applied to them. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix WebGLProgram really really. Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 25 matching lines...) Expand all
36 36
37 PassRefPtr<WebGLBuffer> WebGLBuffer::create(WebGLRenderingContext* ctx) 37 PassRefPtr<WebGLBuffer> WebGLBuffer::create(WebGLRenderingContext* ctx)
38 { 38 {
39 return adoptRef(new WebGLBuffer(ctx)); 39 return adoptRef(new WebGLBuffer(ctx));
40 } 40 }
41 41
42 WebGLBuffer::WebGLBuffer(WebGLRenderingContext* ctx) 42 WebGLBuffer::WebGLBuffer(WebGLRenderingContext* ctx)
43 : WebGLSharedObject(ctx) 43 : WebGLSharedObject(ctx)
44 , m_target(0) 44 , m_target(0)
45 { 45 {
46 ScriptWrappable::init(this);
46 setObject(ctx->graphicsContext3D()->createBuffer()); 47 setObject(ctx->graphicsContext3D()->createBuffer());
47 } 48 }
48 49
49 WebGLBuffer::~WebGLBuffer() 50 WebGLBuffer::~WebGLBuffer()
50 { 51 {
51 deleteObject(0); 52 deleteObject(0);
52 } 53 }
53 54
54 void WebGLBuffer::deleteObjectImpl(GraphicsContext3D* context3d, Platform3DObjec t object) 55 void WebGLBuffer::deleteObjectImpl(GraphicsContext3D* context3d, Platform3DObjec t object)
55 { 56 {
56 context3d->deleteBuffer(object); 57 context3d->deleteBuffer(object);
57 } 58 }
58 59
59 void WebGLBuffer::setTarget(GC3Denum target) 60 void WebGLBuffer::setTarget(GC3Denum target)
60 { 61 {
61 // In WebGL, a buffer is bound to one target in its lifetime 62 // In WebGL, a buffer is bound to one target in its lifetime
62 if (m_target) 63 if (m_target)
63 return; 64 return;
64 if (target == GraphicsContext3D::ARRAY_BUFFER || target == GraphicsContext3D ::ELEMENT_ARRAY_BUFFER) 65 if (target == GraphicsContext3D::ARRAY_BUFFER || target == GraphicsContext3D ::ELEMENT_ARRAY_BUFFER)
65 m_target = target; 66 m_target = target;
66 } 67 }
67 68
68 } 69 }
OLDNEW
« no previous file with comments | « Source/core/html/canvas/WebGLBuffer.h ('k') | Source/core/html/canvas/WebGLCompressedTextureATC.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698