Bug 1317637 - Converts for(...; ...; ...) loops to use the new range-based loops in C++11 in gfx/. r=jrmuizel
authorAndi-Bogdan Postelnicu <bpostelnicu@mozilla.com>
Tue, 15 Nov 2016 10:55:49 +0200
changeset 370541 f22d8216433d2db80eb90debcb108f2707db8e4a
parent 370427 f10017f3cc867b51dc16695d3ad8563177cb3f40
child 370542 b47802143664dd22205bea1d56498f7be81b6711
push id1419
push userjlund@mozilla.com
push dateMon, 10 Apr 2017 20:44:07 +0000
treeherdermozilla-release@5e6801b73ef6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjrmuizel
bugs1317637
milestone53.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1317637 - Converts for(...; ...; ...) loops to use the new range-based loops in C++11 in gfx/. r=jrmuizel MozReview-Commit-ID: Dd6426wCbMg
gfx/2d/DrawTargetSkia.cpp
gfx/layers/PersistentBufferProvider.cpp
gfx/thebes/gfxPlatform.cpp
--- a/gfx/2d/DrawTargetSkia.cpp
+++ b/gfx/2d/DrawTargetSkia.cpp
@@ -188,18 +188,17 @@ VerifyRGBXCorners(uint8_t* aData, const 
   const int bottomLeft = aStride * height - aStride;
 
   // Lastly the center pixel
   int middleRowHeight = height / 2;
   int middleRowWidth = (width / 2) * pixelSize;
   const int middle = aStride * middleRowHeight + middleRowWidth;
 
   const int offsets[] = { topLeft, topRight, bottomRight, bottomLeft, middle };
-  for (size_t i = 0; i < MOZ_ARRAY_LENGTH(offsets); i++) {
-    int offset = offsets[i];
+  for (int offset : offsets) {
     if (aData[offset + kARGBAlphaOffset] != 0xFF) {
         int row = offset / aStride;
         int column = (offset % aStride) / pixelSize;
         gfxCriticalError() << "RGBX corner pixel at (" << column << "," << row << ") in "
                            << width << "x" << height << " surface is not opaque: "
                            << int(aData[offset]) << ","
                            << int(aData[offset+1]) << ","
                            << int(aData[offset+2]) << ","
--- a/gfx/layers/PersistentBufferProvider.cpp
+++ b/gfx/layers/PersistentBufferProvider.cpp
@@ -425,18 +425,18 @@ PersistentBufferProviderShared::NotifyIn
 }
 
 void
 PersistentBufferProviderShared::Destroy()
 {
   mSnapshot = nullptr;
   mDrawTarget = nullptr;
 
-  for (uint32_t i = 0; i < mTextures.length(); ++i) {
-    TextureClient* texture = mTextures[i];
+  for (auto& mTexture : mTextures) {
+    TextureClient* texture = mTexture;
     if (texture && texture->IsLocked()) {
       MOZ_ASSERT(false);
       texture->Unlock();
     }
   }
 
   mTextures.clear();
 }
--- a/gfx/thebes/gfxPlatform.cpp
+++ b/gfx/thebes/gfxPlatform.cpp
@@ -284,18 +284,18 @@ void CrashStatsLogForwarder::UpdateCrash
   case GeckoProcessType_GPU:
     logAnnotation = "|[G";
     break;
   default:
     logAnnotation = "|[X";
     break;
   }
 
-  for (LoggingRecord::iterator it = mBuffer.begin(); it != mBuffer.end(); ++it) {
-    message << logAnnotation << Get<0>(*it) << "]" << Get<1>(*it) << " (t=" << Get<2>(*it) << ") ";
+  for (auto& it : mBuffer) {
+    message << logAnnotation << Get<0>(it) << "]" << Get<1>(it) << " (t=" << Get<2>(it) << ") ";
   }
 
 #ifdef MOZ_CRASHREPORTER
   nsCString reportString(message.str().c_str());
   nsresult annotated = CrashReporter::AnnotateCrashReport(mCrashCriticalKey, reportString);
 #else
   nsresult annotated = NS_ERROR_NOT_IMPLEMENTED;
 #endif