Closed
Bug 924188
Opened 11 years ago
Closed 11 years ago
Use MOZ_ASSERT where appropriate in WebGL code
Categories
(Core :: Graphics: CanvasWebGL, defect)
Core
Graphics: CanvasWebGL
Tracking
()
RESOLVED
FIXED
mozilla27
People
(Reporter: bjacob, Assigned: bjacob)
Details
Attachments
(2 files)
23.38 KB,
patch
|
jgilbert
:
review+
|
Details | Diff | Splinter Review |
23.71 KB,
patch
|
bjacob
:
review+
|
Details | Diff | Splinter Review |
No description provided.
Attachment #814189 -
Flags: review?(jgilbert)
Comment 1•11 years ago
|
||
Comment on attachment 814189 [details] [diff] [review] patch Review of attachment 814189 [details] [diff] [review]: ----------------------------------------------------------------- Nits. We should really resurrect NS_NOTREACHED for MOZ_*, too. ::: content/canvas/src/WebGLContextGL.cpp @@ +2155,5 @@ > } else if (shader->ShaderType() == LOCAL_GL_FRAGMENT_SHADER) { > shaderTypeName = "fragment"; > } else { > // should have been validated earlier > + MOZ_ASSERT(false); We should really have a MOZ_ASSERT_NOTREACHED or something. ::: content/canvas/src/WebGLContextUtils.cpp @@ +221,5 @@ > return true; > } > > NS_NOTREACHED("Invalid WebGL texture format?"); > + MOZ_ASSERT(false); This should be redundant. ::: content/canvas/src/WebGLTexelConversions.cpp @@ +173,1 @@ > mDstStride % sizeof(DstType) == 0, Fix the indents here.
Attachment #814189 -
Flags: review?(jgilbert) → review+
Assignee | ||
Comment 2•11 years ago
|
||
(In reply to Jeff Gilbert [:jgilbert] from comment #1) > Comment on attachment 814189 [details] [diff] [review] > patch > > Review of attachment 814189 [details] [diff] [review]: > ----------------------------------------------------------------- > > Nits. We should really resurrect NS_NOTREACHED for MOZ_*, too. > > ::: content/canvas/src/WebGLContextGL.cpp > @@ +2155,5 @@ > > } else if (shader->ShaderType() == LOCAL_GL_FRAGMENT_SHADER) { > > shaderTypeName = "fragment"; > > } else { > > // should have been validated earlier > > + MOZ_ASSERT(false); > > We should really have a MOZ_ASSERT_NOTREACHED or something. There actually is MOZ_ASSUME_UNREACHABLE in mfbt/Assertions.h. But it warns about how it's intentionally undefined behavior, therefore unsafe and only useful as an optimization in critical code: * MOZ_ASSUME_UNREACHABLE([reason]) tells the compiler that it can assume that * the macro call cannot be reached during execution. This lets the compiler * generate better-optimized code under some circumstances, at the expense of * the program's behavior being undefined if control reaches the * MOZ_ASSUME_UNREACHABLE. * * In Gecko, you probably should not use this macro outside of performance- or * size-critical code, because it's unsafe. If you don't care about code size * or performance, you should probably use MOZ_ASSERT or MOZ_CRASH. So let's stick to MOZ_CRASH here. > > ::: content/canvas/src/WebGLContextUtils.cpp > @@ +221,5 @@ > > return true; > > } > > > > NS_NOTREACHED("Invalid WebGL texture format?"); > > + MOZ_ASSERT(false); > > This should be redundant. Good catch, we only want the MOZ_ASSERT(false) here for the reason given above.
Assignee | ||
Comment 3•11 years ago
|
||
Attachment #814271 -
Flags: review+
Assignee | ||
Comment 4•11 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/1632bbff03ad
Assignee: nobody → bjacob
Target Milestone: --- → mozilla27
Comment 5•11 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/1632bbff03ad
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•