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

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

Issue 125043004: Remove world type from hasInstance() (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 11 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 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 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 break; 297 break;
298 default: 298 default:
299 notImplemented(); 299 notImplemented();
300 break; 300 break;
301 } 301 }
302 v8SetReturnValue(info, toV8Object(args, info.Holder(), info.GetIsolate())); 302 v8SetReturnValue(info, toV8Object(args, info.Holder(), info.GetIsolate()));
303 } 303 }
304 304
305 static WebGLUniformLocation* toWebGLUniformLocation(v8::Handle<v8::Value> value, v8::Isolate* isolate) 305 static WebGLUniformLocation* toWebGLUniformLocation(v8::Handle<v8::Value> value, v8::Isolate* isolate)
306 { 306 {
307 if (!V8WebGLUniformLocation::hasInstance(value, isolate, worldType(isolate)) ) 307 if (!V8WebGLUniformLocation::hasInstance(value, isolate))
308 return 0; 308 return 0;
309 return V8WebGLUniformLocation::toNative(value->ToObject()); 309 return V8WebGLUniformLocation::toNative(value->ToObject());
310 } 310 }
311 311
312 enum WhichProgramCall { 312 enum WhichProgramCall {
313 kProgramParameter, kUniform 313 kProgramParameter, kUniform
314 }; 314 };
315 315
316 void V8WebGLRenderingContext::getAttachedShadersMethodCustom(const v8::FunctionC allbackInfo<v8::Value>& info) 316 void V8WebGLRenderingContext::getAttachedShadersMethodCustom(const v8::FunctionC allbackInfo<v8::Value>& info)
317 { 317 {
318 ExceptionState exceptionState(ExceptionState::ExecutionContext, "getAttached Shaders", "WebGLRenderingContext", info.Holder(), info.GetIsolate()); 318 ExceptionState exceptionState(ExceptionState::ExecutionContext, "getAttached Shaders", "WebGLRenderingContext", info.Holder(), info.GetIsolate());
319 if (info.Length() < 1) { 319 if (info.Length() < 1) {
320 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(1, i nfo.Length())); 320 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(1, i nfo.Length()));
321 exceptionState.throwIfNeeded(); 321 exceptionState.throwIfNeeded();
322 return; 322 return;
323 } 323 }
324 324
325 const int programArgumentIndex = 0; 325 const int programArgumentIndex = 0;
326 WebGLRenderingContext* context = V8WebGLRenderingContext::toNative(info.Hold er()); 326 WebGLRenderingContext* context = V8WebGLRenderingContext::toNative(info.Hold er());
327 if (info.Length() > 0 && !isUndefinedOrNull(info[programArgumentIndex]) && ! V8WebGLProgram::hasInstance(info[programArgumentIndex], info.GetIsolate(), world Type(info.GetIsolate()))) { 327 if (info.Length() > 0 && !isUndefinedOrNull(info[programArgumentIndex]) && ! V8WebGLProgram::hasInstance(info[programArgumentIndex], info.GetIsolate())) {
328 exceptionState.throwTypeError(ExceptionMessages::incorrectArgumentType(p rogramArgumentIndex + 1, "is not a WebGLProgram object.")); 328 exceptionState.throwTypeError(ExceptionMessages::incorrectArgumentType(p rogramArgumentIndex + 1, "is not a WebGLProgram object."));
329 exceptionState.throwIfNeeded(); 329 exceptionState.throwIfNeeded();
330 return; 330 return;
331 } 331 }
332 WebGLProgram* program = V8WebGLProgram::hasInstance(info[0], info.GetIsolate (), worldType(info.GetIsolate())) ? V8WebGLProgram::toNative(v8::Handle<v8::Obje ct>::Cast(info[0])) : 0; 332 WebGLProgram* program = V8WebGLProgram::hasInstance(info[0], info.GetIsolate ()) ? V8WebGLProgram::toNative(v8::Handle<v8::Object>::Cast(info[0])) : 0;
333 Vector<RefPtr<WebGLShader> > shaders; 333 Vector<RefPtr<WebGLShader> > shaders;
334 bool succeed = context->getAttachedShaders(program, shaders); 334 bool succeed = context->getAttachedShaders(program, shaders);
335 if (!succeed) { 335 if (!succeed) {
336 v8SetReturnValueNull(info); 336 v8SetReturnValueNull(info);
337 return; 337 return;
338 } 338 }
339 v8::Local<v8::Array> array = v8::Array::New(info.GetIsolate(), shaders.size( )); 339 v8::Local<v8::Array> array = v8::Array::New(info.GetIsolate(), shaders.size( ));
340 for (size_t ii = 0; ii < shaders.size(); ++ii) 340 for (size_t ii = 0; ii < shaders.size(); ++ii)
341 array->Set(v8::Integer::New(info.GetIsolate(), ii), toV8(shaders[ii].get (), info.Holder(), info.GetIsolate())); 341 array->Set(v8::Integer::New(info.GetIsolate(), ii), toV8(shaders[ii].get (), info.Holder(), info.GetIsolate()));
342 v8SetReturnValue(info, array); 342 v8SetReturnValue(info, array);
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
404 { 404 {
405 ExceptionState exceptionState(ExceptionState::ExecutionContext, "getProgramP arameter", "WebGLRenderingContext", info.Holder(), info.GetIsolate()); 405 ExceptionState exceptionState(ExceptionState::ExecutionContext, "getProgramP arameter", "WebGLRenderingContext", info.Holder(), info.GetIsolate());
406 if (info.Length() != 2) { 406 if (info.Length() != 2) {
407 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(2, i nfo.Length())); 407 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(2, i nfo.Length()));
408 exceptionState.throwIfNeeded(); 408 exceptionState.throwIfNeeded();
409 return; 409 return;
410 } 410 }
411 411
412 const int programArgumentIndex = 0; 412 const int programArgumentIndex = 0;
413 WebGLRenderingContext* context = V8WebGLRenderingContext::toNative(info.Hold er()); 413 WebGLRenderingContext* context = V8WebGLRenderingContext::toNative(info.Hold er());
414 if (info.Length() > 0 && !isUndefinedOrNull(info[programArgumentIndex]) && ! V8WebGLProgram::hasInstance(info[programArgumentIndex], info.GetIsolate(), world Type(info.GetIsolate()))) { 414 if (info.Length() > 0 && !isUndefinedOrNull(info[programArgumentIndex]) && ! V8WebGLProgram::hasInstance(info[programArgumentIndex], info.GetIsolate())) {
415 exceptionState.throwTypeError(ExceptionMessages::incorrectArgumentType(p rogramArgumentIndex + 1, "is not a WebGLProgram object.")); 415 exceptionState.throwTypeError(ExceptionMessages::incorrectArgumentType(p rogramArgumentIndex + 1, "is not a WebGLProgram object."));
416 exceptionState.throwIfNeeded(); 416 exceptionState.throwIfNeeded();
417 return; 417 return;
418 } 418 }
419 WebGLProgram* program = V8WebGLProgram::hasInstance(info[0], info.GetIsolate (), worldType(info.GetIsolate())) ? V8WebGLProgram::toNative(v8::Handle<v8::Obje ct>::Cast(info[0])) : 0; 419 WebGLProgram* program = V8WebGLProgram::hasInstance(info[0], info.GetIsolate ()) ? V8WebGLProgram::toNative(v8::Handle<v8::Object>::Cast(info[0])) : 0;
420 unsigned pname = toInt32(info[1], exceptionState); 420 unsigned pname = toInt32(info[1], exceptionState);
421 if (exceptionState.throwIfNeeded()) 421 if (exceptionState.throwIfNeeded())
422 return; 422 return;
423 WebGLGetInfo args = context->getProgramParameter(program, pname); 423 WebGLGetInfo args = context->getProgramParameter(program, pname);
424 v8SetReturnValue(info, toV8Object(args, info.Holder(), info.GetIsolate())); 424 v8SetReturnValue(info, toV8Object(args, info.Holder(), info.GetIsolate()));
425 } 425 }
426 426
427 void V8WebGLRenderingContext::getRenderbufferParameterMethodCustom(const v8::Fun ctionCallbackInfo<v8::Value>& info) 427 void V8WebGLRenderingContext::getRenderbufferParameterMethodCustom(const v8::Fun ctionCallbackInfo<v8::Value>& info)
428 { 428 {
429 ExceptionState exceptionState(ExceptionState::ExecutionContext, "getRenderbu fferParameter", "WebGLRenderingContext", info.Holder(), info.GetIsolate()); 429 ExceptionState exceptionState(ExceptionState::ExecutionContext, "getRenderbu fferParameter", "WebGLRenderingContext", info.Holder(), info.GetIsolate());
430 getObjectParameter(info, kRenderbuffer, exceptionState); 430 getObjectParameter(info, kRenderbuffer, exceptionState);
431 } 431 }
432 432
433 void V8WebGLRenderingContext::getShaderParameterMethodCustom(const v8::FunctionC allbackInfo<v8::Value>& info) 433 void V8WebGLRenderingContext::getShaderParameterMethodCustom(const v8::FunctionC allbackInfo<v8::Value>& info)
434 { 434 {
435 ExceptionState exceptionState(ExceptionState::ExecutionContext, "getShaderPa rameter", "WebGLRenderingContext", info.Holder(), info.GetIsolate()); 435 ExceptionState exceptionState(ExceptionState::ExecutionContext, "getShaderPa rameter", "WebGLRenderingContext", info.Holder(), info.GetIsolate());
436 if (info.Length() != 2) { 436 if (info.Length() != 2) {
437 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(2, i nfo.Length())); 437 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(2, i nfo.Length()));
438 exceptionState.throwIfNeeded(); 438 exceptionState.throwIfNeeded();
439 return; 439 return;
440 } 440 }
441 441
442 const int shaderArgumentIndex = 0; 442 const int shaderArgumentIndex = 0;
443 WebGLRenderingContext* context = V8WebGLRenderingContext::toNative(info.Hold er()); 443 WebGLRenderingContext* context = V8WebGLRenderingContext::toNative(info.Hold er());
444 if (info.Length() > 0 && !isUndefinedOrNull(info[shaderArgumentIndex]) && !V 8WebGLShader::hasInstance(info[shaderArgumentIndex], info.GetIsolate(), worldTyp e(info.GetIsolate()))) { 444 if (info.Length() > 0 && !isUndefinedOrNull(info[shaderArgumentIndex]) && !V 8WebGLShader::hasInstance(info[shaderArgumentIndex], info.GetIsolate())) {
445 exceptionState.throwTypeError(ExceptionMessages::incorrectArgumentType(s haderArgumentIndex + 1, "is not a WebGLShader object.")); 445 exceptionState.throwTypeError(ExceptionMessages::incorrectArgumentType(s haderArgumentIndex + 1, "is not a WebGLShader object."));
446 exceptionState.throwIfNeeded(); 446 exceptionState.throwIfNeeded();
447 return; 447 return;
448 } 448 }
449 WebGLShader* shader = V8WebGLShader::hasInstance(info[shaderArgumentIndex], info.GetIsolate(), worldType(info.GetIsolate())) ? V8WebGLShader::toNative(v8::H andle<v8::Object>::Cast(info[0])) : 0; 449 WebGLShader* shader = V8WebGLShader::hasInstance(info[shaderArgumentIndex], info.GetIsolate()) ? V8WebGLShader::toNative(v8::Handle<v8::Object>::Cast(info[0 ])) : 0;
450 unsigned pname = toInt32(info[1], exceptionState); 450 unsigned pname = toInt32(info[1], exceptionState);
451 if (exceptionState.throwIfNeeded()) 451 if (exceptionState.throwIfNeeded())
452 return; 452 return;
453 WebGLGetInfo args = context->getShaderParameter(shader, pname); 453 WebGLGetInfo args = context->getShaderParameter(shader, pname);
454 v8SetReturnValue(info, toV8Object(args, info.Holder(), info.GetIsolate())); 454 v8SetReturnValue(info, toV8Object(args, info.Holder(), info.GetIsolate()));
455 } 455 }
456 456
457 void V8WebGLRenderingContext::getSupportedExtensionsMethodCustom(const v8::Funct ionCallbackInfo<v8::Value>& info) 457 void V8WebGLRenderingContext::getSupportedExtensionsMethodCustom(const v8::Funct ionCallbackInfo<v8::Value>& info)
458 { 458 {
459 WebGLRenderingContext* imp = V8WebGLRenderingContext::toNative(info.Holder() ); 459 WebGLRenderingContext* imp = V8WebGLRenderingContext::toNative(info.Holder() );
(...skipping 19 matching lines...) Expand all
479 { 479 {
480 ExceptionState exceptionState(ExceptionState::ExecutionContext, "getUniform" , "WebGLRenderingContext", info.Holder(), info.GetIsolate()); 480 ExceptionState exceptionState(ExceptionState::ExecutionContext, "getUniform" , "WebGLRenderingContext", info.Holder(), info.GetIsolate());
481 if (info.Length() != 2) { 481 if (info.Length() != 2) {
482 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(2, i nfo.Length())); 482 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(2, i nfo.Length()));
483 exceptionState.throwIfNeeded(); 483 exceptionState.throwIfNeeded();
484 return; 484 return;
485 } 485 }
486 486
487 const int programArgumentIndex = 0; 487 const int programArgumentIndex = 0;
488 WebGLRenderingContext* context = V8WebGLRenderingContext::toNative(info.Hold er()); 488 WebGLRenderingContext* context = V8WebGLRenderingContext::toNative(info.Hold er());
489 if (info.Length() > 0 && !isUndefinedOrNull(info[programArgumentIndex]) && ! V8WebGLProgram::hasInstance(info[programArgumentIndex], info.GetIsolate(), world Type(info.GetIsolate()))) { 489 if (info.Length() > 0 && !isUndefinedOrNull(info[programArgumentIndex]) && ! V8WebGLProgram::hasInstance(info[programArgumentIndex], info.GetIsolate())) {
490 exceptionState.throwTypeError(ExceptionMessages::incorrectArgumentType(p rogramArgumentIndex + 1, "is not a WebGLProgram object.")); 490 exceptionState.throwTypeError(ExceptionMessages::incorrectArgumentType(p rogramArgumentIndex + 1, "is not a WebGLProgram object."));
491 exceptionState.throwIfNeeded(); 491 exceptionState.throwIfNeeded();
492 return; 492 return;
493 } 493 }
494 WebGLProgram* program = V8WebGLProgram::hasInstance(info[programArgumentInde x], info.GetIsolate(), worldType(info.GetIsolate())) ? V8WebGLProgram::toNative( v8::Handle<v8::Object>::Cast(info[0])) : 0; 494 WebGLProgram* program = V8WebGLProgram::hasInstance(info[programArgumentInde x], info.GetIsolate()) ? V8WebGLProgram::toNative(v8::Handle<v8::Object>::Cast(i nfo[0])) : 0;
495 495
496 const int uniformArgumentIndex = 1; 496 const int uniformArgumentIndex = 1;
497 if (info.Length() > 1 && !isUndefinedOrNull(info[uniformArgumentIndex]) && ! V8WebGLUniformLocation::hasInstance(info[uniformArgumentIndex], info.GetIsolate( ), worldType(info.GetIsolate()))) { 497 if (info.Length() > 1 && !isUndefinedOrNull(info[uniformArgumentIndex]) && ! V8WebGLUniformLocation::hasInstance(info[uniformArgumentIndex], info.GetIsolate( ))) {
498 exceptionState.throwTypeError(ExceptionMessages::incorrectArgumentType(u niformArgumentIndex + 1, "is not a WebGLUniformLocation object.")); 498 exceptionState.throwTypeError(ExceptionMessages::incorrectArgumentType(u niformArgumentIndex + 1, "is not a WebGLUniformLocation object."));
499 exceptionState.throwIfNeeded(); 499 exceptionState.throwIfNeeded();
500 return; 500 return;
501 } 501 }
502 const int uniformLocationArgumentIndex = 1; 502 const int uniformLocationArgumentIndex = 1;
503 WebGLUniformLocation* location = toWebGLUniformLocation(info[uniformLocation ArgumentIndex], info.GetIsolate()); 503 WebGLUniformLocation* location = toWebGLUniformLocation(info[uniformLocation ArgumentIndex], info.GetIsolate());
504 504
505 WebGLGetInfo args = context->getUniform(program, location); 505 WebGLGetInfo args = context->getUniform(program, location);
506 v8SetReturnValue(info, toV8Object(args, info.Holder(), info.GetIsolate())); 506 v8SetReturnValue(info, toV8Object(args, info.Holder(), info.GetIsolate()));
507 } 507 }
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
559 559
560 int index = -1; 560 int index = -1;
561 WebGLUniformLocation* location = 0; 561 WebGLUniformLocation* location = 0;
562 562
563 if (isFunctionToCallForAttribute(functionToCall)) { 563 if (isFunctionToCallForAttribute(functionToCall)) {
564 index = toInt32(info[0], exceptionState); 564 index = toInt32(info[0], exceptionState);
565 if (exceptionState.throwIfNeeded()) 565 if (exceptionState.throwIfNeeded())
566 return; 566 return;
567 } else { 567 } else {
568 const int uniformLocationArgumentIndex = 0; 568 const int uniformLocationArgumentIndex = 0;
569 if (info.Length() > 0 && !isUndefinedOrNull(info[uniformLocationArgument Index]) && !V8WebGLUniformLocation::hasInstance(info[uniformLocationArgumentInde x], info.GetIsolate(), worldType(info.GetIsolate()))) { 569 if (info.Length() > 0 && !isUndefinedOrNull(info[uniformLocationArgument Index]) && !V8WebGLUniformLocation::hasInstance(info[uniformLocationArgumentInde x], info.GetIsolate())) {
570 exceptionState.throwTypeError(ExceptionMessages::incorrectArgumentTy pe(uniformLocationArgumentIndex + 1, "is not a WebGLUniformLocation object.")); 570 exceptionState.throwTypeError(ExceptionMessages::incorrectArgumentTy pe(uniformLocationArgumentIndex + 1, "is not a WebGLUniformLocation object."));
571 exceptionState.throwIfNeeded(); 571 exceptionState.throwIfNeeded();
572 return; 572 return;
573 } 573 }
574 location = toWebGLUniformLocation(info[uniformLocationArgumentIndex], in fo.GetIsolate()); 574 location = toWebGLUniformLocation(info[uniformLocationArgumentIndex], in fo.GetIsolate());
575 } 575 }
576 576
577 WebGLRenderingContext* context = V8WebGLRenderingContext::toNative(info.Hold er()); 577 WebGLRenderingContext* context = V8WebGLRenderingContext::toNative(info.Hold er());
578 578
579 const int indexArrayArgument = 1; 579 const int indexArrayArgument = 1;
580 if (V8Float32Array::hasInstance(info[indexArrayArgument], info.GetIsolate(), worldType(info.GetIsolate()))) { 580 if (V8Float32Array::hasInstance(info[indexArrayArgument], info.GetIsolate()) ) {
581 Float32Array* array = V8Float32Array::toNative(info[indexArrayArgument]- >ToObject()); 581 Float32Array* array = V8Float32Array::toNative(info[indexArrayArgument]- >ToObject());
582 ASSERT(array != NULL); 582 ASSERT(array != NULL);
583 switch (functionToCall) { 583 switch (functionToCall) {
584 case kUniform1v: context->uniform1fv(location, array); break; 584 case kUniform1v: context->uniform1fv(location, array); break;
585 case kUniform2v: context->uniform2fv(location, array); break; 585 case kUniform2v: context->uniform2fv(location, array); break;
586 case kUniform3v: context->uniform3fv(location, array); break; 586 case kUniform3v: context->uniform3fv(location, array); break;
587 case kUniform4v: context->uniform4fv(location, array); break; 587 case kUniform4v: context->uniform4fv(location, array); break;
588 case kVertexAttrib1v: context->vertexAttrib1fv(index, array); break; 588 case kVertexAttrib1v: context->vertexAttrib1fv(index, array); break;
589 case kVertexAttrib2v: context->vertexAttrib2fv(index, array); break; 589 case kVertexAttrib2v: context->vertexAttrib2fv(index, array); break;
590 case kVertexAttrib3v: context->vertexAttrib3fv(index, array); break; 590 case kVertexAttrib3v: context->vertexAttrib3fv(index, array); break;
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
637 // * glUniform4iv(GLUniformLocation location, Int32Array data); 637 // * glUniform4iv(GLUniformLocation location, Int32Array data);
638 638
639 if (info.Length() != 2) { 639 if (info.Length() != 2) {
640 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(2, i nfo.Length())); 640 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(2, i nfo.Length()));
641 exceptionState.throwIfNeeded(); 641 exceptionState.throwIfNeeded();
642 return; 642 return;
643 } 643 }
644 644
645 const int uniformLocationArgumentIndex = 0; 645 const int uniformLocationArgumentIndex = 0;
646 WebGLRenderingContext* context = V8WebGLRenderingContext::toNative(info.Hold er()); 646 WebGLRenderingContext* context = V8WebGLRenderingContext::toNative(info.Hold er());
647 if (info.Length() > 0 && !isUndefinedOrNull(info[uniformLocationArgumentInde x]) && !V8WebGLUniformLocation::hasInstance(info[uniformLocationArgumentIndex], info.GetIsolate(), worldType(info.GetIsolate()))) { 647 if (info.Length() > 0 && !isUndefinedOrNull(info[uniformLocationArgumentInde x]) && !V8WebGLUniformLocation::hasInstance(info[uniformLocationArgumentIndex], info.GetIsolate())) {
648 exceptionState.throwTypeError(ExceptionMessages::incorrectArgumentType(u niformLocationArgumentIndex + 1, "is not a WebGLUniformLocation object.")); 648 exceptionState.throwTypeError(ExceptionMessages::incorrectArgumentType(u niformLocationArgumentIndex + 1, "is not a WebGLUniformLocation object."));
649 exceptionState.throwIfNeeded(); 649 exceptionState.throwIfNeeded();
650 return; 650 return;
651 } 651 }
652 WebGLUniformLocation* location = toWebGLUniformLocation(info[uniformLocation ArgumentIndex], info.GetIsolate()); 652 WebGLUniformLocation* location = toWebGLUniformLocation(info[uniformLocation ArgumentIndex], info.GetIsolate());
653 653
654 const int indexArrayArgumentIndex = 1; 654 const int indexArrayArgumentIndex = 1;
655 if (V8Int32Array::hasInstance(info[indexArrayArgumentIndex], info.GetIsolate (), worldType(info.GetIsolate()))) { 655 if (V8Int32Array::hasInstance(info[indexArrayArgumentIndex], info.GetIsolate ())) {
656 Int32Array* array = V8Int32Array::toNative(info[indexArrayArgumentIndex] ->ToObject()); 656 Int32Array* array = V8Int32Array::toNative(info[indexArrayArgumentIndex] ->ToObject());
657 ASSERT(array != NULL); 657 ASSERT(array != NULL);
658 switch (functionToCall) { 658 switch (functionToCall) {
659 case kUniform1v: context->uniform1iv(location, array); break; 659 case kUniform1v: context->uniform1iv(location, array); break;
660 case kUniform2v: context->uniform2iv(location, array); break; 660 case kUniform2v: context->uniform2iv(location, array); break;
661 case kUniform3v: context->uniform3iv(location, array); break; 661 case kUniform3v: context->uniform3iv(location, array); break;
662 case kUniform4v: context->uniform4iv(location, array); break; 662 case kUniform4v: context->uniform4iv(location, array); break;
663 default: ASSERT_NOT_REACHED(); break; 663 default: ASSERT_NOT_REACHED(); break;
664 } 664 }
665 return; 665 return;
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
752 // FIXME: need to change to accept Float32Array as well. 752 // FIXME: need to change to accept Float32Array as well.
753 if (info.Length() != 3) { 753 if (info.Length() != 3) {
754 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(3, i nfo.Length())); 754 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(3, i nfo.Length()));
755 exceptionState.throwIfNeeded(); 755 exceptionState.throwIfNeeded();
756 return; 756 return;
757 } 757 }
758 758
759 WebGLRenderingContext* context = V8WebGLRenderingContext::toNative(info.Hold er()); 759 WebGLRenderingContext* context = V8WebGLRenderingContext::toNative(info.Hold er());
760 760
761 const int uniformLocationArgumentIndex = 0; 761 const int uniformLocationArgumentIndex = 0;
762 if (info.Length() > 0 && !isUndefinedOrNull(info[uniformLocationArgumentInde x]) && !V8WebGLUniformLocation::hasInstance(info[uniformLocationArgumentIndex], info.GetIsolate(), worldType(info.GetIsolate()))) { 762 if (info.Length() > 0 && !isUndefinedOrNull(info[uniformLocationArgumentInde x]) && !V8WebGLUniformLocation::hasInstance(info[uniformLocationArgumentIndex], info.GetIsolate())) {
763 exceptionState.throwTypeError(ExceptionMessages::incorrectArgumentType(u niformLocationArgumentIndex + 1, "is not a WebGLUniformLocation object.")); 763 exceptionState.throwTypeError(ExceptionMessages::incorrectArgumentType(u niformLocationArgumentIndex + 1, "is not a WebGLUniformLocation object."));
764 exceptionState.throwIfNeeded(); 764 exceptionState.throwIfNeeded();
765 return; 765 return;
766 } 766 }
767 WebGLUniformLocation* location = toWebGLUniformLocation(info[uniformLocation ArgumentIndex], info.GetIsolate()); 767 WebGLUniformLocation* location = toWebGLUniformLocation(info[uniformLocation ArgumentIndex], info.GetIsolate());
768 768
769 bool transpose = info[1]->BooleanValue(); 769 bool transpose = info[1]->BooleanValue();
770 const int arrayArgumentIndex = 2; 770 const int arrayArgumentIndex = 2;
771 if (V8Float32Array::hasInstance(info[arrayArgumentIndex], info.GetIsolate(), worldType(info.GetIsolate()))) { 771 if (V8Float32Array::hasInstance(info[arrayArgumentIndex], info.GetIsolate()) ) {
772 Float32Array* array = V8Float32Array::toNative(info[arrayArgumentIndex]- >ToObject()); 772 Float32Array* array = V8Float32Array::toNative(info[arrayArgumentIndex]- >ToObject());
773 ASSERT(array != NULL); 773 ASSERT(array != NULL);
774 switch (matrixSize) { 774 switch (matrixSize) {
775 case 2: context->uniformMatrix2fv(location, transpose, array); break; 775 case 2: context->uniformMatrix2fv(location, transpose, array); break;
776 case 3: context->uniformMatrix3fv(location, transpose, array); break; 776 case 3: context->uniformMatrix3fv(location, transpose, array); break;
777 case 4: context->uniformMatrix4fv(location, transpose, array); break; 777 case 4: context->uniformMatrix4fv(location, transpose, array); break;
778 default: ASSERT_NOT_REACHED(); break; 778 default: ASSERT_NOT_REACHED(); break;
779 } 779 }
780 return; 780 return;
781 } 781 }
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
841 vertexAttribAndUniformHelperf(info, kVertexAttrib3v, exceptionState); 841 vertexAttribAndUniformHelperf(info, kVertexAttrib3v, exceptionState);
842 } 842 }
843 843
844 void V8WebGLRenderingContext::vertexAttrib4fvMethodCustom(const v8::FunctionCall backInfo<v8::Value>& info) 844 void V8WebGLRenderingContext::vertexAttrib4fvMethodCustom(const v8::FunctionCall backInfo<v8::Value>& info)
845 { 845 {
846 ExceptionState exceptionState(ExceptionState::ExecutionContext, "vertexAttri b4fv", "WebGLRenderingContext", info.Holder(), info.GetIsolate()); 846 ExceptionState exceptionState(ExceptionState::ExecutionContext, "vertexAttri b4fv", "WebGLRenderingContext", info.Holder(), info.GetIsolate());
847 vertexAttribAndUniformHelperf(info, kVertexAttrib4v, exceptionState); 847 vertexAttribAndUniformHelperf(info, kVertexAttrib4v, exceptionState);
848 } 848 }
849 849
850 } // namespace WebCore 850 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/bindings/v8/custom/V8TypedArrayCustom.h ('k') | Source/bindings/v8/custom/V8XMLHttpRequestCustom.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698