OSDN Git Service

fixed race condition in tile profiling
authorChris Craik <ccraik@google.com>
Fri, 29 Jul 2011 19:33:09 +0000 (12:33 -0700)
committerChris Craik <ccraik@google.com>
Fri, 29 Jul 2011 19:33:09 +0000 (12:33 -0700)
bug:5062896

If tile profiling was started, and experienced an inval/tile update it wouldn't
have a place to log it. Added check to make sure it didn't try to store it in
the log vector anyway.

Change-Id: I18f199740a60a86439da141502ea355340bfa8cf

Source/WebCore/platform/graphics/android/TilesProfiler.cpp

index 466923a..653d525 100644 (file)
@@ -97,7 +97,7 @@ void TilesProfiler::nextFrame(int left, int top, int right, int bottom, float sc
 
     m_records.append(WTF::Vector<TileProfileRecord>());
 
-    //first two records designate viewport
+    //first record designates viewport
     m_records.last().append(TileProfileRecord(
                                 left, top, right, bottom,
                                 scale, true, (int)(timeDelta * 1000)));
@@ -105,7 +105,7 @@ void TilesProfiler::nextFrame(int left, int top, int right, int bottom, float sc
 
 void TilesProfiler::nextTile(BaseTile& tile, float scale, bool inView)
 {
-    if (!m_enabled || (m_records.size() > MAX_PROF_FRAMES))
+    if (!m_enabled || (m_records.size() > MAX_PROF_FRAMES) || (m_records.size() == 0))
         return;
 
     bool isReady = tile.isTileReady();
@@ -128,7 +128,7 @@ void TilesProfiler::nextTile(BaseTile& tile, float scale, bool inView)
 
 void TilesProfiler::nextInval(const IntRect& rect, float scale)
 {
-    if (!m_enabled || (m_records.size() > MAX_PROF_FRAMES))
+    if (!m_enabled || (m_records.size() > MAX_PROF_FRAMES) || (m_records.size() == 0))
         return;
 
     m_records.last().append(TileProfileRecord(