Bug 1387002 - Replace .size() by .empty() when applicable in domv/canvas/WebGL* r=kvark

MozReview-Commit-ID: 3lebYmRI8TS

--HG--
extra : rebase_source : f61511c96a43342f9c53b3d90cd958bd7b926fcb
This commit is contained in:
Sylvestre Ledru 2017-08-03 12:01:38 +02:00
parent d938e24c4c
commit d2ed1163fe
5 changed files with 8 additions and 8 deletions

View File

@ -138,7 +138,7 @@ WebGLContext::InitWebGL2(FailureReason* const out_failReason)
////
if (missingList.size()) {
if (!missingList.empty()) {
nsAutoCString exts;
for (auto itr = missingList.begin(); itr != missingList.end(); ++itr) {
exts.AppendLiteral("\n ");

View File

@ -160,7 +160,7 @@ WebGLBuffer::BufferData(GLenum target, size_t size, const void* data, GLenum usa
mIndexCache = Move(newIndexCache);
if (mIndexCache) {
if (mIndexRanges.size()) {
if (!mIndexRanges.empty()) {
mContext->GeneratePerfWarning("[%p] Invalidating %u ranges.", this,
uint32_t(mIndexRanges.size()));
mIndexRanges.clear();
@ -251,7 +251,7 @@ WebGLBuffer::InvalidateCacheRange(size_t byteOffset, size_t byteLength) const
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()));

View File

@ -164,7 +164,7 @@ ScopedResolveTexturesForDraw::ScopedResolveTexturesForDraw(WebGLContext* webgl,
ScopedResolveTexturesForDraw::~ScopedResolveTexturesForDraw()
{
if (!mRebindRequests.size())
if (mRebindRequests.empty())
return;
gl::GLContext* gl = mWebGL->gl;

View File

@ -1263,7 +1263,7 @@ WebGLProgram::ValidateAfterTentativeLink(nsCString* const out_linkLog) const
// * 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:
@ -1283,7 +1283,7 @@ WebGLProgram::ValidateAfterTentativeLink(nsCString* const out_linkLog) const
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);
@ -1608,7 +1608,7 @@ webgl::LinkedProgramInfo::MapFragDataName(const nsCString& userName,
{
// 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;

View File

@ -62,7 +62,7 @@ WebGLTransformFeedback::BeginTransformFeedback(GLenum primMode)
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.",