| 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 521 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 532 if (info[indexArrayArgument].IsEmpty() || !info[indexArrayArgument]->IsArray
()) { | 532 if (info[indexArrayArgument].IsEmpty() || !info[indexArrayArgument]->IsArray
()) { |
| 533 exceptionState.throwTypeError(ExceptionMessages::argumentNullOrIncorrect
Type(indexArrayArgument + 1, "Array")); | 533 exceptionState.throwTypeError(ExceptionMessages::argumentNullOrIncorrect
Type(indexArrayArgument + 1, "Array")); |
| 534 exceptionState.throwIfNeeded(); | 534 exceptionState.throwIfNeeded(); |
| 535 return; | 535 return; |
| 536 } | 536 } |
| 537 v8::Handle<v8::Array> array = v8::Local<v8::Array>::Cast(info[1]); | 537 v8::Handle<v8::Array> array = v8::Local<v8::Array>::Cast(info[1]); |
| 538 if (array->Length() > WTF::DefaultAllocatorQuantizer::kMaxUnquantizedAllocat
ion / sizeof(float)) { | 538 if (array->Length() > WTF::DefaultAllocatorQuantizer::kMaxUnquantizedAllocat
ion / sizeof(float)) { |
| 539 exceptionState.throwTypeError("Array length exceeds supported limit."); | 539 exceptionState.throwTypeError("Array length exceeds supported limit."); |
| 540 return; | 540 return; |
| 541 } | 541 } |
| 542 v8::TryCatch block; | 542 Vector<float> implArray = toImplArray<float>(array, 0, info.GetIsolate(), ex
ceptionState); |
| 543 Vector<float> implArray = toImplArray<float>(array, 0, info.GetIsolate()); | 543 if (exceptionState.hadException()) |
| 544 if (block.HasCaught()) { | |
| 545 block.ReThrow(); | |
| 546 return; | 544 return; |
| 547 } | |
| 548 switch (functionToCall) { | 545 switch (functionToCall) { |
| 549 case kUniform1v: context->uniform1fv(location, implArray.data(), implArray.s
ize()); break; | 546 case kUniform1v: context->uniform1fv(location, implArray.data(), implArray.s
ize()); break; |
| 550 case kUniform2v: context->uniform2fv(location, implArray.data(), implArray.s
ize()); break; | 547 case kUniform2v: context->uniform2fv(location, implArray.data(), implArray.s
ize()); break; |
| 551 case kUniform3v: context->uniform3fv(location, implArray.data(), implArray.s
ize()); break; | 548 case kUniform3v: context->uniform3fv(location, implArray.data(), implArray.s
ize()); break; |
| 552 case kUniform4v: context->uniform4fv(location, implArray.data(), implArray.s
ize()); break; | 549 case kUniform4v: context->uniform4fv(location, implArray.data(), implArray.s
ize()); break; |
| 553 case kVertexAttrib1v: context->vertexAttrib1fv(index, implArray.data(), impl
Array.size()); break; | 550 case kVertexAttrib1v: context->vertexAttrib1fv(index, implArray.data(), impl
Array.size()); break; |
| 554 case kVertexAttrib2v: context->vertexAttrib2fv(index, implArray.data(), impl
Array.size()); break; | 551 case kVertexAttrib2v: context->vertexAttrib2fv(index, implArray.data(), impl
Array.size()); break; |
| 555 case kVertexAttrib3v: context->vertexAttrib3fv(index, implArray.data(), impl
Array.size()); break; | 552 case kVertexAttrib3v: context->vertexAttrib3fv(index, implArray.data(), impl
Array.size()); break; |
| 556 case kVertexAttrib4v: context->vertexAttrib4fv(index, implArray.data(), impl
Array.size()); break; | 553 case kVertexAttrib4v: context->vertexAttrib4fv(index, implArray.data(), impl
Array.size()); break; |
| 557 default: ASSERT_NOT_REACHED(); break; | 554 default: ASSERT_NOT_REACHED(); break; |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 602 if (info[indexArrayArgumentIndex].IsEmpty() || !info[indexArrayArgumentIndex
]->IsArray()) { | 599 if (info[indexArrayArgumentIndex].IsEmpty() || !info[indexArrayArgumentIndex
]->IsArray()) { |
| 603 exceptionState.throwTypeError(ExceptionMessages::argumentNullOrIncorrect
Type(indexArrayArgumentIndex + 1, "Array")); | 600 exceptionState.throwTypeError(ExceptionMessages::argumentNullOrIncorrect
Type(indexArrayArgumentIndex + 1, "Array")); |
| 604 exceptionState.throwIfNeeded(); | 601 exceptionState.throwIfNeeded(); |
| 605 return; | 602 return; |
| 606 } | 603 } |
| 607 v8::Handle<v8::Array> array = v8::Local<v8::Array>::Cast(info[indexArrayArgu
mentIndex]); | 604 v8::Handle<v8::Array> array = v8::Local<v8::Array>::Cast(info[indexArrayArgu
mentIndex]); |
| 608 if (array->Length() > WTF::DefaultAllocatorQuantizer::kMaxUnquantizedAlloca
tion / sizeof(int)) { | 605 if (array->Length() > WTF::DefaultAllocatorQuantizer::kMaxUnquantizedAlloca
tion / sizeof(int)) { |
| 609 exceptionState.throwTypeError("Array length exceeds supported limit."); | 606 exceptionState.throwTypeError("Array length exceeds supported limit."); |
| 610 return; | 607 return; |
| 611 } | 608 } |
| 612 v8::TryCatch block; | 609 Vector<int> implArray = toImplArray<int>(array, 0, info.GetIsolate(), except
ionState); |
| 613 Vector<int> implArray = toImplArray<int>(array, 0, info.GetIsolate()); | 610 if (exceptionState.hadException()) |
| 614 if (block.HasCaught()) { | |
| 615 block.ReThrow(); | |
| 616 return; | 611 return; |
| 617 } | |
| 618 switch (functionToCall) { | 612 switch (functionToCall) { |
| 619 case kUniform1v: context->uniform1iv(location, implArray.data(), implArray.s
ize()); break; | 613 case kUniform1v: context->uniform1iv(location, implArray.data(), implArray.s
ize()); break; |
| 620 case kUniform2v: context->uniform2iv(location, implArray.data(), implArray.s
ize()); break; | 614 case kUniform2v: context->uniform2iv(location, implArray.data(), implArray.s
ize()); break; |
| 621 case kUniform3v: context->uniform3iv(location, implArray.data(), implArray.s
ize()); break; | 615 case kUniform3v: context->uniform3iv(location, implArray.data(), implArray.s
ize()); break; |
| 622 case kUniform4v: context->uniform4iv(location, implArray.data(), implArray.s
ize()); break; | 616 case kUniform4v: context->uniform4iv(location, implArray.data(), implArray.s
ize()); break; |
| 623 default: ASSERT_NOT_REACHED(); break; | 617 default: ASSERT_NOT_REACHED(); break; |
| 624 } | 618 } |
| 625 } | 619 } |
| 626 | 620 |
| 627 void V8WebGLRenderingContext::uniform1fvMethodCustom(const v8::FunctionCallbackI
nfo<v8::Value>& info) | 621 void V8WebGLRenderingContext::uniform1fvMethodCustom(const v8::FunctionCallbackI
nfo<v8::Value>& info) |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 716 if (info[arrayArgumentIndex].IsEmpty() || !info[arrayArgumentIndex]->IsArray
()) { | 710 if (info[arrayArgumentIndex].IsEmpty() || !info[arrayArgumentIndex]->IsArray
()) { |
| 717 exceptionState.throwTypeError(ExceptionMessages::argumentNullOrIncorrect
Type(arrayArgumentIndex + 1, "Array")); | 711 exceptionState.throwTypeError(ExceptionMessages::argumentNullOrIncorrect
Type(arrayArgumentIndex + 1, "Array")); |
| 718 exceptionState.throwIfNeeded(); | 712 exceptionState.throwIfNeeded(); |
| 719 return; | 713 return; |
| 720 } | 714 } |
| 721 v8::Handle<v8::Array> array = v8::Local<v8::Array>::Cast(info[2]); | 715 v8::Handle<v8::Array> array = v8::Local<v8::Array>::Cast(info[2]); |
| 722 if (array->Length() > WTF::DefaultAllocatorQuantizer::kMaxUnquantizedAlloca
tion / sizeof(float)) { | 716 if (array->Length() > WTF::DefaultAllocatorQuantizer::kMaxUnquantizedAlloca
tion / sizeof(float)) { |
| 723 exceptionState.throwTypeError("Array length exceeds supported limit."); | 717 exceptionState.throwTypeError("Array length exceeds supported limit."); |
| 724 return; | 718 return; |
| 725 } | 719 } |
| 726 v8::TryCatch block; | 720 Vector<float> implArray = toImplArray<float>(array, 0, info.GetIsolate(), ex
ceptionState); |
| 727 Vector<float> implArray = toImplArray<float>(array, 0, info.GetIsolate()); | 721 if (exceptionState.hadException()) |
| 728 if (block.HasCaught()) { | |
| 729 block.ReThrow(); | |
| 730 return; | 722 return; |
| 731 } | |
| 732 switch (matrixSize) { | 723 switch (matrixSize) { |
| 733 case 2: context->uniformMatrix2fv(location, transpose, implArray.data(), imp
lArray.size()); break; | 724 case 2: context->uniformMatrix2fv(location, transpose, implArray.data(), imp
lArray.size()); break; |
| 734 case 3: context->uniformMatrix3fv(location, transpose, implArray.data(), imp
lArray.size()); break; | 725 case 3: context->uniformMatrix3fv(location, transpose, implArray.data(), imp
lArray.size()); break; |
| 735 case 4: context->uniformMatrix4fv(location, transpose, implArray.data(), imp
lArray.size()); break; | 726 case 4: context->uniformMatrix4fv(location, transpose, implArray.data(), imp
lArray.size()); break; |
| 736 default: ASSERT_NOT_REACHED(); break; | 727 default: ASSERT_NOT_REACHED(); break; |
| 737 } | 728 } |
| 738 } | 729 } |
| 739 | 730 |
| 740 void V8WebGLRenderingContext::uniformMatrix2fvMethodCustom(const v8::FunctionCal
lbackInfo<v8::Value>& info) | 731 void V8WebGLRenderingContext::uniformMatrix2fvMethodCustom(const v8::FunctionCal
lbackInfo<v8::Value>& info) |
| 741 { | 732 { |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 773 vertexAttribAndUniformHelperf(info, kVertexAttrib3v, exceptionState); | 764 vertexAttribAndUniformHelperf(info, kVertexAttrib3v, exceptionState); |
| 774 } | 765 } |
| 775 | 766 |
| 776 void V8WebGLRenderingContext::vertexAttrib4fvMethodCustom(const v8::FunctionCall
backInfo<v8::Value>& info) | 767 void V8WebGLRenderingContext::vertexAttrib4fvMethodCustom(const v8::FunctionCall
backInfo<v8::Value>& info) |
| 777 { | 768 { |
| 778 ExceptionState exceptionState(ExceptionState::ExecutionContext, "vertexAttri
b4fv", "WebGLRenderingContext", info.Holder(), info.GetIsolate()); | 769 ExceptionState exceptionState(ExceptionState::ExecutionContext, "vertexAttri
b4fv", "WebGLRenderingContext", info.Holder(), info.GetIsolate()); |
| 779 vertexAttribAndUniformHelperf(info, kVertexAttrib4v, exceptionState); | 770 vertexAttribAndUniformHelperf(info, kVertexAttrib4v, exceptionState); |
| 780 } | 771 } |
| 781 | 772 |
| 782 } // namespace blink | 773 } // namespace blink |
| OLD | NEW |