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

Side by Side Diff: Source/WebCore/bindings/v8/custom/V8WebGLRenderingContextCustom.cpp

Issue 8043033: Merge 95728 - Ref protect shaders in V8WebGLRenderingContext::getAttachedShadersCallback (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/835/
Patch Set: Created 9 years, 2 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 Google 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 are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 return notHandledByInterceptor(); 253 return notHandledByInterceptor();
254 } 254 }
255 255
256 ExceptionCode ec = 0; 256 ExceptionCode ec = 0;
257 WebGLRenderingContext* context = V8WebGLRenderingContext::toNative(args.Hold er()); 257 WebGLRenderingContext* context = V8WebGLRenderingContext::toNative(args.Hold er());
258 if (args.Length() > 0 && !isUndefinedOrNull(args[0]) && !V8WebGLProgram::Has Instance(args[0])) { 258 if (args.Length() > 0 && !isUndefinedOrNull(args[0]) && !V8WebGLProgram::Has Instance(args[0])) {
259 V8Proxy::throwTypeError(); 259 V8Proxy::throwTypeError();
260 return notHandledByInterceptor(); 260 return notHandledByInterceptor();
261 } 261 }
262 WebGLProgram* program = V8WebGLProgram::HasInstance(args[0]) ? V8WebGLProgra m::toNative(v8::Handle<v8::Object>::Cast(args[0])) : 0; 262 WebGLProgram* program = V8WebGLProgram::HasInstance(args[0]) ? V8WebGLProgra m::toNative(v8::Handle<v8::Object>::Cast(args[0])) : 0;
263 Vector<WebGLShader*> shaders; 263 Vector<RefPtr<WebGLShader> > shaders;
264 bool succeed = context->getAttachedShaders(program, shaders, ec); 264 bool succeed = context->getAttachedShaders(program, shaders, ec);
265 if (ec) { 265 if (ec) {
266 V8Proxy::setDOMException(ec); 266 V8Proxy::setDOMException(ec);
267 return v8::Null(); 267 return v8::Null();
268 } 268 }
269 if (!succeed) 269 if (!succeed)
270 return v8::Null(); 270 return v8::Null();
271 v8::Local<v8::Array> array = v8::Array::New(shaders.size()); 271 v8::Local<v8::Array> array = v8::Array::New(shaders.size());
272 for (size_t ii = 0; ii < shaders.size(); ++ii) 272 for (size_t ii = 0; ii < shaders.size(); ++ii)
273 array->Set(v8::Integer::New(ii), toV8(shaders[ii])); 273 array->Set(v8::Integer::New(ii), toV8(shaders[ii].get()));
274 return array; 274 return array;
275 } 275 }
276 276
277 v8::Handle<v8::Value> V8WebGLRenderingContext::getBufferParameterCallback(const v8::Arguments& args) 277 v8::Handle<v8::Value> V8WebGLRenderingContext::getBufferParameterCallback(const v8::Arguments& args)
278 { 278 {
279 INC_STATS("DOM.WebGLRenderingContext.getBufferParameter()"); 279 INC_STATS("DOM.WebGLRenderingContext.getBufferParameter()");
280 return getObjectParameter(args, kBuffer); 280 return getObjectParameter(args, kBuffer);
281 } 281 }
282 282
283 v8::Handle<v8::Value> V8WebGLRenderingContext::getExtensionCallback(const v8::Ar guments& args) 283 v8::Handle<v8::Value> V8WebGLRenderingContext::getExtensionCallback(const v8::Ar guments& args)
(...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after
782 782
783 v8::Handle<v8::Value> V8WebGLRenderingContext::vertexAttrib4fvCallback(const v8: :Arguments& args) 783 v8::Handle<v8::Value> V8WebGLRenderingContext::vertexAttrib4fvCallback(const v8: :Arguments& args)
784 { 784 {
785 INC_STATS("DOM.WebGLRenderingContext.vertexAttrib4fv()"); 785 INC_STATS("DOM.WebGLRenderingContext.vertexAttrib4fv()");
786 return vertexAttribAndUniformHelperf(args, kVertexAttrib4v); 786 return vertexAttribAndUniformHelperf(args, kVertexAttrib4v);
787 } 787 }
788 788
789 } // namespace WebCore 789 } // namespace WebCore
790 790
791 #endif // ENABLE(WEBGL) 791 #endif // ENABLE(WEBGL)
OLDNEW
« no previous file with comments | « Source/WebCore/bindings/js/JSWebGLRenderingContextCustom.cpp ('k') | Source/WebCore/html/canvas/WebGLRenderingContext.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698