Bug 1387002 - Replace .size() by .empty() when applicable in profiler/ r?njn draft
authorSylvestre Ledru <sledru@mozilla.com>
Thu, 03 Aug 2017 12:08:04 +0200
changeset 621066 2515560fa636553c1237729fe8957905888c9ffc
parent 621065 aea2cba86cb7e7a1d331d64c6b76cddbee2b1a14
child 621067 3a5d577eb6357bd0f0729166d549d4d6baf7f061
push id72240
push userbmo:sledru@mozilla.com
push dateFri, 04 Aug 2017 08:12:30 +0000
reviewersnjn
bugs1387002
milestone57.0a1
Bug 1387002 - Replace .size() by .empty() when applicable in profiler/ r?njn MozReview-Commit-ID: 275AVJyhejr
tools/profiler/core/platform.cpp
tools/profiler/core/shared-libraries-linux.cc
--- a/tools/profiler/core/platform.cpp
+++ b/tools/profiler/core/platform.cpp
@@ -190,22 +190,22 @@ private:
     : mProcessStartTime(TimeStamp::ProcessCreation())
 #ifdef USE_LUL_STACKWALK
     , mLul(nullptr)
 #endif
   {}
 
   ~CorePS()
   {
-    while (mLiveThreads.size() > 0) {
+    while (!mLiveThreads.empty()) {
       delete mLiveThreads.back();
       mLiveThreads.pop_back();
     }
 
-    while (mDeadThreads.size() > 0) {
+    while (!mDeadThreads.empty()) {
       delete mDeadThreads.back();
       mDeadThreads.pop_back();
     }
   }
 
 public:
   typedef std::vector<ThreadInfo*> ThreadVector;
 
@@ -2835,17 +2835,17 @@ locked_profiler_stop(PSLockRef aLock)
         }
       }
       info->StopProfiling();
     }
   }
 
   // This is where we destroy the ThreadInfos for all dead threads.
   CorePS::ThreadVector& deadThreads = CorePS::DeadThreads(aLock);
-  while (deadThreads.size() > 0) {
+  while (!deadThreads.empty()) {
     delete deadThreads.back();
     deadThreads.pop_back();
   }
 
   // The Stop() call doesn't actually stop Run(); that happens in this
   // function's caller when the sampler thread is destroyed. Stop() just gives
   // the SamplerThread a chance to do some cleanup with gPSMutex locked.
   SamplerThread* samplerThread = ActivePS::Destroy(aLock);
--- a/tools/profiler/core/shared-libraries-linux.cc
+++ b/tools/profiler/core/shared-libraries-linux.cc
@@ -192,17 +192,17 @@ SharedLibraryInfo SharedLibraryInfo::Get
 
 #if defined(GP_OS_linux)
   // Make another pass over the information we just harvested from
   // dl_iterate_phdr.  If we see a nameless object mapped at what we earlier
   // established to be the main executable's load address, attach the
   // executable's name to that entry.
   for (size_t i = 0; i < info.GetSize(); i++) {
     SharedLibrary& lib = info.GetMutableEntry(i);
-    if (lib.GetStart() == exeExeAddr && lib.GetNativeDebugPath() == "") {
+    if (lib.GetStart() == exeExeAddr && lib.GetNativeDebugPath().empty()) {
       lib = SharedLibraryAtPath(exeName, lib.GetStart(), lib.GetEnd(),
                                 lib.GetOffset());
 
       // We only expect to see one such entry.
       break;
     }
   }
 #endif