Chromium Code Reviews| Index: third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.cpp |
| diff --git a/third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.cpp b/third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.cpp |
| index a52ced06f4bf74aa35e26669e9f0f9deb85ebb71..7024c53ab22997f1f2a9810e9e17032c97893882 100644 |
| --- a/third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.cpp |
| +++ b/third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.cpp |
| @@ -246,14 +246,16 @@ void DrawingBuffer::freeRecycledMailboxes() |
| std::unique_ptr<cc::SharedBitmap> DrawingBuffer::createOrRecycleBitmap() |
| { |
| - for (auto it = m_recycledBitmapQueue.begin(); it != m_recycledBitmapQueue.end(); ++it) { |
| - if (it->size != m_size) { |
| - m_recycledBitmapQueue.remove(it); |
| - --it; // Removed this position so iterate on it again. |
| - } |
| + size_t i = 0; |
| + while (i < m_recycledBitmap.size()) { |
| + if (m_recycledBitmap[i].size != m_size) |
| + m_recycledBitmap.remove(i); // Removed this position so iterate on it again. |
|
esprehn
2016/09/28 23:41:05
This is causing a bunch of vector resizing and cop
|
| + else |
| + ++i; |
| } |
| - if (!m_recycledBitmapQueue.isEmpty()) { |
| - RecycledBitmap recycled = m_recycledBitmapQueue.takeLast(); |
| + if (!m_recycledBitmap.isEmpty()) { |
| + RecycledBitmap recycled = std::move(m_recycledBitmap.last()); |
| + m_recycledBitmap.removeLast(); |
|
Ken Russell (switch to Gerrit)
2016/09/20 22:55:37
Is there any more efficient way of implementing th
xidachen
2016/09/21 14:18:15
When I looked at Deque::takeLast(), it includes th
|
| DCHECK(recycled.size == m_size); |
| return std::move(recycled.bitmap); |
| } |
| @@ -414,7 +416,7 @@ void DrawingBuffer::softwareMailboxReleased(std::unique_ptr<cc::SharedBitmap> bi |
| return; // Just delete the bitmap. |
| RecycledBitmap recycled = { std::move(bitmap), m_size }; |
| - m_recycledBitmapQueue.append(std::move(recycled)); |
| + m_recycledBitmap.append(std::move(recycled)); |
| } |
| PassRefPtr<StaticBitmapImage> DrawingBuffer::transferToStaticBitmapImage() |