| OLD | NEW |
| 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 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 339 } | 339 } |
| 340 | 340 |
| 341 const int programArgumentIndex = 0; | 341 const int programArgumentIndex = 0; |
| 342 WebGLRenderingContext* context = V8WebGLRenderingContext::toNative(info.Hold
er()); | 342 WebGLRenderingContext* context = V8WebGLRenderingContext::toNative(info.Hold
er()); |
| 343 if (info.Length() > 0 && !isUndefinedOrNull(info[programArgumentIndex]) && !
V8WebGLProgram::hasInstance(info[programArgumentIndex], info.GetIsolate())) { | 343 if (info.Length() > 0 && !isUndefinedOrNull(info[programArgumentIndex]) && !
V8WebGLProgram::hasInstance(info[programArgumentIndex], info.GetIsolate())) { |
| 344 exceptionState.throwTypeError(ExceptionMessages::argumentNullOrIncorrect
Type(programArgumentIndex + 1, "WebGLProgram")); | 344 exceptionState.throwTypeError(ExceptionMessages::argumentNullOrIncorrect
Type(programArgumentIndex + 1, "WebGLProgram")); |
| 345 exceptionState.throwIfNeeded(); | 345 exceptionState.throwIfNeeded(); |
| 346 return; | 346 return; |
| 347 } | 347 } |
| 348 WebGLProgram* program = V8WebGLProgram::toNativeWithTypeCheck(info.GetIsolat
e(), info[programArgumentIndex]); | 348 WebGLProgram* program = V8WebGLProgram::toNativeWithTypeCheck(info.GetIsolat
e(), info[programArgumentIndex]); |
| 349 Vector<RefPtr<WebGLShader> > shaders; | 349 WillBeHeapVector<RefPtrWillBeMember<WebGLShader> > shaders; |
| 350 bool succeed = context->getAttachedShaders(program, shaders); | 350 bool succeed = context->getAttachedShaders(program, shaders); |
| 351 if (!succeed) { | 351 if (!succeed) { |
| 352 v8SetReturnValueNull(info); | 352 v8SetReturnValueNull(info); |
| 353 return; | 353 return; |
| 354 } | 354 } |
| 355 v8::Local<v8::Array> array = v8::Array::New(info.GetIsolate(), shaders.size(
)); | 355 v8::Local<v8::Array> array = v8::Array::New(info.GetIsolate(), shaders.size(
)); |
| 356 for (size_t ii = 0; ii < shaders.size(); ++ii) | 356 for (size_t ii = 0; ii < shaders.size(); ++ii) |
| 357 array->Set(v8::Integer::New(info.GetIsolate(), ii), toV8(shaders[ii].get
(), info.Holder(), info.GetIsolate())); | 357 array->Set(v8::Integer::New(info.GetIsolate(), ii), toV8(shaders[ii].get
(), info.Holder(), info.GetIsolate())); |
| 358 v8SetReturnValue(info, array); | 358 v8SetReturnValue(info, array); |
| 359 } | 359 } |
| 360 | 360 |
| 361 void V8WebGLRenderingContext::getBufferParameterMethodCustom(const v8::FunctionC
allbackInfo<v8::Value>& info) | 361 void V8WebGLRenderingContext::getBufferParameterMethodCustom(const v8::FunctionC
allbackInfo<v8::Value>& info) |
| 362 { | 362 { |
| 363 ExceptionState exceptionState(ExceptionState::ExecutionContext, "getBufferPa
rameter", "WebGLRenderingContext", info.Holder(), info.GetIsolate()); | 363 ExceptionState exceptionState(ExceptionState::ExecutionContext, "getBufferPa
rameter", "WebGLRenderingContext", info.Holder(), info.GetIsolate()); |
| 364 getObjectParameter(info, kBuffer, exceptionState); | 364 getObjectParameter(info, kBuffer, exceptionState); |
| 365 } | 365 } |
| 366 | 366 |
| 367 void V8WebGLRenderingContext::getExtensionMethodCustom(const v8::FunctionCallbac
kInfo<v8::Value>& info) | 367 void V8WebGLRenderingContext::getExtensionMethodCustom(const v8::FunctionCallbac
kInfo<v8::Value>& info) |
| 368 { | 368 { |
| 369 ExceptionState exceptionState(ExceptionState::ExecutionContext, "getExtensio
n", "WebGLRenderingContext", info.Holder(), info.GetIsolate()); | 369 ExceptionState exceptionState(ExceptionState::ExecutionContext, "getExtensio
n", "WebGLRenderingContext", info.Holder(), info.GetIsolate()); |
| 370 WebGLRenderingContext* impl = V8WebGLRenderingContext::toNative(info.Holder(
)); | 370 WebGLRenderingContext* impl = V8WebGLRenderingContext::toNative(info.Holder(
)); |
| 371 if (info.Length() < 1) { | 371 if (info.Length() < 1) { |
| 372 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(1, i
nfo.Length())); | 372 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(1, i
nfo.Length())); |
| 373 exceptionState.throwIfNeeded(); | 373 exceptionState.throwIfNeeded(); |
| 374 return; | 374 return; |
| 375 } | 375 } |
| 376 TOSTRING_VOID(V8StringResource<>, name, info[0]); | 376 TOSTRING_VOID(V8StringResource<>, name, info[0]); |
| 377 RefPtr<WebGLExtension> extension(impl->getExtension(name)); | 377 RefPtrWillBeRawPtr<WebGLExtension> extension(impl->getExtension(name)); |
| 378 v8SetReturnValue(info, toV8Object(extension.get(), info.Holder(), info.GetIs
olate())); | 378 v8SetReturnValue(info, toV8Object(extension.get(), info.Holder(), info.GetIs
olate())); |
| 379 } | 379 } |
| 380 | 380 |
| 381 void V8WebGLRenderingContext::getFramebufferAttachmentParameterMethodCustom(cons
t v8::FunctionCallbackInfo<v8::Value>& info) | 381 void V8WebGLRenderingContext::getFramebufferAttachmentParameterMethodCustom(cons
t v8::FunctionCallbackInfo<v8::Value>& info) |
| 382 { | 382 { |
| 383 ExceptionState exceptionState(ExceptionState::ExecutionContext, "getFramebuf
ferAttachmentParameter", "WebGLRenderingContext", info.Holder(), info.GetIsolate
()); | 383 ExceptionState exceptionState(ExceptionState::ExecutionContext, "getFramebuf
ferAttachmentParameter", "WebGLRenderingContext", info.Holder(), info.GetIsolate
()); |
| 384 if (info.Length() != 3) { | 384 if (info.Length() != 3) { |
| 385 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(3, i
nfo.Length())); | 385 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(3, i
nfo.Length())); |
| 386 exceptionState.throwIfNeeded(); | 386 exceptionState.throwIfNeeded(); |
| 387 return; | 387 return; |
| (...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 857 vertexAttribAndUniformHelperf(info, kVertexAttrib3v, exceptionState); | 857 vertexAttribAndUniformHelperf(info, kVertexAttrib3v, exceptionState); |
| 858 } | 858 } |
| 859 | 859 |
| 860 void V8WebGLRenderingContext::vertexAttrib4fvMethodCustom(const v8::FunctionCall
backInfo<v8::Value>& info) | 860 void V8WebGLRenderingContext::vertexAttrib4fvMethodCustom(const v8::FunctionCall
backInfo<v8::Value>& info) |
| 861 { | 861 { |
| 862 ExceptionState exceptionState(ExceptionState::ExecutionContext, "vertexAttri
b4fv", "WebGLRenderingContext", info.Holder(), info.GetIsolate()); | 862 ExceptionState exceptionState(ExceptionState::ExecutionContext, "vertexAttri
b4fv", "WebGLRenderingContext", info.Holder(), info.GetIsolate()); |
| 863 vertexAttribAndUniformHelperf(info, kVertexAttrib4v, exceptionState); | 863 vertexAttribAndUniformHelperf(info, kVertexAttrib4v, exceptionState); |
| 864 } | 864 } |
| 865 | 865 |
| 866 } // namespace WebCore | 866 } // namespace WebCore |
| OLD | NEW |