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

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

Issue 537403002: bindings: Renames from/toInternalPointer, etc. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Synced. Created 6 years, 3 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 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 }; 284 };
285 285
286 static void getObjectParameter(const v8::FunctionCallbackInfo<v8::Value>& info, ObjectType objectType, ExceptionState& exceptionState) 286 static void getObjectParameter(const v8::FunctionCallbackInfo<v8::Value>& info, ObjectType objectType, ExceptionState& exceptionState)
287 { 287 {
288 if (info.Length() != 2) { 288 if (info.Length() != 2) {
289 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(2, i nfo.Length())); 289 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(2, i nfo.Length()));
290 exceptionState.throwIfNeeded(); 290 exceptionState.throwIfNeeded();
291 return; 291 return;
292 } 292 }
293 293
294 WebGLRenderingContext* context = V8WebGLRenderingContext::toNative(info.Hold er()); 294 WebGLRenderingContext* context = V8WebGLRenderingContext::toImpl(info.Holder ());
295 unsigned target; 295 unsigned target;
296 unsigned pname; 296 unsigned pname;
297 { 297 {
298 v8::TryCatch block; 298 v8::TryCatch block;
299 V8RethrowTryCatchScope rethrow(block); 299 V8RethrowTryCatchScope rethrow(block);
300 TONATIVE_VOID_EXCEPTIONSTATE_INTERNAL(target, toUInt32(info[0], exceptio nState), exceptionState); 300 TONATIVE_VOID_EXCEPTIONSTATE_INTERNAL(target, toUInt32(info[0], exceptio nState), exceptionState);
301 TONATIVE_VOID_EXCEPTIONSTATE_INTERNAL(pname, toUInt32(info[1], exception State), exceptionState); 301 TONATIVE_VOID_EXCEPTIONSTATE_INTERNAL(pname, toUInt32(info[1], exception State), exceptionState);
302 } 302 }
303 WebGLGetInfo args; 303 WebGLGetInfo args;
304 switch (objectType) { 304 switch (objectType) {
(...skipping 12 matching lines...) Expand all
317 break; 317 break;
318 default: 318 default:
319 notImplemented(); 319 notImplemented();
320 break; 320 break;
321 } 321 }
322 v8SetReturnValue(info, toV8Object(args, info.Holder(), info.GetIsolate())); 322 v8SetReturnValue(info, toV8Object(args, info.Holder(), info.GetIsolate()));
323 } 323 }
324 324
325 static WebGLUniformLocation* toWebGLUniformLocation(v8::Handle<v8::Value> value, v8::Isolate* isolate) 325 static WebGLUniformLocation* toWebGLUniformLocation(v8::Handle<v8::Value> value, v8::Isolate* isolate)
326 { 326 {
327 return V8WebGLUniformLocation::toNativeWithTypeCheck(isolate, value); 327 return V8WebGLUniformLocation::toImplWithTypeCheck(isolate, value);
328 } 328 }
329 329
330 void V8WebGLRenderingContext::getBufferParameterMethodCustom(const v8::FunctionC allbackInfo<v8::Value>& info) 330 void V8WebGLRenderingContext::getBufferParameterMethodCustom(const v8::FunctionC allbackInfo<v8::Value>& info)
331 { 331 {
332 ExceptionState exceptionState(ExceptionState::ExecutionContext, "getBufferPa rameter", "WebGLRenderingContext", info.Holder(), info.GetIsolate()); 332 ExceptionState exceptionState(ExceptionState::ExecutionContext, "getBufferPa rameter", "WebGLRenderingContext", info.Holder(), info.GetIsolate());
333 getObjectParameter(info, kBuffer, exceptionState); 333 getObjectParameter(info, kBuffer, exceptionState);
334 } 334 }
335 335
336 void V8WebGLRenderingContext::getExtensionMethodCustom(const v8::FunctionCallbac kInfo<v8::Value>& info) 336 void V8WebGLRenderingContext::getExtensionMethodCustom(const v8::FunctionCallbac kInfo<v8::Value>& info)
337 { 337 {
338 ExceptionState exceptionState(ExceptionState::ExecutionContext, "getExtensio n", "WebGLRenderingContext", info.Holder(), info.GetIsolate()); 338 ExceptionState exceptionState(ExceptionState::ExecutionContext, "getExtensio n", "WebGLRenderingContext", info.Holder(), info.GetIsolate());
339 WebGLRenderingContext* impl = V8WebGLRenderingContext::toNative(info.Holder( )); 339 WebGLRenderingContext* impl = V8WebGLRenderingContext::toImpl(info.Holder()) ;
340 if (info.Length() < 1) { 340 if (info.Length() < 1) {
341 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(1, i nfo.Length())); 341 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(1, i nfo.Length()));
342 exceptionState.throwIfNeeded(); 342 exceptionState.throwIfNeeded();
343 return; 343 return;
344 } 344 }
345 TOSTRING_VOID(V8StringResource<>, name, info[0]); 345 TOSTRING_VOID(V8StringResource<>, name, info[0]);
346 RefPtrWillBeRawPtr<WebGLExtension> extension(impl->getExtension(name)); 346 RefPtrWillBeRawPtr<WebGLExtension> extension(impl->getExtension(name));
347 v8SetReturnValue(info, toV8Object(extension.get(), info.Holder(), info.GetIs olate())); 347 v8SetReturnValue(info, toV8Object(extension.get(), info.Holder(), info.GetIs olate()));
348 } 348 }
349 349
350 void V8WebGLRenderingContext::getFramebufferAttachmentParameterMethodCustom(cons t v8::FunctionCallbackInfo<v8::Value>& info) 350 void V8WebGLRenderingContext::getFramebufferAttachmentParameterMethodCustom(cons t v8::FunctionCallbackInfo<v8::Value>& info)
351 { 351 {
352 ExceptionState exceptionState(ExceptionState::ExecutionContext, "getFramebuf ferAttachmentParameter", "WebGLRenderingContext", info.Holder(), info.GetIsolate ()); 352 ExceptionState exceptionState(ExceptionState::ExecutionContext, "getFramebuf ferAttachmentParameter", "WebGLRenderingContext", info.Holder(), info.GetIsolate ());
353 if (info.Length() != 3) { 353 if (info.Length() != 3) {
354 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(3, i nfo.Length())); 354 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(3, i nfo.Length()));
355 exceptionState.throwIfNeeded(); 355 exceptionState.throwIfNeeded();
356 return; 356 return;
357 } 357 }
358 358
359 WebGLRenderingContext* context = V8WebGLRenderingContext::toNative(info.Hold er()); 359 WebGLRenderingContext* context = V8WebGLRenderingContext::toImpl(info.Holder ());
360 unsigned target; 360 unsigned target;
361 unsigned attachment; 361 unsigned attachment;
362 unsigned pname; 362 unsigned pname;
363 { 363 {
364 v8::TryCatch block; 364 v8::TryCatch block;
365 V8RethrowTryCatchScope rethrow(block); 365 V8RethrowTryCatchScope rethrow(block);
366 TONATIVE_VOID_EXCEPTIONSTATE_INTERNAL(target, toUInt32(info[0], exceptio nState), exceptionState); 366 TONATIVE_VOID_EXCEPTIONSTATE_INTERNAL(target, toUInt32(info[0], exceptio nState), exceptionState);
367 TONATIVE_VOID_EXCEPTIONSTATE_INTERNAL(attachment, toUInt32(info[1], exce ptionState), exceptionState); 367 TONATIVE_VOID_EXCEPTIONSTATE_INTERNAL(attachment, toUInt32(info[1], exce ptionState), exceptionState);
368 TONATIVE_VOID_EXCEPTIONSTATE_INTERNAL(pname, toUInt32(info[2], exception State), exceptionState); 368 TONATIVE_VOID_EXCEPTIONSTATE_INTERNAL(pname, toUInt32(info[2], exception State), exceptionState);
369 } 369 }
370 WebGLGetInfo args = context->getFramebufferAttachmentParameter(target, attac hment, pname); 370 WebGLGetInfo args = context->getFramebufferAttachmentParameter(target, attac hment, pname);
371 v8SetReturnValue(info, toV8Object(args, info.Holder(), info.GetIsolate())); 371 v8SetReturnValue(info, toV8Object(args, info.Holder(), info.GetIsolate()));
372 } 372 }
373 373
374 void V8WebGLRenderingContext::getParameterMethodCustom(const v8::FunctionCallbac kInfo<v8::Value>& info) 374 void V8WebGLRenderingContext::getParameterMethodCustom(const v8::FunctionCallbac kInfo<v8::Value>& info)
375 { 375 {
376 ExceptionState exceptionState(ExceptionState::ExecutionContext, "getParamete r", "WebGLRenderingContext", info.Holder(), info.GetIsolate()); 376 ExceptionState exceptionState(ExceptionState::ExecutionContext, "getParamete r", "WebGLRenderingContext", info.Holder(), info.GetIsolate());
377 if (info.Length() != 1) { 377 if (info.Length() != 1) {
378 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(1, i nfo.Length())); 378 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(1, i nfo.Length()));
379 exceptionState.throwIfNeeded(); 379 exceptionState.throwIfNeeded();
380 return; 380 return;
381 } 381 }
382 382
383 WebGLRenderingContext* context = V8WebGLRenderingContext::toNative(info.Hold er()); 383 WebGLRenderingContext* context = V8WebGLRenderingContext::toImpl(info.Holder ());
384 unsigned pname; 384 unsigned pname;
385 { 385 {
386 v8::TryCatch block; 386 v8::TryCatch block;
387 V8RethrowTryCatchScope rethrow(block); 387 V8RethrowTryCatchScope rethrow(block);
388 TONATIVE_VOID_EXCEPTIONSTATE_INTERNAL(pname, toUInt32(info[0], exception State), exceptionState); 388 TONATIVE_VOID_EXCEPTIONSTATE_INTERNAL(pname, toUInt32(info[0], exception State), exceptionState);
389 } 389 }
390 WebGLGetInfo args = context->getParameter(pname); 390 WebGLGetInfo args = context->getParameter(pname);
391 v8SetReturnValue(info, toV8Object(args, info.Holder(), info.GetIsolate())); 391 v8SetReturnValue(info, toV8Object(args, info.Holder(), info.GetIsolate()));
392 } 392 }
393 393
394 void V8WebGLRenderingContext::getProgramParameterMethodCustom(const v8::Function CallbackInfo<v8::Value>& info) 394 void V8WebGLRenderingContext::getProgramParameterMethodCustom(const v8::Function CallbackInfo<v8::Value>& info)
395 { 395 {
396 ExceptionState exceptionState(ExceptionState::ExecutionContext, "getProgramP arameter", "WebGLRenderingContext", info.Holder(), info.GetIsolate()); 396 ExceptionState exceptionState(ExceptionState::ExecutionContext, "getProgramP arameter", "WebGLRenderingContext", info.Holder(), info.GetIsolate());
397 if (info.Length() != 2) { 397 if (info.Length() != 2) {
398 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(2, i nfo.Length())); 398 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(2, i nfo.Length()));
399 exceptionState.throwIfNeeded(); 399 exceptionState.throwIfNeeded();
400 return; 400 return;
401 } 401 }
402 402
403 WebGLRenderingContext* context = V8WebGLRenderingContext::toNative(info.Hold er()); 403 WebGLRenderingContext* context = V8WebGLRenderingContext::toImpl(info.Holder ());
404 WebGLProgram* program; 404 WebGLProgram* program;
405 unsigned pname; 405 unsigned pname;
406 { 406 {
407 v8::TryCatch block; 407 v8::TryCatch block;
408 V8RethrowTryCatchScope rethrow(block); 408 V8RethrowTryCatchScope rethrow(block);
409 if (info.Length() > 0 && !isUndefinedOrNull(info[0]) && !V8WebGLProgram: :hasInstance(info[0], info.GetIsolate())) { 409 if (info.Length() > 0 && !isUndefinedOrNull(info[0]) && !V8WebGLProgram: :hasInstance(info[0], info.GetIsolate())) {
410 exceptionState.throwTypeError("parameter 1 is not of type 'WebGLProg ram'."); 410 exceptionState.throwTypeError("parameter 1 is not of type 'WebGLProg ram'.");
411 exceptionState.throwIfNeeded(); 411 exceptionState.throwIfNeeded();
412 return; 412 return;
413 } 413 }
414 TONATIVE_VOID_INTERNAL(program, V8WebGLProgram::toNativeWithTypeCheck(in fo.GetIsolate(), info[0])); 414 TONATIVE_VOID_INTERNAL(program, V8WebGLProgram::toImplWithTypeCheck(info .GetIsolate(), info[0]));
415 TONATIVE_VOID_EXCEPTIONSTATE_INTERNAL(pname, toUInt32(info[1], exception State), exceptionState); 415 TONATIVE_VOID_EXCEPTIONSTATE_INTERNAL(pname, toUInt32(info[1], exception State), exceptionState);
416 } 416 }
417 WebGLGetInfo args = context->getProgramParameter(program, pname); 417 WebGLGetInfo args = context->getProgramParameter(program, pname);
418 v8SetReturnValue(info, toV8Object(args, info.Holder(), info.GetIsolate())); 418 v8SetReturnValue(info, toV8Object(args, info.Holder(), info.GetIsolate()));
419 } 419 }
420 420
421 void V8WebGLRenderingContext::getRenderbufferParameterMethodCustom(const v8::Fun ctionCallbackInfo<v8::Value>& info) 421 void V8WebGLRenderingContext::getRenderbufferParameterMethodCustom(const v8::Fun ctionCallbackInfo<v8::Value>& info)
422 { 422 {
423 ExceptionState exceptionState(ExceptionState::ExecutionContext, "getRenderbu fferParameter", "WebGLRenderingContext", info.Holder(), info.GetIsolate()); 423 ExceptionState exceptionState(ExceptionState::ExecutionContext, "getRenderbu fferParameter", "WebGLRenderingContext", info.Holder(), info.GetIsolate());
424 getObjectParameter(info, kRenderbuffer, exceptionState); 424 getObjectParameter(info, kRenderbuffer, exceptionState);
425 } 425 }
426 426
427 void V8WebGLRenderingContext::getShaderParameterMethodCustom(const v8::FunctionC allbackInfo<v8::Value>& info) 427 void V8WebGLRenderingContext::getShaderParameterMethodCustom(const v8::FunctionC allbackInfo<v8::Value>& info)
428 { 428 {
429 ExceptionState exceptionState(ExceptionState::ExecutionContext, "getShaderPa rameter", "WebGLRenderingContext", info.Holder(), info.GetIsolate()); 429 ExceptionState exceptionState(ExceptionState::ExecutionContext, "getShaderPa rameter", "WebGLRenderingContext", info.Holder(), info.GetIsolate());
430 if (info.Length() != 2) { 430 if (info.Length() != 2) {
431 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(2, i nfo.Length())); 431 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(2, i nfo.Length()));
432 exceptionState.throwIfNeeded(); 432 exceptionState.throwIfNeeded();
433 return; 433 return;
434 } 434 }
435 435
436 WebGLRenderingContext* context = V8WebGLRenderingContext::toNative(info.Hold er()); 436 WebGLRenderingContext* context = V8WebGLRenderingContext::toImpl(info.Holder ());
437 WebGLShader* shader; 437 WebGLShader* shader;
438 unsigned pname; 438 unsigned pname;
439 { 439 {
440 v8::TryCatch block; 440 v8::TryCatch block;
441 V8RethrowTryCatchScope rethrow(block); 441 V8RethrowTryCatchScope rethrow(block);
442 if (info.Length() > 0 && !isUndefinedOrNull(info[0]) && !V8WebGLShader:: hasInstance(info[0], info.GetIsolate())) { 442 if (info.Length() > 0 && !isUndefinedOrNull(info[0]) && !V8WebGLShader:: hasInstance(info[0], info.GetIsolate())) {
443 exceptionState.throwTypeError("parameter 1 is not of type 'WebGLShad er'."); 443 exceptionState.throwTypeError("parameter 1 is not of type 'WebGLShad er'.");
444 exceptionState.throwIfNeeded(); 444 exceptionState.throwIfNeeded();
445 return; 445 return;
446 } 446 }
447 TONATIVE_VOID_INTERNAL(shader, V8WebGLShader::toNativeWithTypeCheck(info .GetIsolate(), info[0])); 447 TONATIVE_VOID_INTERNAL(shader, V8WebGLShader::toImplWithTypeCheck(info.G etIsolate(), info[0]));
448 TONATIVE_VOID_EXCEPTIONSTATE_INTERNAL(pname, toUInt32(info[1], exception State), exceptionState); 448 TONATIVE_VOID_EXCEPTIONSTATE_INTERNAL(pname, toUInt32(info[1], exception State), exceptionState);
449 } 449 }
450 WebGLGetInfo args = context->getShaderParameter(shader, pname); 450 WebGLGetInfo args = context->getShaderParameter(shader, pname);
451 v8SetReturnValue(info, toV8Object(args, info.Holder(), info.GetIsolate())); 451 v8SetReturnValue(info, toV8Object(args, info.Holder(), info.GetIsolate()));
452 } 452 }
453 453
454 void V8WebGLRenderingContext::getTexParameterMethodCustom(const v8::FunctionCall backInfo<v8::Value>& info) 454 void V8WebGLRenderingContext::getTexParameterMethodCustom(const v8::FunctionCall backInfo<v8::Value>& info)
455 { 455 {
456 ExceptionState exceptionState(ExceptionState::ExecutionContext, "getTexParam eter", "WebGLRenderingContext", info.Holder(), info.GetIsolate()); 456 ExceptionState exceptionState(ExceptionState::ExecutionContext, "getTexParam eter", "WebGLRenderingContext", info.Holder(), info.GetIsolate());
457 getObjectParameter(info, kTexture, exceptionState); 457 getObjectParameter(info, kTexture, exceptionState);
458 } 458 }
459 459
460 void V8WebGLRenderingContext::getUniformMethodCustom(const v8::FunctionCallbackI nfo<v8::Value>& info) 460 void V8WebGLRenderingContext::getUniformMethodCustom(const v8::FunctionCallbackI nfo<v8::Value>& info)
461 { 461 {
462 ExceptionState exceptionState(ExceptionState::ExecutionContext, "getUniform" , "WebGLRenderingContext", info.Holder(), info.GetIsolate()); 462 ExceptionState exceptionState(ExceptionState::ExecutionContext, "getUniform" , "WebGLRenderingContext", info.Holder(), info.GetIsolate());
463 if (info.Length() != 2) { 463 if (info.Length() != 2) {
464 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(2, i nfo.Length())); 464 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(2, i nfo.Length()));
465 exceptionState.throwIfNeeded(); 465 exceptionState.throwIfNeeded();
466 return; 466 return;
467 } 467 }
468 468
469 WebGLRenderingContext* context = V8WebGLRenderingContext::toNative(info.Hold er()); 469 WebGLRenderingContext* context = V8WebGLRenderingContext::toImpl(info.Holder ());
470 WebGLProgram* program; 470 WebGLProgram* program;
471 WebGLUniformLocation* location; 471 WebGLUniformLocation* location;
472 { 472 {
473 v8::TryCatch block; 473 v8::TryCatch block;
474 V8RethrowTryCatchScope rethrow(block); 474 V8RethrowTryCatchScope rethrow(block);
475 if (info.Length() > 0 && !isUndefinedOrNull(info[0]) && !V8WebGLProgram: :hasInstance(info[0], info.GetIsolate())) { 475 if (info.Length() > 0 && !isUndefinedOrNull(info[0]) && !V8WebGLProgram: :hasInstance(info[0], info.GetIsolate())) {
476 V8ThrowException::throwTypeError(ExceptionMessages::failedToExecute( "getUniform", "WebGLRenderingContext", "parameter 1 is not of type 'WebGLProgram '."), info.GetIsolate()); 476 V8ThrowException::throwTypeError(ExceptionMessages::failedToExecute( "getUniform", "WebGLRenderingContext", "parameter 1 is not of type 'WebGLProgram '."), info.GetIsolate());
477 return; 477 return;
478 } 478 }
479 TONATIVE_VOID_INTERNAL(program, V8WebGLProgram::toNativeWithTypeCheck(in fo.GetIsolate(), info[0])); 479 TONATIVE_VOID_INTERNAL(program, V8WebGLProgram::toImplWithTypeCheck(info .GetIsolate(), info[0]));
480 if (info.Length() > 1 && !isUndefinedOrNull(info[1]) && !V8WebGLUniformL ocation::hasInstance(info[1], info.GetIsolate())) { 480 if (info.Length() > 1 && !isUndefinedOrNull(info[1]) && !V8WebGLUniformL ocation::hasInstance(info[1], info.GetIsolate())) {
481 V8ThrowException::throwTypeError(ExceptionMessages::failedToExecute( "getUniform", "WebGLRenderingContext", "parameter 2 is not of type 'WebGLUniform Location'."), info.GetIsolate()); 481 V8ThrowException::throwTypeError(ExceptionMessages::failedToExecute( "getUniform", "WebGLRenderingContext", "parameter 2 is not of type 'WebGLUniform Location'."), info.GetIsolate());
482 return; 482 return;
483 } 483 }
484 TONATIVE_VOID_INTERNAL(location, V8WebGLUniformLocation::toNativeWithTyp eCheck(info.GetIsolate(), info[1])); 484 TONATIVE_VOID_INTERNAL(location, V8WebGLUniformLocation::toImplWithTypeC heck(info.GetIsolate(), info[1]));
485 } 485 }
486 WebGLGetInfo args = context->getUniform(program, location); 486 WebGLGetInfo args = context->getUniform(program, location);
487 v8SetReturnValue(info, toV8Object(args, info.Holder(), info.GetIsolate())); 487 v8SetReturnValue(info, toV8Object(args, info.Holder(), info.GetIsolate()));
488 } 488 }
489 489
490 void V8WebGLRenderingContext::getVertexAttribMethodCustom(const v8::FunctionCall backInfo<v8::Value>& info) 490 void V8WebGLRenderingContext::getVertexAttribMethodCustom(const v8::FunctionCall backInfo<v8::Value>& info)
491 { 491 {
492 ExceptionState exceptionState(ExceptionState::ExecutionContext, "getVertexAt trib", "WebGLRenderingContext", info.Holder(), info.GetIsolate()); 492 ExceptionState exceptionState(ExceptionState::ExecutionContext, "getVertexAt trib", "WebGLRenderingContext", info.Holder(), info.GetIsolate());
493 getObjectParameter(info, kVertexAttrib, exceptionState); 493 getObjectParameter(info, kVertexAttrib, exceptionState);
494 } 494 }
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
548 } else { 548 } else {
549 const int uniformLocationArgumentIndex = 0; 549 const int uniformLocationArgumentIndex = 0;
550 if (info.Length() > 0 && !isUndefinedOrNull(info[uniformLocationArgument Index]) && !V8WebGLUniformLocation::hasInstance(info[uniformLocationArgumentInde x], info.GetIsolate())) { 550 if (info.Length() > 0 && !isUndefinedOrNull(info[uniformLocationArgument Index]) && !V8WebGLUniformLocation::hasInstance(info[uniformLocationArgumentInde x], info.GetIsolate())) {
551 exceptionState.throwTypeError(ExceptionMessages::argumentNullOrIncor rectType(uniformLocationArgumentIndex + 1, "WebGLUniformLocation")); 551 exceptionState.throwTypeError(ExceptionMessages::argumentNullOrIncor rectType(uniformLocationArgumentIndex + 1, "WebGLUniformLocation"));
552 exceptionState.throwIfNeeded(); 552 exceptionState.throwIfNeeded();
553 return; 553 return;
554 } 554 }
555 location = toWebGLUniformLocation(info[uniformLocationArgumentIndex], in fo.GetIsolate()); 555 location = toWebGLUniformLocation(info[uniformLocationArgumentIndex], in fo.GetIsolate());
556 } 556 }
557 557
558 WebGLRenderingContext* context = V8WebGLRenderingContext::toNative(info.Hold er()); 558 WebGLRenderingContext* context = V8WebGLRenderingContext::toImpl(info.Holder ());
559 559
560 const int indexArrayArgument = 1; 560 const int indexArrayArgument = 1;
561 if (V8Float32Array::hasInstance(info[indexArrayArgument], info.GetIsolate()) ) { 561 if (V8Float32Array::hasInstance(info[indexArrayArgument], info.GetIsolate()) ) {
562 Float32Array* array = V8Float32Array::toNative(info[indexArrayArgument]- >ToObject()); 562 Float32Array* array = V8Float32Array::toImpl(info[indexArrayArgument]->T oObject());
563 ASSERT(array); 563 ASSERT(array);
564 switch (functionToCall) { 564 switch (functionToCall) {
565 case kUniform1v: context->uniform1fv(location, array); break; 565 case kUniform1v: context->uniform1fv(location, array); break;
566 case kUniform2v: context->uniform2fv(location, array); break; 566 case kUniform2v: context->uniform2fv(location, array); break;
567 case kUniform3v: context->uniform3fv(location, array); break; 567 case kUniform3v: context->uniform3fv(location, array); break;
568 case kUniform4v: context->uniform4fv(location, array); break; 568 case kUniform4v: context->uniform4fv(location, array); break;
569 case kVertexAttrib1v: context->vertexAttrib1fv(index, array); break; 569 case kVertexAttrib1v: context->vertexAttrib1fv(index, array); break;
570 case kVertexAttrib2v: context->vertexAttrib2fv(index, array); break; 570 case kVertexAttrib2v: context->vertexAttrib2fv(index, array); break;
571 case kVertexAttrib3v: context->vertexAttrib3fv(index, array); break; 571 case kVertexAttrib3v: context->vertexAttrib3fv(index, array); break;
572 case kVertexAttrib4v: context->vertexAttrib4fv(index, array); break; 572 case kVertexAttrib4v: context->vertexAttrib4fv(index, array); break;
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
617 // * glUniform4iv(GLUniformLocation location, Array data); 617 // * glUniform4iv(GLUniformLocation location, Array data);
618 // * glUniform4iv(GLUniformLocation location, Int32Array data); 618 // * glUniform4iv(GLUniformLocation location, Int32Array data);
619 619
620 if (info.Length() != 2) { 620 if (info.Length() != 2) {
621 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(2, i nfo.Length())); 621 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(2, i nfo.Length()));
622 exceptionState.throwIfNeeded(); 622 exceptionState.throwIfNeeded();
623 return; 623 return;
624 } 624 }
625 625
626 const int uniformLocationArgumentIndex = 0; 626 const int uniformLocationArgumentIndex = 0;
627 WebGLRenderingContext* context = V8WebGLRenderingContext::toNative(info.Hold er()); 627 WebGLRenderingContext* context = V8WebGLRenderingContext::toImpl(info.Holder ());
628 if (info.Length() > 0 && !isUndefinedOrNull(info[uniformLocationArgumentInde x]) && !V8WebGLUniformLocation::hasInstance(info[uniformLocationArgumentIndex], info.GetIsolate())) { 628 if (info.Length() > 0 && !isUndefinedOrNull(info[uniformLocationArgumentInde x]) && !V8WebGLUniformLocation::hasInstance(info[uniformLocationArgumentIndex], info.GetIsolate())) {
629 exceptionState.throwTypeError(ExceptionMessages::argumentNullOrIncorrect Type(uniformLocationArgumentIndex + 1, "WebGLUniformLocation")); 629 exceptionState.throwTypeError(ExceptionMessages::argumentNullOrIncorrect Type(uniformLocationArgumentIndex + 1, "WebGLUniformLocation"));
630 exceptionState.throwIfNeeded(); 630 exceptionState.throwIfNeeded();
631 return; 631 return;
632 } 632 }
633 WebGLUniformLocation* location = toWebGLUniformLocation(info[uniformLocation ArgumentIndex], info.GetIsolate()); 633 WebGLUniformLocation* location = toWebGLUniformLocation(info[uniformLocation ArgumentIndex], info.GetIsolate());
634 634
635 const int indexArrayArgumentIndex = 1; 635 const int indexArrayArgumentIndex = 1;
636 if (V8Int32Array::hasInstance(info[indexArrayArgumentIndex], info.GetIsolate ())) { 636 if (V8Int32Array::hasInstance(info[indexArrayArgumentIndex], info.GetIsolate ())) {
637 Int32Array* array = V8Int32Array::toNative(info[indexArrayArgumentIndex] ->ToObject()); 637 Int32Array* array = V8Int32Array::toImpl(info[indexArrayArgumentIndex]-> ToObject());
638 ASSERT(array); 638 ASSERT(array);
639 switch (functionToCall) { 639 switch (functionToCall) {
640 case kUniform1v: context->uniform1iv(location, array); break; 640 case kUniform1v: context->uniform1iv(location, array); break;
641 case kUniform2v: context->uniform2iv(location, array); break; 641 case kUniform2v: context->uniform2iv(location, array); break;
642 case kUniform3v: context->uniform3iv(location, array); break; 642 case kUniform3v: context->uniform3iv(location, array); break;
643 case kUniform4v: context->uniform4iv(location, array); break; 643 case kUniform4v: context->uniform4iv(location, array); break;
644 default: ASSERT_NOT_REACHED(); break; 644 default: ASSERT_NOT_REACHED(); break;
645 } 645 }
646 return; 646 return;
647 } 647 }
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
730 // * glUniformMatrix4fv(GLint location, GLboolean transpose, Array data); 730 // * glUniformMatrix4fv(GLint location, GLboolean transpose, Array data);
731 // * glUniformMatrix4fv(GLint location, GLboolean transpose, Float32Array da ta); 731 // * glUniformMatrix4fv(GLint location, GLboolean transpose, Float32Array da ta);
732 // 732 //
733 // FIXME: need to change to accept Float32Array as well. 733 // FIXME: need to change to accept Float32Array as well.
734 if (info.Length() != 3) { 734 if (info.Length() != 3) {
735 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(3, i nfo.Length())); 735 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(3, i nfo.Length()));
736 exceptionState.throwIfNeeded(); 736 exceptionState.throwIfNeeded();
737 return; 737 return;
738 } 738 }
739 739
740 WebGLRenderingContext* context = V8WebGLRenderingContext::toNative(info.Hold er()); 740 WebGLRenderingContext* context = V8WebGLRenderingContext::toImpl(info.Holder ());
741 741
742 const int uniformLocationArgumentIndex = 0; 742 const int uniformLocationArgumentIndex = 0;
743 if (info.Length() > 0 && !isUndefinedOrNull(info[uniformLocationArgumentInde x]) && !V8WebGLUniformLocation::hasInstance(info[uniformLocationArgumentIndex], info.GetIsolate())) { 743 if (info.Length() > 0 && !isUndefinedOrNull(info[uniformLocationArgumentInde x]) && !V8WebGLUniformLocation::hasInstance(info[uniformLocationArgumentIndex], info.GetIsolate())) {
744 exceptionState.throwTypeError(ExceptionMessages::argumentNullOrIncorrect Type(uniformLocationArgumentIndex + 1, "WebGLUniformLocation")); 744 exceptionState.throwTypeError(ExceptionMessages::argumentNullOrIncorrect Type(uniformLocationArgumentIndex + 1, "WebGLUniformLocation"));
745 exceptionState.throwIfNeeded(); 745 exceptionState.throwIfNeeded();
746 return; 746 return;
747 } 747 }
748 WebGLUniformLocation* location = toWebGLUniformLocation(info[uniformLocation ArgumentIndex], info.GetIsolate()); 748 WebGLUniformLocation* location = toWebGLUniformLocation(info[uniformLocation ArgumentIndex], info.GetIsolate());
749 749
750 bool transpose = info[1]->BooleanValue(); 750 bool transpose = info[1]->BooleanValue();
751 const int arrayArgumentIndex = 2; 751 const int arrayArgumentIndex = 2;
752 if (V8Float32Array::hasInstance(info[arrayArgumentIndex], info.GetIsolate()) ) { 752 if (V8Float32Array::hasInstance(info[arrayArgumentIndex], info.GetIsolate()) ) {
753 Float32Array* array = V8Float32Array::toNative(info[arrayArgumentIndex]- >ToObject()); 753 Float32Array* array = V8Float32Array::toImpl(info[arrayArgumentIndex]->T oObject());
754 ASSERT(array); 754 ASSERT(array);
755 switch (matrixSize) { 755 switch (matrixSize) {
756 case 2: context->uniformMatrix2fv(location, transpose, array); break; 756 case 2: context->uniformMatrix2fv(location, transpose, array); break;
757 case 3: context->uniformMatrix3fv(location, transpose, array); break; 757 case 3: context->uniformMatrix3fv(location, transpose, array); break;
758 case 4: context->uniformMatrix4fv(location, transpose, array); break; 758 case 4: context->uniformMatrix4fv(location, transpose, array); break;
759 default: ASSERT_NOT_REACHED(); break; 759 default: ASSERT_NOT_REACHED(); break;
760 } 760 }
761 return; 761 return;
762 } 762 }
763 763
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
822 vertexAttribAndUniformHelperf(info, kVertexAttrib3v, exceptionState); 822 vertexAttribAndUniformHelperf(info, kVertexAttrib3v, exceptionState);
823 } 823 }
824 824
825 void V8WebGLRenderingContext::vertexAttrib4fvMethodCustom(const v8::FunctionCall backInfo<v8::Value>& info) 825 void V8WebGLRenderingContext::vertexAttrib4fvMethodCustom(const v8::FunctionCall backInfo<v8::Value>& info)
826 { 826 {
827 ExceptionState exceptionState(ExceptionState::ExecutionContext, "vertexAttri b4fv", "WebGLRenderingContext", info.Holder(), info.GetIsolate()); 827 ExceptionState exceptionState(ExceptionState::ExecutionContext, "vertexAttri b4fv", "WebGLRenderingContext", info.Holder(), info.GetIsolate());
828 vertexAttribAndUniformHelperf(info, kVertexAttrib4v, exceptionState); 828 vertexAttribAndUniformHelperf(info, kVertexAttrib4v, exceptionState);
829 } 829 }
830 830
831 } // namespace blink 831 } // namespace blink
OLDNEW
« no previous file with comments | « Source/bindings/core/v8/custom/V8TypedArrayCustom.h ('k') | Source/bindings/core/v8/custom/V8WindowCustom.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698