Bug 1387002 - Replace .size() by .empty() when applicable in domv/canvas/WebGL* r?kvark
MozReview-Commit-ID: 3lebYmRI8TS
--- a/dom/canvas/WebGL2Context.cpp
+++ b/dom/canvas/WebGL2Context.cpp
@@ -133,17 +133,17 @@ WebGLContext::InitWebGL2(FailureReason*
fnGatherMissing(gl::GLFeature::texture_swizzle);
#endif
fnGatherMissing2(gl::GLFeature::prim_restart_fixed,
gl::GLFeature::prim_restart);
////
- if (missingList.size()) {
+ if (!missingList.empty()) {
nsAutoCString exts;
for (auto itr = missingList.begin(); itr != missingList.end(); ++itr) {
exts.AppendLiteral("\n ");
exts.Append(gl::GLContext::GetFeatureName(*itr));
}
const nsPrintfCString reason("WebGL 2 requires support for the following"
" features: %s",
--- a/dom/canvas/WebGLBuffer.cpp
+++ b/dom/canvas/WebGLBuffer.cpp
@@ -155,17 +155,17 @@ WebGLBuffer::BufferData(GLenum target, s
mContext->OnDataAllocCall();
mUsage = usage;
mByteLength = size;
mIndexCache = Move(newIndexCache);
if (mIndexCache) {
- if (mIndexRanges.size()) {
+ if (!mIndexRanges.empty()) {
mContext->GeneratePerfWarning("[%p] Invalidating %u ranges.", this,
uint32_t(mIndexRanges.size()));
mIndexRanges.clear();
}
}
}
void
@@ -246,17 +246,17 @@ WebGLBuffer::InvalidateCacheRange(size_t
const auto& indexByteSize = IndexByteSizeByType(range.type);
const size_t rangeBegin = range.first * indexByteSize;
const size_t rangeEnd = rangeBegin + range.count*indexByteSize;
if (rangeBegin >= updateEnd || rangeEnd <= updateBegin)
continue;
invalids.push_back(range);
}
- if (invalids.size()) {
+ if (!invalids.empty()) {
mContext->GeneratePerfWarning("[%p] Invalidating %u/%u ranges.", this,
uint32_t(invalids.size()),
uint32_t(mIndexRanges.size()));
for (const auto& cur : invalids) {
mIndexRanges.erase(cur);
}
}
--- a/dom/canvas/WebGLContextDraw.cpp
+++ b/dom/canvas/WebGLContextDraw.cpp
@@ -159,17 +159,17 @@ ScopedResolveTexturesForDraw::ScopedReso
}
}
*out_error = false;
}
ScopedResolveTexturesForDraw::~ScopedResolveTexturesForDraw()
{
- if (!mRebindRequests.size())
+ if (mRebindRequests.empty())
return;
gl::GLContext* gl = mWebGL->gl;
for (const auto& itr : mRebindRequests) {
gl->fActiveTexture(LOCAL_GL_TEXTURE0 + itr.texUnit);
gl->fBindTexture(itr.tex->Target().get(), itr.tex->mGLName);
}
--- a/dom/canvas/WebGLProgram.cpp
+++ b/dom/canvas/WebGLProgram.cpp
@@ -1258,17 +1258,17 @@ WebGLProgram::ValidateAfterTentativeLink
}
}
}
// Forbid:
// * Unrecognized varying name
// * Duplicate varying name
// * Too many components for specified buffer mode
- if (mNextLink_TransformFeedbackVaryings.size()) {
+ if (!mNextLink_TransformFeedbackVaryings.empty()) {
GLuint maxComponentsPerIndex = 0;
switch (mNextLink_TransformFeedbackBufferMode) {
case LOCAL_GL_INTERLEAVED_ATTRIBS:
gl->GetUIntegerv(LOCAL_GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS,
&maxComponentsPerIndex);
break;
case LOCAL_GL_SEPARATE_ATTRIBS:
@@ -1278,17 +1278,17 @@ WebGLProgram::ValidateAfterTentativeLink
default:
MOZ_CRASH("`bufferMode`");
}
std::vector<size_t> componentsPerVert;
std::set<const WebGLActiveInfo*> alreadyUsed;
for (const auto& wideUserName : mNextLink_TransformFeedbackVaryings) {
- if (!componentsPerVert.size() ||
+ if (componentsPerVert.empty() ||
mNextLink_TransformFeedbackBufferMode == LOCAL_GL_SEPARATE_ATTRIBS)
{
componentsPerVert.push_back(0);
}
////
const WebGLActiveInfo* curInfo = nullptr;
@@ -1603,17 +1603,17 @@ webgl::LinkedProgramInfo::FindUniform(co
}
bool
webgl::LinkedProgramInfo::MapFragDataName(const nsCString& userName,
nsCString* const out_mappedName) const
{
// FS outputs can be arrays, but not structures.
- if (!fragDataMap.size()) {
+ if (fragDataMap.empty()) {
// No mappings map from validation, so just forward it.
*out_mappedName = userName;
return true;
}
nsCString baseUserName;
bool isArray;
size_t arrayIndex;
--- a/dom/canvas/WebGLTransformFeedback.cpp
+++ b/dom/canvas/WebGLTransformFeedback.cpp
@@ -57,17 +57,17 @@ WebGLTransformFeedback::BeginTransformFe
" TRIANGLES.",
funcName);
return;
}
const auto& prog = mContext->mCurrentProgram;
if (!prog ||
!prog->IsLinked() ||
- !prog->LinkInfo()->componentsPerTFVert.size())
+ prog->LinkInfo()->componentsPerTFVert.empty())
{
mContext->ErrorInvalidOperation("%s: Current program not valid for transform"
" feedback.",
funcName);
return;
}
const auto& linkInfo = prog->LinkInfo();