summaryrefslogtreecommitdiffstats
path: root/src/core/delegated_frame_node.cpp
diff options
context:
space:
mode:
authorJocelyn Turcotte <jocelyn.turcotte@digia.com>2014-10-16 18:06:47 +0200
committerJocelyn Turcotte <jocelyn.turcotte@digia.com>2014-11-25 16:27:39 +0100
commit9ab7a37bb8d067c6f3236c1b3e7c6281b88784b1 (patch)
treee40b61ecb27da67762f19153d6be300e2d139b7b /src/core/delegated_frame_node.cpp
parentac70bf98b3b6c38bc800c5061cc1ee403c080a9c (diff)
Don't use Q_FOREACH on QHash::values
QHash::values will copy all values into a new QList, increasing the ref-count of all stored QSharedPointer temporarily. Use the QHash iterators directly to avoid this. Change-Id: I49b1af24b706da195dc4df7206133f039198aad7 Reviewed-by: Pierre Rossi <pierre.rossi@gmail.com>
Diffstat (limited to 'src/core/delegated_frame_node.cpp')
-rw-r--r--src/core/delegated_frame_node.cpp15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/core/delegated_frame_node.cpp b/src/core/delegated_frame_node.cpp
index 7c89b5e44..0a24333db 100644
--- a/src/core/delegated_frame_node.cpp
+++ b/src/core/delegated_frame_node.cpp
@@ -395,9 +395,12 @@ void DelegatedFrameNode::preprocess()
// We can now wait for the Chromium GPU thread to produce textures that will be
// rendered on our quads and fetch the IDs from the mailboxes we were given.
QList<MailboxTexture *> mailboxesToFetch;
- Q_FOREACH (const QSharedPointer<ResourceHolder> &resourceHolder, m_chromiumCompositorData->resourceHolders.values())
- if (resourceHolder->needsToFetch())
- mailboxesToFetch.append(static_cast<MailboxTexture *>(resourceHolder->texture()));
+ typedef QHash<unsigned, QSharedPointer<ResourceHolder> >::const_iterator ResourceHolderIterator;
+ ResourceHolderIterator end = m_chromiumCompositorData->resourceHolders.constEnd();
+ for (ResourceHolderIterator it = m_chromiumCompositorData->resourceHolders.constBegin(); it != end ; ++it) {
+ if ((*it)->needsToFetch())
+ mailboxesToFetch.append(static_cast<MailboxTexture *>((*it)->texture()));
+ }
if (!mailboxesToFetch.isEmpty()) {
QMap<uint32, gfx::TransferableFence> transferredFences;
@@ -647,8 +650,10 @@ void DelegatedFrameNode::commit(ChromiumCompositorData *chromiumCompositorData,
}
// Send resources of remaining candidates back to the child compositors so that they can be freed or reused.
- Q_FOREACH (const QSharedPointer<ResourceHolder> &resource, resourceCandidates.values())
- resourcesToRelease->push_back(resource->returnResource());
+ typedef QHash<unsigned, QSharedPointer<ResourceHolder> >::const_iterator ResourceHolderIterator;
+ ResourceHolderIterator end = resourceCandidates.constEnd();
+ for (ResourceHolderIterator it = resourceCandidates.constBegin(); it != end ; ++it)
+ resourcesToRelease->push_back((*it)->returnResource());
}
ResourceHolder *DelegatedFrameNode::findAndHoldResource(unsigned resourceId, QHash<unsigned, QSharedPointer<ResourceHolder> > &candidates)