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

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

Issue 205243013: Got WebGLRenderingContextBase to work with the "implements" syntax (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase + Layout Test Update Created 6 years, 9 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
« no previous file with comments | « Source/bindings/v8/custom/V8WebGLRenderingContextBaseCustom.cpp ('k') | Source/core/core.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 11 matching lines...) Expand all
22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 #include "config.h" 31 #include "config.h"
32 #include "V8WebGLRenderingContextBase.h" 32 #include "V8WebGLRenderingContext.h"
33 33
34 #include "V8ANGLEInstancedArrays.h" 34 #include "V8ANGLEInstancedArrays.h"
35 #include "V8EXTFragDepth.h" 35 #include "V8EXTFragDepth.h"
36 #include "V8EXTTextureFilterAnisotropic.h" 36 #include "V8EXTTextureFilterAnisotropic.h"
37 #include "V8HTMLCanvasElement.h" 37 #include "V8HTMLCanvasElement.h"
38 #include "V8HTMLImageElement.h" 38 #include "V8HTMLImageElement.h"
39 #include "V8HTMLVideoElement.h" 39 #include "V8HTMLVideoElement.h"
40 #include "V8ImageData.h" 40 #include "V8ImageData.h"
41 #include "V8OESElementIndexUint.h" 41 #include "V8OESElementIndexUint.h"
42 #include "V8OESStandardDerivatives.h" 42 #include "V8OESStandardDerivatives.h"
(...skipping 23 matching lines...) Expand all
66 #include "bindings/v8/V8HiddenValue.h" 66 #include "bindings/v8/V8HiddenValue.h"
67 #include "bindings/v8/custom/V8ArrayBufferViewCustom.h" 67 #include "bindings/v8/custom/V8ArrayBufferViewCustom.h"
68 #include "bindings/v8/custom/V8Float32ArrayCustom.h" 68 #include "bindings/v8/custom/V8Float32ArrayCustom.h"
69 #include "bindings/v8/custom/V8Int16ArrayCustom.h" 69 #include "bindings/v8/custom/V8Int16ArrayCustom.h"
70 #include "bindings/v8/custom/V8Int32ArrayCustom.h" 70 #include "bindings/v8/custom/V8Int32ArrayCustom.h"
71 #include "bindings/v8/custom/V8Int8ArrayCustom.h" 71 #include "bindings/v8/custom/V8Int8ArrayCustom.h"
72 #include "bindings/v8/custom/V8Uint16ArrayCustom.h" 72 #include "bindings/v8/custom/V8Uint16ArrayCustom.h"
73 #include "bindings/v8/custom/V8Uint32ArrayCustom.h" 73 #include "bindings/v8/custom/V8Uint32ArrayCustom.h"
74 #include "bindings/v8/custom/V8Uint8ArrayCustom.h" 74 #include "bindings/v8/custom/V8Uint8ArrayCustom.h"
75 #include "core/dom/ExceptionCode.h" 75 #include "core/dom/ExceptionCode.h"
76 #include "core/html/canvas/WebGLRenderingContextBase.h" 76 #include "core/html/canvas/WebGLRenderingContext.h"
77 #include "platform/NotImplemented.h" 77 #include "platform/NotImplemented.h"
78 #include "wtf/FastMalloc.h" 78 #include "wtf/FastMalloc.h"
79 #include <limits> 79 #include <limits>
80 80
81 namespace WebCore { 81 namespace WebCore {
82 82
83 // Allocates new storage via fastMalloc. 83 // Allocates new storage via fastMalloc.
84 // Returns 0 if array failed to convert for any reason. 84 // Returns 0 if array failed to convert for any reason.
85 static float* jsArrayToFloatArray(v8::Handle<v8::Array> array, uint32_t len, Exc eptionState& exceptionState) 85 static float* jsArrayToFloatArray(v8::Handle<v8::Array> array, uint32_t len, Exc eptionState& exceptionState)
86 { 86 {
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 }; 269 };
270 270
271 static void getObjectParameter(const v8::FunctionCallbackInfo<v8::Value>& info, ObjectType objectType, ExceptionState& exceptionState) 271 static void getObjectParameter(const v8::FunctionCallbackInfo<v8::Value>& info, ObjectType objectType, ExceptionState& exceptionState)
272 { 272 {
273 if (info.Length() != 2) { 273 if (info.Length() != 2) {
274 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(2, i nfo.Length())); 274 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(2, i nfo.Length()));
275 exceptionState.throwIfNeeded(); 275 exceptionState.throwIfNeeded();
276 return; 276 return;
277 } 277 }
278 278
279 WebGLRenderingContextBase* context = V8WebGLRenderingContextBase::toNative(i nfo.Holder()); 279 WebGLRenderingContext* context = V8WebGLRenderingContext::toNative(info.Hold er());
280 unsigned target = toInt32(info[0], exceptionState); 280 unsigned target = toInt32(info[0], exceptionState);
281 if (exceptionState.throwIfNeeded()) 281 if (exceptionState.throwIfNeeded())
282 return; 282 return;
283 unsigned pname = toInt32(info[1], exceptionState); 283 unsigned pname = toInt32(info[1], exceptionState);
284 if (exceptionState.throwIfNeeded()) 284 if (exceptionState.throwIfNeeded())
285 return; 285 return;
286 WebGLGetInfo args; 286 WebGLGetInfo args;
287 switch (objectType) { 287 switch (objectType) {
288 case kBuffer: 288 case kBuffer:
289 args = context->getBufferParameter(target, pname); 289 args = context->getBufferParameter(target, pname);
(...skipping 17 matching lines...) Expand all
307 307
308 static WebGLUniformLocation* toWebGLUniformLocation(v8::Handle<v8::Value> value, v8::Isolate* isolate) 308 static WebGLUniformLocation* toWebGLUniformLocation(v8::Handle<v8::Value> value, v8::Isolate* isolate)
309 { 309 {
310 return V8WebGLUniformLocation::toNativeWithTypeCheck(isolate, value); 310 return V8WebGLUniformLocation::toNativeWithTypeCheck(isolate, value);
311 } 311 }
312 312
313 enum WhichProgramCall { 313 enum WhichProgramCall {
314 kProgramParameter, kUniform 314 kProgramParameter, kUniform
315 }; 315 };
316 316
317 void V8WebGLRenderingContextBase::getAttachedShadersMethodCustom(const v8::Funct ionCallbackInfo<v8::Value>& info) 317 void V8WebGLRenderingContext::getAttachedShadersMethodCustom(const v8::FunctionC allbackInfo<v8::Value>& info)
318 { 318 {
319 ExceptionState exceptionState(ExceptionState::ExecutionContext, "getAttached Shaders", "WebGLRenderingContextBase", info.Holder(), info.GetIsolate()); 319 ExceptionState exceptionState(ExceptionState::ExecutionContext, "getAttached Shaders", "WebGLRenderingContext", info.Holder(), info.GetIsolate());
320 if (info.Length() < 1) { 320 if (info.Length() < 1) {
321 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(1, i nfo.Length())); 321 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(1, i nfo.Length()));
322 exceptionState.throwIfNeeded(); 322 exceptionState.throwIfNeeded();
323 return; 323 return;
324 } 324 }
325 325
326 const int programArgumentIndex = 0; 326 const int programArgumentIndex = 0;
327 WebGLRenderingContextBase* context = V8WebGLRenderingContextBase::toNative(i nfo.Holder()); 327 WebGLRenderingContext* context = V8WebGLRenderingContext::toNative(info.Hold er());
328 if (info.Length() > 0 && !isUndefinedOrNull(info[programArgumentIndex]) && ! V8WebGLProgram::hasInstance(info[programArgumentIndex], info.GetIsolate())) { 328 if (info.Length() > 0 && !isUndefinedOrNull(info[programArgumentIndex]) && ! V8WebGLProgram::hasInstance(info[programArgumentIndex], info.GetIsolate())) {
329 exceptionState.throwTypeError(ExceptionMessages::argumentNullOrIncorrect Type(programArgumentIndex + 1, "WebGLProgram")); 329 exceptionState.throwTypeError(ExceptionMessages::argumentNullOrIncorrect Type(programArgumentIndex + 1, "WebGLProgram"));
330 exceptionState.throwIfNeeded(); 330 exceptionState.throwIfNeeded();
331 return; 331 return;
332 } 332 }
333 WebGLProgram* program = V8WebGLProgram::toNativeWithTypeCheck(info.GetIsolat e(), info[programArgumentIndex]); 333 WebGLProgram* program = V8WebGLProgram::toNativeWithTypeCheck(info.GetIsolat e(), info[programArgumentIndex]);
334 Vector<RefPtr<WebGLShader> > shaders; 334 Vector<RefPtr<WebGLShader> > shaders;
335 bool succeed = context->getAttachedShaders(program, shaders); 335 bool succeed = context->getAttachedShaders(program, shaders);
336 if (!succeed) { 336 if (!succeed) {
337 v8SetReturnValueNull(info); 337 v8SetReturnValueNull(info);
338 return; 338 return;
339 } 339 }
340 v8::Local<v8::Array> array = v8::Array::New(info.GetIsolate(), shaders.size( )); 340 v8::Local<v8::Array> array = v8::Array::New(info.GetIsolate(), shaders.size( ));
341 for (size_t ii = 0; ii < shaders.size(); ++ii) 341 for (size_t ii = 0; ii < shaders.size(); ++ii)
342 array->Set(v8::Integer::New(info.GetIsolate(), ii), toV8(shaders[ii].get (), info.Holder(), info.GetIsolate())); 342 array->Set(v8::Integer::New(info.GetIsolate(), ii), toV8(shaders[ii].get (), info.Holder(), info.GetIsolate()));
343 v8SetReturnValue(info, array); 343 v8SetReturnValue(info, array);
344 } 344 }
345 345
346 void V8WebGLRenderingContextBase::getBufferParameterMethodCustom(const v8::Funct ionCallbackInfo<v8::Value>& info) 346 void V8WebGLRenderingContext::getBufferParameterMethodCustom(const v8::FunctionC allbackInfo<v8::Value>& info)
347 { 347 {
348 ExceptionState exceptionState(ExceptionState::ExecutionContext, "getBufferPa rameter", "WebGLRenderingContextBase", info.Holder(), info.GetIsolate()); 348 ExceptionState exceptionState(ExceptionState::ExecutionContext, "getBufferPa rameter", "WebGLRenderingContext", info.Holder(), info.GetIsolate());
349 getObjectParameter(info, kBuffer, exceptionState); 349 getObjectParameter(info, kBuffer, exceptionState);
350 } 350 }
351 351
352 void V8WebGLRenderingContextBase::getExtensionMethodCustom(const v8::FunctionCal lbackInfo<v8::Value>& info) 352 void V8WebGLRenderingContext::getExtensionMethodCustom(const v8::FunctionCallbac kInfo<v8::Value>& info)
353 { 353 {
354 ExceptionState exceptionState(ExceptionState::ExecutionContext, "getExtensio n", "WebGLRenderingContextBase", info.Holder(), info.GetIsolate()); 354 ExceptionState exceptionState(ExceptionState::ExecutionContext, "getExtensio n", "WebGLRenderingContext", info.Holder(), info.GetIsolate());
355 WebGLRenderingContextBase* impl = V8WebGLRenderingContextBase::toNative(info .Holder()); 355 WebGLRenderingContext* impl = V8WebGLRenderingContext::toNative(info.Holder( ));
356 if (info.Length() < 1) { 356 if (info.Length() < 1) {
357 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(1, i nfo.Length())); 357 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(1, i nfo.Length()));
358 exceptionState.throwIfNeeded(); 358 exceptionState.throwIfNeeded();
359 return; 359 return;
360 } 360 }
361 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, name, info[0]); 361 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, name, info[0]);
362 RefPtr<WebGLExtension> extension(impl->getExtension(name)); 362 RefPtr<WebGLExtension> extension(impl->getExtension(name));
363 v8SetReturnValue(info, toV8Object(extension.get(), info.Holder(), info.GetIs olate())); 363 v8SetReturnValue(info, toV8Object(extension.get(), info.Holder(), info.GetIs olate()));
364 } 364 }
365 365
366 void V8WebGLRenderingContextBase::getFramebufferAttachmentParameterMethodCustom( const v8::FunctionCallbackInfo<v8::Value>& info) 366 void V8WebGLRenderingContext::getFramebufferAttachmentParameterMethodCustom(cons t v8::FunctionCallbackInfo<v8::Value>& info)
367 { 367 {
368 ExceptionState exceptionState(ExceptionState::ExecutionContext, "getFramebuf ferAttachmentParameter", "WebGLRenderingContextBase", info.Holder(), info.GetIso late()); 368 ExceptionState exceptionState(ExceptionState::ExecutionContext, "getFramebuf ferAttachmentParameter", "WebGLRenderingContext", info.Holder(), info.GetIsolate ());
369 if (info.Length() != 3) { 369 if (info.Length() != 3) {
370 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(3, i nfo.Length())); 370 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(3, i nfo.Length()));
371 exceptionState.throwIfNeeded(); 371 exceptionState.throwIfNeeded();
372 return; 372 return;
373 } 373 }
374 374
375 WebGLRenderingContextBase* context = V8WebGLRenderingContextBase::toNative(i nfo.Holder()); 375 WebGLRenderingContext* context = V8WebGLRenderingContext::toNative(info.Hold er());
376 unsigned target = toInt32(info[0]); 376 unsigned target = toInt32(info[0]);
377 unsigned attachment = toInt32(info[1], exceptionState); 377 unsigned attachment = toInt32(info[1], exceptionState);
378 if (exceptionState.throwIfNeeded()) 378 if (exceptionState.throwIfNeeded())
379 return; 379 return;
380 unsigned pname = toInt32(info[2], exceptionState); 380 unsigned pname = toInt32(info[2], exceptionState);
381 if (exceptionState.throwIfNeeded()) 381 if (exceptionState.throwIfNeeded())
382 return; 382 return;
383 WebGLGetInfo args = context->getFramebufferAttachmentParameter(target, attac hment, pname); 383 WebGLGetInfo args = context->getFramebufferAttachmentParameter(target, attac hment, pname);
384 v8SetReturnValue(info, toV8Object(args, info.Holder(), info.GetIsolate())); 384 v8SetReturnValue(info, toV8Object(args, info.Holder(), info.GetIsolate()));
385 } 385 }
386 386
387 void V8WebGLRenderingContextBase::getParameterMethodCustom(const v8::FunctionCal lbackInfo<v8::Value>& info) 387 void V8WebGLRenderingContext::getParameterMethodCustom(const v8::FunctionCallbac kInfo<v8::Value>& info)
388 { 388 {
389 ExceptionState exceptionState(ExceptionState::ExecutionContext, "getParamete r", "WebGLRenderingContextBase", info.Holder(), info.GetIsolate()); 389 ExceptionState exceptionState(ExceptionState::ExecutionContext, "getParamete r", "WebGLRenderingContext", info.Holder(), info.GetIsolate());
390 if (info.Length() != 1) { 390 if (info.Length() != 1) {
391 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(1, i nfo.Length())); 391 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(1, i nfo.Length()));
392 exceptionState.throwIfNeeded(); 392 exceptionState.throwIfNeeded();
393 return; 393 return;
394 } 394 }
395 395
396 WebGLRenderingContextBase* context = V8WebGLRenderingContextBase::toNative(i nfo.Holder()); 396 WebGLRenderingContext* context = V8WebGLRenderingContext::toNative(info.Hold er());
397 unsigned pname = toInt32(info[0], exceptionState); 397 unsigned pname = toInt32(info[0], exceptionState);
398 if (exceptionState.throwIfNeeded()) 398 if (exceptionState.throwIfNeeded())
399 return; 399 return;
400 WebGLGetInfo args = context->getParameter(pname); 400 WebGLGetInfo args = context->getParameter(pname);
401 v8SetReturnValue(info, toV8Object(args, info.Holder(), info.GetIsolate())); 401 v8SetReturnValue(info, toV8Object(args, info.Holder(), info.GetIsolate()));
402 } 402 }
403 403
404 void V8WebGLRenderingContextBase::getProgramParameterMethodCustom(const v8::Func tionCallbackInfo<v8::Value>& info) 404 void V8WebGLRenderingContext::getProgramParameterMethodCustom(const v8::Function CallbackInfo<v8::Value>& info)
405 { 405 {
406 ExceptionState exceptionState(ExceptionState::ExecutionContext, "getProgramP arameter", "WebGLRenderingContextBase", info.Holder(), info.GetIsolate()); 406 ExceptionState exceptionState(ExceptionState::ExecutionContext, "getProgramP arameter", "WebGLRenderingContext", info.Holder(), info.GetIsolate());
407 if (info.Length() != 2) { 407 if (info.Length() != 2) {
408 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(2, i nfo.Length())); 408 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(2, i nfo.Length()));
409 exceptionState.throwIfNeeded(); 409 exceptionState.throwIfNeeded();
410 return; 410 return;
411 } 411 }
412 412
413 const int programArgumentIndex = 0; 413 const int programArgumentIndex = 0;
414 WebGLRenderingContextBase* context = V8WebGLRenderingContextBase::toNative(i nfo.Holder()); 414 WebGLRenderingContext* context = V8WebGLRenderingContext::toNative(info.Hold er());
415 if (info.Length() > 0 && !isUndefinedOrNull(info[programArgumentIndex]) && ! V8WebGLProgram::hasInstance(info[programArgumentIndex], info.GetIsolate())) { 415 if (info.Length() > 0 && !isUndefinedOrNull(info[programArgumentIndex]) && ! V8WebGLProgram::hasInstance(info[programArgumentIndex], info.GetIsolate())) {
416 exceptionState.throwTypeError(ExceptionMessages::argumentNullOrIncorrect Type(programArgumentIndex + 1, "WebGLProgram")); 416 exceptionState.throwTypeError(ExceptionMessages::argumentNullOrIncorrect Type(programArgumentIndex + 1, "WebGLProgram"));
417 exceptionState.throwIfNeeded(); 417 exceptionState.throwIfNeeded();
418 return; 418 return;
419 } 419 }
420 WebGLProgram* program = V8WebGLProgram::toNativeWithTypeCheck(info.GetIsolat e(), info[programArgumentIndex]); 420 WebGLProgram* program = V8WebGLProgram::toNativeWithTypeCheck(info.GetIsolat e(), info[programArgumentIndex]);
421 unsigned pname = toInt32(info[1], exceptionState); 421 unsigned pname = toInt32(info[1], exceptionState);
422 if (exceptionState.throwIfNeeded()) 422 if (exceptionState.throwIfNeeded())
423 return; 423 return;
424 WebGLGetInfo args = context->getProgramParameter(program, pname); 424 WebGLGetInfo args = context->getProgramParameter(program, pname);
425 v8SetReturnValue(info, toV8Object(args, info.Holder(), info.GetIsolate())); 425 v8SetReturnValue(info, toV8Object(args, info.Holder(), info.GetIsolate()));
426 } 426 }
427 427
428 void V8WebGLRenderingContextBase::getRenderbufferParameterMethodCustom(const v8: :FunctionCallbackInfo<v8::Value>& info) 428 void V8WebGLRenderingContext::getRenderbufferParameterMethodCustom(const v8::Fun ctionCallbackInfo<v8::Value>& info)
429 { 429 {
430 ExceptionState exceptionState(ExceptionState::ExecutionContext, "getRenderbu fferParameter", "WebGLRenderingContextBase", info.Holder(), info.GetIsolate()); 430 ExceptionState exceptionState(ExceptionState::ExecutionContext, "getRenderbu fferParameter", "WebGLRenderingContext", info.Holder(), info.GetIsolate());
431 getObjectParameter(info, kRenderbuffer, exceptionState); 431 getObjectParameter(info, kRenderbuffer, exceptionState);
432 } 432 }
433 433
434 void V8WebGLRenderingContextBase::getShaderParameterMethodCustom(const v8::Funct ionCallbackInfo<v8::Value>& info) 434 void V8WebGLRenderingContext::getShaderParameterMethodCustom(const v8::FunctionC allbackInfo<v8::Value>& info)
435 { 435 {
436 ExceptionState exceptionState(ExceptionState::ExecutionContext, "getShaderPa rameter", "WebGLRenderingContextBase", info.Holder(), info.GetIsolate()); 436 ExceptionState exceptionState(ExceptionState::ExecutionContext, "getShaderPa rameter", "WebGLRenderingContext", info.Holder(), info.GetIsolate());
437 if (info.Length() != 2) { 437 if (info.Length() != 2) {
438 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(2, i nfo.Length())); 438 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(2, i nfo.Length()));
439 exceptionState.throwIfNeeded(); 439 exceptionState.throwIfNeeded();
440 return; 440 return;
441 } 441 }
442 442
443 const int shaderArgumentIndex = 0; 443 const int shaderArgumentIndex = 0;
444 WebGLRenderingContextBase* context = V8WebGLRenderingContextBase::toNative(i nfo.Holder()); 444 WebGLRenderingContext* context = V8WebGLRenderingContext::toNative(info.Hold er());
445 if (info.Length() > 0 && !isUndefinedOrNull(info[shaderArgumentIndex]) && !V 8WebGLShader::hasInstance(info[shaderArgumentIndex], info.GetIsolate())) { 445 if (info.Length() > 0 && !isUndefinedOrNull(info[shaderArgumentIndex]) && !V 8WebGLShader::hasInstance(info[shaderArgumentIndex], info.GetIsolate())) {
446 exceptionState.throwTypeError(ExceptionMessages::argumentNullOrIncorrect Type(shaderArgumentIndex + 1, "WebGLShader")); 446 exceptionState.throwTypeError(ExceptionMessages::argumentNullOrIncorrect Type(shaderArgumentIndex + 1, "WebGLShader"));
447 exceptionState.throwIfNeeded(); 447 exceptionState.throwIfNeeded();
448 return; 448 return;
449 } 449 }
450 WebGLShader* shader = V8WebGLShader::toNativeWithTypeCheck(info.GetIsolate() , info[shaderArgumentIndex]); 450 WebGLShader* shader = V8WebGLShader::toNativeWithTypeCheck(info.GetIsolate() , info[shaderArgumentIndex]);
451 unsigned pname = toInt32(info[1], exceptionState); 451 unsigned pname = toInt32(info[1], exceptionState);
452 if (exceptionState.throwIfNeeded()) 452 if (exceptionState.throwIfNeeded())
453 return; 453 return;
454 WebGLGetInfo args = context->getShaderParameter(shader, pname); 454 WebGLGetInfo args = context->getShaderParameter(shader, pname);
455 v8SetReturnValue(info, toV8Object(args, info.Holder(), info.GetIsolate())); 455 v8SetReturnValue(info, toV8Object(args, info.Holder(), info.GetIsolate()));
456 } 456 }
457 457
458 void V8WebGLRenderingContextBase::getSupportedExtensionsMethodCustom(const v8::F unctionCallbackInfo<v8::Value>& info) 458 void V8WebGLRenderingContext::getSupportedExtensionsMethodCustom(const v8::Funct ionCallbackInfo<v8::Value>& info)
459 { 459 {
460 WebGLRenderingContextBase* impl = V8WebGLRenderingContextBase::toNative(info .Holder()); 460 WebGLRenderingContext* impl = V8WebGLRenderingContext::toNative(info.Holder( ));
461 if (impl->isContextLost()) { 461 if (impl->isContextLost()) {
462 v8SetReturnValueNull(info); 462 v8SetReturnValueNull(info);
463 return; 463 return;
464 } 464 }
465 465
466 Vector<String> value = impl->getSupportedExtensions(); 466 Vector<String> value = impl->getSupportedExtensions();
467 v8::Local<v8::Array> array = v8::Array::New(info.GetIsolate(), value.size()) ; 467 v8::Local<v8::Array> array = v8::Array::New(info.GetIsolate(), value.size()) ;
468 for (size_t ii = 0; ii < value.size(); ++ii) 468 for (size_t ii = 0; ii < value.size(); ++ii)
469 array->Set(v8::Integer::New(info.GetIsolate(), ii), v8String(info.GetIso late(), value[ii])); 469 array->Set(v8::Integer::New(info.GetIsolate(), ii), v8String(info.GetIso late(), value[ii]));
470 v8SetReturnValue(info, array); 470 v8SetReturnValue(info, array);
471 } 471 }
472 472
473 void V8WebGLRenderingContextBase::getTexParameterMethodCustom(const v8::Function CallbackInfo<v8::Value>& info) 473 void V8WebGLRenderingContext::getTexParameterMethodCustom(const v8::FunctionCall backInfo<v8::Value>& info)
474 { 474 {
475 ExceptionState exceptionState(ExceptionState::ExecutionContext, "getTexParam eter", "WebGLRenderingContextBase", info.Holder(), info.GetIsolate()); 475 ExceptionState exceptionState(ExceptionState::ExecutionContext, "getTexParam eter", "WebGLRenderingContext", info.Holder(), info.GetIsolate());
476 getObjectParameter(info, kTexture, exceptionState); 476 getObjectParameter(info, kTexture, exceptionState);
477 } 477 }
478 478
479 void V8WebGLRenderingContextBase::getUniformMethodCustom(const v8::FunctionCallb ackInfo<v8::Value>& info) 479 void V8WebGLRenderingContext::getUniformMethodCustom(const v8::FunctionCallbackI nfo<v8::Value>& info)
480 { 480 {
481 ExceptionState exceptionState(ExceptionState::ExecutionContext, "getUniform" , "WebGLRenderingContextBase", info.Holder(), info.GetIsolate()); 481 ExceptionState exceptionState(ExceptionState::ExecutionContext, "getUniform" , "WebGLRenderingContext", info.Holder(), info.GetIsolate());
482 if (info.Length() != 2) { 482 if (info.Length() != 2) {
483 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(2, i nfo.Length())); 483 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(2, i nfo.Length()));
484 exceptionState.throwIfNeeded(); 484 exceptionState.throwIfNeeded();
485 return; 485 return;
486 } 486 }
487 487
488 const int programArgumentIndex = 0; 488 const int programArgumentIndex = 0;
489 WebGLRenderingContextBase* context = V8WebGLRenderingContextBase::toNative(i nfo.Holder()); 489 WebGLRenderingContext* context = V8WebGLRenderingContext::toNative(info.Hold er());
490 if (info.Length() > 0 && !isUndefinedOrNull(info[programArgumentIndex]) && ! V8WebGLProgram::hasInstance(info[programArgumentIndex], info.GetIsolate())) { 490 if (info.Length() > 0 && !isUndefinedOrNull(info[programArgumentIndex]) && ! V8WebGLProgram::hasInstance(info[programArgumentIndex], info.GetIsolate())) {
491 exceptionState.throwTypeError(ExceptionMessages::argumentNullOrIncorrect Type(programArgumentIndex + 1, "WebGLProgram")); 491 exceptionState.throwTypeError(ExceptionMessages::argumentNullOrIncorrect Type(programArgumentIndex + 1, "WebGLProgram"));
492 exceptionState.throwIfNeeded(); 492 exceptionState.throwIfNeeded();
493 return; 493 return;
494 } 494 }
495 WebGLProgram* program = V8WebGLProgram::toNativeWithTypeCheck(info.GetIsolat e(), info[programArgumentIndex]); 495 WebGLProgram* program = V8WebGLProgram::toNativeWithTypeCheck(info.GetIsolat e(), info[programArgumentIndex]);
496 496
497 const int uniformArgumentIndex = 1; 497 const int uniformArgumentIndex = 1;
498 if (info.Length() > 1 && !isUndefinedOrNull(info[uniformArgumentIndex]) && ! V8WebGLUniformLocation::hasInstance(info[uniformArgumentIndex], info.GetIsolate( ))) { 498 if (info.Length() > 1 && !isUndefinedOrNull(info[uniformArgumentIndex]) && ! V8WebGLUniformLocation::hasInstance(info[uniformArgumentIndex], info.GetIsolate( ))) {
499 exceptionState.throwTypeError(ExceptionMessages::argumentNullOrIncorrect Type(uniformArgumentIndex + 1, "WebGLUniformLocation")); 499 exceptionState.throwTypeError(ExceptionMessages::argumentNullOrIncorrect Type(uniformArgumentIndex + 1, "WebGLUniformLocation"));
500 exceptionState.throwIfNeeded(); 500 exceptionState.throwIfNeeded();
501 return; 501 return;
502 } 502 }
503 const int uniformLocationArgumentIndex = 1; 503 const int uniformLocationArgumentIndex = 1;
504 WebGLUniformLocation* location = toWebGLUniformLocation(info[uniformLocation ArgumentIndex], info.GetIsolate()); 504 WebGLUniformLocation* location = toWebGLUniformLocation(info[uniformLocation ArgumentIndex], info.GetIsolate());
505 505
506 WebGLGetInfo args = context->getUniform(program, location); 506 WebGLGetInfo args = context->getUniform(program, location);
507 v8SetReturnValue(info, toV8Object(args, info.Holder(), info.GetIsolate())); 507 v8SetReturnValue(info, toV8Object(args, info.Holder(), info.GetIsolate()));
508 } 508 }
509 509
510 void V8WebGLRenderingContextBase::getVertexAttribMethodCustom(const v8::Function CallbackInfo<v8::Value>& info) 510 void V8WebGLRenderingContext::getVertexAttribMethodCustom(const v8::FunctionCall backInfo<v8::Value>& info)
511 { 511 {
512 ExceptionState exceptionState(ExceptionState::ExecutionContext, "getVertexAt trib", "WebGLRenderingContextBase", info.Holder(), info.GetIsolate()); 512 ExceptionState exceptionState(ExceptionState::ExecutionContext, "getVertexAt trib", "WebGLRenderingContext", info.Holder(), info.GetIsolate());
513 getObjectParameter(info, kVertexAttrib, exceptionState); 513 getObjectParameter(info, kVertexAttrib, exceptionState);
514 } 514 }
515 515
516 enum FunctionToCall { 516 enum FunctionToCall {
517 kUniform1v, kUniform2v, kUniform3v, kUniform4v, 517 kUniform1v, kUniform2v, kUniform3v, kUniform4v,
518 kVertexAttrib1v, kVertexAttrib2v, kVertexAttrib3v, kVertexAttrib4v 518 kVertexAttrib1v, kVertexAttrib2v, kVertexAttrib3v, kVertexAttrib4v
519 }; 519 };
520 520
521 bool isFunctionToCallForAttribute(FunctionToCall functionToCall) 521 bool isFunctionToCallForAttribute(FunctionToCall functionToCall)
522 { 522 {
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
568 } else { 568 } else {
569 const int uniformLocationArgumentIndex = 0; 569 const int uniformLocationArgumentIndex = 0;
570 if (info.Length() > 0 && !isUndefinedOrNull(info[uniformLocationArgument Index]) && !V8WebGLUniformLocation::hasInstance(info[uniformLocationArgumentInde x], info.GetIsolate())) { 570 if (info.Length() > 0 && !isUndefinedOrNull(info[uniformLocationArgument Index]) && !V8WebGLUniformLocation::hasInstance(info[uniformLocationArgumentInde x], info.GetIsolate())) {
571 exceptionState.throwTypeError(ExceptionMessages::argumentNullOrIncor rectType(uniformLocationArgumentIndex + 1, "WebGLUniformLocation")); 571 exceptionState.throwTypeError(ExceptionMessages::argumentNullOrIncor rectType(uniformLocationArgumentIndex + 1, "WebGLUniformLocation"));
572 exceptionState.throwIfNeeded(); 572 exceptionState.throwIfNeeded();
573 return; 573 return;
574 } 574 }
575 location = toWebGLUniformLocation(info[uniformLocationArgumentIndex], in fo.GetIsolate()); 575 location = toWebGLUniformLocation(info[uniformLocationArgumentIndex], in fo.GetIsolate());
576 } 576 }
577 577
578 WebGLRenderingContextBase* context = V8WebGLRenderingContextBase::toNative(i nfo.Holder()); 578 WebGLRenderingContext* context = V8WebGLRenderingContext::toNative(info.Hold er());
579 579
580 const int indexArrayArgument = 1; 580 const int indexArrayArgument = 1;
581 if (V8Float32Array::hasInstance(info[indexArrayArgument], info.GetIsolate()) ) { 581 if (V8Float32Array::hasInstance(info[indexArrayArgument], info.GetIsolate()) ) {
582 Float32Array* array = V8Float32Array::toNative(info[indexArrayArgument]- >ToObject()); 582 Float32Array* array = V8Float32Array::toNative(info[indexArrayArgument]- >ToObject());
583 ASSERT(array); 583 ASSERT(array);
584 switch (functionToCall) { 584 switch (functionToCall) {
585 case kUniform1v: context->uniform1fv(location, array); break; 585 case kUniform1v: context->uniform1fv(location, array); break;
586 case kUniform2v: context->uniform2fv(location, array); break; 586 case kUniform2v: context->uniform2fv(location, array); break;
587 case kUniform3v: context->uniform3fv(location, array); break; 587 case kUniform3v: context->uniform3fv(location, array); break;
588 case kUniform4v: context->uniform4fv(location, array); break; 588 case kUniform4v: context->uniform4fv(location, array); break;
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
637 // * glUniform4iv(GLUniformLocation location, Array data); 637 // * glUniform4iv(GLUniformLocation location, Array data);
638 // * glUniform4iv(GLUniformLocation location, Int32Array data); 638 // * glUniform4iv(GLUniformLocation location, Int32Array data);
639 639
640 if (info.Length() != 2) { 640 if (info.Length() != 2) {
641 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(2, i nfo.Length())); 641 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(2, i nfo.Length()));
642 exceptionState.throwIfNeeded(); 642 exceptionState.throwIfNeeded();
643 return; 643 return;
644 } 644 }
645 645
646 const int uniformLocationArgumentIndex = 0; 646 const int uniformLocationArgumentIndex = 0;
647 WebGLRenderingContextBase* context = V8WebGLRenderingContextBase::toNative(i nfo.Holder()); 647 WebGLRenderingContext* context = V8WebGLRenderingContext::toNative(info.Hold er());
648 if (info.Length() > 0 && !isUndefinedOrNull(info[uniformLocationArgumentInde x]) && !V8WebGLUniformLocation::hasInstance(info[uniformLocationArgumentIndex], info.GetIsolate())) { 648 if (info.Length() > 0 && !isUndefinedOrNull(info[uniformLocationArgumentInde x]) && !V8WebGLUniformLocation::hasInstance(info[uniformLocationArgumentIndex], info.GetIsolate())) {
649 exceptionState.throwTypeError(ExceptionMessages::argumentNullOrIncorrect Type(uniformLocationArgumentIndex + 1, "WebGLUniformLocation")); 649 exceptionState.throwTypeError(ExceptionMessages::argumentNullOrIncorrect Type(uniformLocationArgumentIndex + 1, "WebGLUniformLocation"));
650 exceptionState.throwIfNeeded(); 650 exceptionState.throwIfNeeded();
651 return; 651 return;
652 } 652 }
653 WebGLUniformLocation* location = toWebGLUniformLocation(info[uniformLocation ArgumentIndex], info.GetIsolate()); 653 WebGLUniformLocation* location = toWebGLUniformLocation(info[uniformLocation ArgumentIndex], info.GetIsolate());
654 654
655 const int indexArrayArgumentIndex = 1; 655 const int indexArrayArgumentIndex = 1;
656 if (V8Int32Array::hasInstance(info[indexArrayArgumentIndex], info.GetIsolate ())) { 656 if (V8Int32Array::hasInstance(info[indexArrayArgumentIndex], info.GetIsolate ())) {
657 Int32Array* array = V8Int32Array::toNative(info[indexArrayArgumentIndex] ->ToObject()); 657 Int32Array* array = V8Int32Array::toNative(info[indexArrayArgumentIndex] ->ToObject());
(...skipping 27 matching lines...) Expand all
685 switch (functionToCall) { 685 switch (functionToCall) {
686 case kUniform1v: context->uniform1iv(location, data, len); break; 686 case kUniform1v: context->uniform1iv(location, data, len); break;
687 case kUniform2v: context->uniform2iv(location, data, len); break; 687 case kUniform2v: context->uniform2iv(location, data, len); break;
688 case kUniform3v: context->uniform3iv(location, data, len); break; 688 case kUniform3v: context->uniform3iv(location, data, len); break;
689 case kUniform4v: context->uniform4iv(location, data, len); break; 689 case kUniform4v: context->uniform4iv(location, data, len); break;
690 default: ASSERT_NOT_REACHED(); break; 690 default: ASSERT_NOT_REACHED(); break;
691 } 691 }
692 fastFree(data); 692 fastFree(data);
693 } 693 }
694 694
695 void V8WebGLRenderingContextBase::uniform1fvMethodCustom(const v8::FunctionCallb ackInfo<v8::Value>& info) 695 void V8WebGLRenderingContext::uniform1fvMethodCustom(const v8::FunctionCallbackI nfo<v8::Value>& info)
696 { 696 {
697 ExceptionState exceptionState(ExceptionState::ExecutionContext, "uniform1fv" , "WebGLRenderingContextBase", info.Holder(), info.GetIsolate()); 697 ExceptionState exceptionState(ExceptionState::ExecutionContext, "uniform1fv" , "WebGLRenderingContext", info.Holder(), info.GetIsolate());
698 vertexAttribAndUniformHelperf(info, kUniform1v, exceptionState); 698 vertexAttribAndUniformHelperf(info, kUniform1v, exceptionState);
699 } 699 }
700 700
701 void V8WebGLRenderingContextBase::uniform1ivMethodCustom(const v8::FunctionCallb ackInfo<v8::Value>& info) 701 void V8WebGLRenderingContext::uniform1ivMethodCustom(const v8::FunctionCallbackI nfo<v8::Value>& info)
702 { 702 {
703 ExceptionState exceptionState(ExceptionState::ExecutionContext, "uniform1iv" , "WebGLRenderingContextBase", info.Holder(), info.GetIsolate()); 703 ExceptionState exceptionState(ExceptionState::ExecutionContext, "uniform1iv" , "WebGLRenderingContext", info.Holder(), info.GetIsolate());
704 uniformHelperi(info, kUniform1v, exceptionState); 704 uniformHelperi(info, kUniform1v, exceptionState);
705 } 705 }
706 706
707 void V8WebGLRenderingContextBase::uniform2fvMethodCustom(const v8::FunctionCallb ackInfo<v8::Value>& info) 707 void V8WebGLRenderingContext::uniform2fvMethodCustom(const v8::FunctionCallbackI nfo<v8::Value>& info)
708 { 708 {
709 ExceptionState exceptionState(ExceptionState::ExecutionContext, "uniform2fv" , "WebGLRenderingContextBase", info.Holder(), info.GetIsolate()); 709 ExceptionState exceptionState(ExceptionState::ExecutionContext, "uniform2fv" , "WebGLRenderingContext", info.Holder(), info.GetIsolate());
710 vertexAttribAndUniformHelperf(info, kUniform2v, exceptionState); 710 vertexAttribAndUniformHelperf(info, kUniform2v, exceptionState);
711 } 711 }
712 712
713 void V8WebGLRenderingContextBase::uniform2ivMethodCustom(const v8::FunctionCallb ackInfo<v8::Value>& info) 713 void V8WebGLRenderingContext::uniform2ivMethodCustom(const v8::FunctionCallbackI nfo<v8::Value>& info)
714 { 714 {
715 ExceptionState exceptionState(ExceptionState::ExecutionContext, "uniform2iv" , "WebGLRenderingContextBase", info.Holder(), info.GetIsolate()); 715 ExceptionState exceptionState(ExceptionState::ExecutionContext, "uniform2iv" , "WebGLRenderingContext", info.Holder(), info.GetIsolate());
716 uniformHelperi(info, kUniform2v, exceptionState); 716 uniformHelperi(info, kUniform2v, exceptionState);
717 } 717 }
718 718
719 void V8WebGLRenderingContextBase::uniform3fvMethodCustom(const v8::FunctionCallb ackInfo<v8::Value>& info) 719 void V8WebGLRenderingContext::uniform3fvMethodCustom(const v8::FunctionCallbackI nfo<v8::Value>& info)
720 { 720 {
721 ExceptionState exceptionState(ExceptionState::ExecutionContext, "uniform3fv" , "WebGLRenderingContextBase", info.Holder(), info.GetIsolate()); 721 ExceptionState exceptionState(ExceptionState::ExecutionContext, "uniform3fv" , "WebGLRenderingContext", info.Holder(), info.GetIsolate());
722 vertexAttribAndUniformHelperf(info, kUniform3v, exceptionState); 722 vertexAttribAndUniformHelperf(info, kUniform3v, exceptionState);
723 } 723 }
724 724
725 void V8WebGLRenderingContextBase::uniform3ivMethodCustom(const v8::FunctionCallb ackInfo<v8::Value>& info) 725 void V8WebGLRenderingContext::uniform3ivMethodCustom(const v8::FunctionCallbackI nfo<v8::Value>& info)
726 { 726 {
727 ExceptionState exceptionState(ExceptionState::ExecutionContext, "uniform3iv" , "WebGLRenderingContextBase", info.Holder(), info.GetIsolate()); 727 ExceptionState exceptionState(ExceptionState::ExecutionContext, "uniform3iv" , "WebGLRenderingContext", info.Holder(), info.GetIsolate());
728 uniformHelperi(info, kUniform3v, exceptionState); 728 uniformHelperi(info, kUniform3v, exceptionState);
729 } 729 }
730 730
731 void V8WebGLRenderingContextBase::uniform4fvMethodCustom(const v8::FunctionCallb ackInfo<v8::Value>& info) 731 void V8WebGLRenderingContext::uniform4fvMethodCustom(const v8::FunctionCallbackI nfo<v8::Value>& info)
732 { 732 {
733 ExceptionState exceptionState(ExceptionState::ExecutionContext, "uniform4fv" , "WebGLRenderingContextBase", info.Holder(), info.GetIsolate()); 733 ExceptionState exceptionState(ExceptionState::ExecutionContext, "uniform4fv" , "WebGLRenderingContext", info.Holder(), info.GetIsolate());
734 vertexAttribAndUniformHelperf(info, kUniform4v, exceptionState); 734 vertexAttribAndUniformHelperf(info, kUniform4v, exceptionState);
735 } 735 }
736 736
737 void V8WebGLRenderingContextBase::uniform4ivMethodCustom(const v8::FunctionCallb ackInfo<v8::Value>& info) 737 void V8WebGLRenderingContext::uniform4ivMethodCustom(const v8::FunctionCallbackI nfo<v8::Value>& info)
738 { 738 {
739 ExceptionState exceptionState(ExceptionState::ExecutionContext, "uniform4iv" , "WebGLRenderingContextBase", info.Holder(), info.GetIsolate()); 739 ExceptionState exceptionState(ExceptionState::ExecutionContext, "uniform4iv" , "WebGLRenderingContext", info.Holder(), info.GetIsolate());
740 uniformHelperi(info, kUniform4v, exceptionState); 740 uniformHelperi(info, kUniform4v, exceptionState);
741 } 741 }
742 742
743 static void uniformMatrixHelper(const v8::FunctionCallbackInfo<v8::Value>& info, int matrixSize, ExceptionState& exceptionState) 743 static void uniformMatrixHelper(const v8::FunctionCallbackInfo<v8::Value>& info, int matrixSize, ExceptionState& exceptionState)
744 { 744 {
745 // Forms: 745 // Forms:
746 // * glUniformMatrix2fv(GLint location, GLboolean transpose, Array data); 746 // * glUniformMatrix2fv(GLint location, GLboolean transpose, Array data);
747 // * glUniformMatrix2fv(GLint location, GLboolean transpose, Float32Array da ta); 747 // * glUniformMatrix2fv(GLint location, GLboolean transpose, Float32Array da ta);
748 // * glUniformMatrix3fv(GLint location, GLboolean transpose, Array data); 748 // * glUniformMatrix3fv(GLint location, GLboolean transpose, Array data);
749 // * glUniformMatrix3fv(GLint location, GLboolean transpose, Float32Array da ta); 749 // * glUniformMatrix3fv(GLint location, GLboolean transpose, Float32Array da ta);
750 // * glUniformMatrix4fv(GLint location, GLboolean transpose, Array data); 750 // * glUniformMatrix4fv(GLint location, GLboolean transpose, Array data);
751 // * glUniformMatrix4fv(GLint location, GLboolean transpose, Float32Array da ta); 751 // * glUniformMatrix4fv(GLint location, GLboolean transpose, Float32Array da ta);
752 // 752 //
753 // FIXME: need to change to accept Float32Array as well. 753 // FIXME: need to change to accept Float32Array as well.
754 if (info.Length() != 3) { 754 if (info.Length() != 3) {
755 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(3, i nfo.Length())); 755 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(3, i nfo.Length()));
756 exceptionState.throwIfNeeded(); 756 exceptionState.throwIfNeeded();
757 return; 757 return;
758 } 758 }
759 759
760 WebGLRenderingContextBase* context = V8WebGLRenderingContextBase::toNative(i nfo.Holder()); 760 WebGLRenderingContext* context = V8WebGLRenderingContext::toNative(info.Hold er());
761 761
762 const int uniformLocationArgumentIndex = 0; 762 const int uniformLocationArgumentIndex = 0;
763 if (info.Length() > 0 && !isUndefinedOrNull(info[uniformLocationArgumentInde x]) && !V8WebGLUniformLocation::hasInstance(info[uniformLocationArgumentIndex], info.GetIsolate())) { 763 if (info.Length() > 0 && !isUndefinedOrNull(info[uniformLocationArgumentInde x]) && !V8WebGLUniformLocation::hasInstance(info[uniformLocationArgumentIndex], info.GetIsolate())) {
764 exceptionState.throwTypeError(ExceptionMessages::argumentNullOrIncorrect Type(uniformLocationArgumentIndex + 1, "WebGLUniformLocation")); 764 exceptionState.throwTypeError(ExceptionMessages::argumentNullOrIncorrect Type(uniformLocationArgumentIndex + 1, "WebGLUniformLocation"));
765 exceptionState.throwIfNeeded(); 765 exceptionState.throwIfNeeded();
766 return; 766 return;
767 } 767 }
768 WebGLUniformLocation* location = toWebGLUniformLocation(info[uniformLocation ArgumentIndex], info.GetIsolate()); 768 WebGLUniformLocation* location = toWebGLUniformLocation(info[uniformLocation ArgumentIndex], info.GetIsolate());
769 769
770 bool transpose = info[1]->BooleanValue(); 770 bool transpose = info[1]->BooleanValue();
(...skipping 28 matching lines...) Expand all
799 } 799 }
800 switch (matrixSize) { 800 switch (matrixSize) {
801 case 2: context->uniformMatrix2fv(location, transpose, data, len); break; 801 case 2: context->uniformMatrix2fv(location, transpose, data, len); break;
802 case 3: context->uniformMatrix3fv(location, transpose, data, len); break; 802 case 3: context->uniformMatrix3fv(location, transpose, data, len); break;
803 case 4: context->uniformMatrix4fv(location, transpose, data, len); break; 803 case 4: context->uniformMatrix4fv(location, transpose, data, len); break;
804 default: ASSERT_NOT_REACHED(); break; 804 default: ASSERT_NOT_REACHED(); break;
805 } 805 }
806 fastFree(data); 806 fastFree(data);
807 } 807 }
808 808
809 void V8WebGLRenderingContextBase::uniformMatrix2fvMethodCustom(const v8::Functio nCallbackInfo<v8::Value>& info) 809 void V8WebGLRenderingContext::uniformMatrix2fvMethodCustom(const v8::FunctionCal lbackInfo<v8::Value>& info)
810 { 810 {
811 ExceptionState exceptionState(ExceptionState::ExecutionContext, "uniformMatr ix2fv", "WebGLRenderingContextBase", info.Holder(), info.GetIsolate()); 811 ExceptionState exceptionState(ExceptionState::ExecutionContext, "uniformMatr ix2fv", "WebGLRenderingContext", info.Holder(), info.GetIsolate());
812 uniformMatrixHelper(info, 2, exceptionState); 812 uniformMatrixHelper(info, 2, exceptionState);
813 } 813 }
814 814
815 void V8WebGLRenderingContextBase::uniformMatrix3fvMethodCustom(const v8::Functio nCallbackInfo<v8::Value>& info) 815 void V8WebGLRenderingContext::uniformMatrix3fvMethodCustom(const v8::FunctionCal lbackInfo<v8::Value>& info)
816 { 816 {
817 ExceptionState exceptionState(ExceptionState::ExecutionContext, "uniformMatr ix3fv", "WebGLRenderingContextBase", info.Holder(), info.GetIsolate()); 817 ExceptionState exceptionState(ExceptionState::ExecutionContext, "uniformMatr ix3fv", "WebGLRenderingContext", info.Holder(), info.GetIsolate());
818 uniformMatrixHelper(info, 3, exceptionState); 818 uniformMatrixHelper(info, 3, exceptionState);
819 } 819 }
820 820
821 void V8WebGLRenderingContextBase::uniformMatrix4fvMethodCustom(const v8::Functio nCallbackInfo<v8::Value>& info) 821 void V8WebGLRenderingContext::uniformMatrix4fvMethodCustom(const v8::FunctionCal lbackInfo<v8::Value>& info)
822 { 822 {
823 ExceptionState exceptionState(ExceptionState::ExecutionContext, "uniformMatr ix4fv", "WebGLRenderingContextBase", info.Holder(), info.GetIsolate()); 823 ExceptionState exceptionState(ExceptionState::ExecutionContext, "uniformMatr ix4fv", "WebGLRenderingContext", info.Holder(), info.GetIsolate());
824 uniformMatrixHelper(info, 4, exceptionState); 824 uniformMatrixHelper(info, 4, exceptionState);
825 } 825 }
826 826
827 void V8WebGLRenderingContextBase::vertexAttrib1fvMethodCustom(const v8::Function CallbackInfo<v8::Value>& info) 827 void V8WebGLRenderingContext::vertexAttrib1fvMethodCustom(const v8::FunctionCall backInfo<v8::Value>& info)
828 { 828 {
829 ExceptionState exceptionState(ExceptionState::ExecutionContext, "vertexAttri b1fv", "WebGLRenderingContextBase", info.Holder(), info.GetIsolate()); 829 ExceptionState exceptionState(ExceptionState::ExecutionContext, "vertexAttri b1fv", "WebGLRenderingContext", info.Holder(), info.GetIsolate());
830 vertexAttribAndUniformHelperf(info, kVertexAttrib1v, exceptionState); 830 vertexAttribAndUniformHelperf(info, kVertexAttrib1v, exceptionState);
831 } 831 }
832 832
833 void V8WebGLRenderingContextBase::vertexAttrib2fvMethodCustom(const v8::Function CallbackInfo<v8::Value>& info) 833 void V8WebGLRenderingContext::vertexAttrib2fvMethodCustom(const v8::FunctionCall backInfo<v8::Value>& info)
834 { 834 {
835 ExceptionState exceptionState(ExceptionState::ExecutionContext, "vertexAttri b2fv", "WebGLRenderingContextBase", info.Holder(), info.GetIsolate()); 835 ExceptionState exceptionState(ExceptionState::ExecutionContext, "vertexAttri b2fv", "WebGLRenderingContext", info.Holder(), info.GetIsolate());
836 vertexAttribAndUniformHelperf(info, kVertexAttrib2v, exceptionState); 836 vertexAttribAndUniformHelperf(info, kVertexAttrib2v, exceptionState);
837 } 837 }
838 838
839 void V8WebGLRenderingContextBase::vertexAttrib3fvMethodCustom(const v8::Function CallbackInfo<v8::Value>& info) 839 void V8WebGLRenderingContext::vertexAttrib3fvMethodCustom(const v8::FunctionCall backInfo<v8::Value>& info)
840 { 840 {
841 ExceptionState exceptionState(ExceptionState::ExecutionContext, "vertexAttri b3fv", "WebGLRenderingContextBase", info.Holder(), info.GetIsolate()); 841 ExceptionState exceptionState(ExceptionState::ExecutionContext, "vertexAttri b3fv", "WebGLRenderingContext", info.Holder(), info.GetIsolate());
842 vertexAttribAndUniformHelperf(info, kVertexAttrib3v, exceptionState); 842 vertexAttribAndUniformHelperf(info, kVertexAttrib3v, exceptionState);
843 } 843 }
844 844
845 void V8WebGLRenderingContextBase::vertexAttrib4fvMethodCustom(const v8::Function CallbackInfo<v8::Value>& info) 845 void V8WebGLRenderingContext::vertexAttrib4fvMethodCustom(const v8::FunctionCall backInfo<v8::Value>& info)
846 { 846 {
847 ExceptionState exceptionState(ExceptionState::ExecutionContext, "vertexAttri b4fv", "WebGLRenderingContextBase", info.Holder(), info.GetIsolate()); 847 ExceptionState exceptionState(ExceptionState::ExecutionContext, "vertexAttri b4fv", "WebGLRenderingContext", info.Holder(), info.GetIsolate());
848 vertexAttribAndUniformHelperf(info, kVertexAttrib4v, exceptionState); 848 vertexAttribAndUniformHelperf(info, kVertexAttrib4v, exceptionState);
849 } 849 }
850 850
851 } // namespace WebCore 851 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/bindings/v8/custom/V8WebGLRenderingContextBaseCustom.cpp ('k') | Source/core/core.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698