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

Unified Diff: Source/bindings/v8/custom/V8WebGLRenderingContextCustom.cpp

Issue 171533006: V8 Binding: Introduce toNativeWithTypeCheck (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/bindings/v8/custom/V8TypedArrayCustom.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/v8/custom/V8WebGLRenderingContextCustom.cpp
diff --git a/Source/bindings/v8/custom/V8WebGLRenderingContextCustom.cpp b/Source/bindings/v8/custom/V8WebGLRenderingContextCustom.cpp
index 23106af4b7bb8f74198ab8d5db183058353b697a..13d020824b163d44dbfc137837579a3553157552 100644
--- a/Source/bindings/v8/custom/V8WebGLRenderingContextCustom.cpp
+++ b/Source/bindings/v8/custom/V8WebGLRenderingContextCustom.cpp
@@ -303,9 +303,7 @@ static void getObjectParameter(const v8::FunctionCallbackInfo<v8::Value>& info,
static WebGLUniformLocation* toWebGLUniformLocation(v8::Handle<v8::Value> value, v8::Isolate* isolate)
{
- if (!V8WebGLUniformLocation::hasInstance(value, isolate))
- return 0;
- return V8WebGLUniformLocation::toNative(value->ToObject());
+ return V8WebGLUniformLocation::toNativeWithTypeCheck(isolate, value);
}
enum WhichProgramCall {
@@ -328,7 +326,7 @@ void V8WebGLRenderingContext::getAttachedShadersMethodCustom(const v8::FunctionC
exceptionState.throwIfNeeded();
return;
}
- WebGLProgram* program = V8WebGLProgram::hasInstance(info[0], info.GetIsolate()) ? V8WebGLProgram::toNative(v8::Handle<v8::Object>::Cast(info[0])) : 0;
+ WebGLProgram* program = V8WebGLProgram::toNativeWithTypeCheck(info.GetIsolate(), info[programArgumentIndex]);
Vector<RefPtr<WebGLShader> > shaders;
bool succeed = context->getAttachedShaders(program, shaders);
if (!succeed) {
@@ -415,7 +413,7 @@ void V8WebGLRenderingContext::getProgramParameterMethodCustom(const v8::Function
exceptionState.throwIfNeeded();
return;
}
- WebGLProgram* program = V8WebGLProgram::hasInstance(info[0], info.GetIsolate()) ? V8WebGLProgram::toNative(v8::Handle<v8::Object>::Cast(info[0])) : 0;
+ WebGLProgram* program = V8WebGLProgram::toNativeWithTypeCheck(info.GetIsolate(), info[programArgumentIndex]);
unsigned pname = toInt32(info[1], exceptionState);
if (exceptionState.throwIfNeeded())
return;
@@ -445,7 +443,7 @@ void V8WebGLRenderingContext::getShaderParameterMethodCustom(const v8::FunctionC
exceptionState.throwIfNeeded();
return;
}
- WebGLShader* shader = V8WebGLShader::hasInstance(info[shaderArgumentIndex], info.GetIsolate()) ? V8WebGLShader::toNative(v8::Handle<v8::Object>::Cast(info[0])) : 0;
+ WebGLShader* shader = V8WebGLShader::toNativeWithTypeCheck(info.GetIsolate(), info[shaderArgumentIndex]);
unsigned pname = toInt32(info[1], exceptionState);
if (exceptionState.throwIfNeeded())
return;
@@ -490,7 +488,7 @@ void V8WebGLRenderingContext::getUniformMethodCustom(const v8::FunctionCallbackI
exceptionState.throwIfNeeded();
return;
}
- WebGLProgram* program = V8WebGLProgram::hasInstance(info[programArgumentIndex], info.GetIsolate()) ? V8WebGLProgram::toNative(v8::Handle<v8::Object>::Cast(info[0])) : 0;
+ WebGLProgram* program = V8WebGLProgram::toNativeWithTypeCheck(info.GetIsolate(), info[programArgumentIndex]);
const int uniformArgumentIndex = 1;
if (info.Length() > 1 && !isUndefinedOrNull(info[uniformArgumentIndex]) && !V8WebGLUniformLocation::hasInstance(info[uniformArgumentIndex], info.GetIsolate())) {
« no previous file with comments | « Source/bindings/v8/custom/V8TypedArrayCustom.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698