Remove variable shadowing in blink/modules/webgl
In an effort to reduce or even ban variable shadowing, this renames
a variable to avoid such shadowing. I'm interested in prohibiting
shadowing because I think it might prevent potential jumbo problems.
The warnings this avoids is:
third_party/blink/renderer/modules/webgl/webgl_rendering_context_base.cc:3688:18: error: declaration shadows a local variable [-Werror,-Wshadow]
unsigned length;
^
third_party/blink/renderer/modules/webgl/webgl_rendering_context_base.cc:3658:13: note: previous declaration is here
GLsizei length = 0;
^
third_party/blink/renderer/modules/webgl/webgl_rendering_context_base.cc:5234:31: error: declaration shadows a local variable [-Werror,-Wshadow]
ScopedTexture2DRestorer restorer(gl);
^
third_party/blink/renderer/modules/webgl/webgl_rendering_context_base.cc:5190:27: note: previous declaration is here
ScopedTexture2DRestorer restorer(this);
Bug: 923510
Change-Id: Idef0b7f4b47aad7c0199d9e11571dc93d1c94429
Reviewed-on: https://chromium-review.googlesource.com/c/1477679
Commit-Queue: Kentaro Hara <haraken@chromium.org>
Auto-Submit: Daniel Bratell <bratell@opera.com>
Reviewed-by: Kentaro Hara <haraken@chromium.org>
Cr-Commit-Position: refs/heads/master@{#633750}
diff --git a/third_party/blink/renderer/modules/webgl/webgl_rendering_context_base.cc b/third_party/blink/renderer/modules/webgl/webgl_rendering_context_base.cc
index 52f2ef8..80b2d9b 100644
--- a/third_party/blink/renderer/modules/webgl/webgl_rendering_context_base.cc
+++ b/third_party/blink/renderer/modules/webgl/webgl_rendering_context_base.cc
@@ -3674,15 +3674,15 @@
LChar* name_ptr;
scoped_refptr<StringImpl> name_impl =
StringImpl::CreateUninitialized(max_name_length, name_ptr);
- GLsizei length = 0;
+ GLsizei name_length = 0;
GLint size = -1;
GLenum type = 0;
- ContextGL()->GetActiveUniform(program_id, i, max_name_length, &length,
+ ContextGL()->GetActiveUniform(program_id, i, max_name_length, &name_length,
&size, &type,
reinterpret_cast<GLchar*>(name_ptr));
if (size < 0)
return ScriptValue::CreateNull(script_state);
- String name(name_impl->Substring(0, length));
+ String name(name_impl->Substring(0, name_length));
StringBuilder name_builder;
// Strip "[0]" from the name if it's an array.
if (size > 1 && name.EndsWith("[0]"))
@@ -5250,7 +5250,7 @@
WebGLRenderingContextBase* gl = source_canvas_webgl_context;
if (gl->is_origin_top_left_ && !canvas()->LowLatencyEnabled())
flip_y = !flip_y;
- ScopedTexture2DRestorer restorer(gl);
+ ScopedTexture2DRestorer inner_restorer(gl);
if (!gl->GetDrawingBuffer()->CopyToPlatformTexture(
ContextGL(), target, target_texture, unpack_premultiply_alpha_,
!flip_y, IntPoint(xoffset, yoffset), source_sub_rectangle,