Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(213)

Unified Diff: third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.cpp

Issue 2356803002: Change Deque<RecycledBitmap> to Vector in DrawingBuffer (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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()
« no previous file with comments | « third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698