| OLD | NEW |
| (Empty) |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "config.h" | |
| 6 | |
| 7 #include "cc/texture_update_queue.h" | |
| 8 | |
| 9 #include "cc/prioritized_texture.h" | |
| 10 | |
| 11 namespace cc { | |
| 12 | |
| 13 TextureUpdateQueue::TextureUpdateQueue() | |
| 14 { | |
| 15 } | |
| 16 | |
| 17 TextureUpdateQueue::~TextureUpdateQueue() | |
| 18 { | |
| 19 } | |
| 20 | |
| 21 void TextureUpdateQueue::appendFullUpload(const ResourceUpdate& upload) | |
| 22 { | |
| 23 m_fullEntries.push_back(upload); | |
| 24 } | |
| 25 | |
| 26 void TextureUpdateQueue::appendPartialUpload(const ResourceUpdate& upload) | |
| 27 { | |
| 28 m_partialEntries.push_back(upload); | |
| 29 } | |
| 30 | |
| 31 void TextureUpdateQueue::appendCopy(TextureCopier::Parameters copy) | |
| 32 { | |
| 33 m_copyEntries.push_back(copy); | |
| 34 } | |
| 35 | |
| 36 void TextureUpdateQueue::clearUploadsToEvictedResources() | |
| 37 { | |
| 38 clearUploadsToEvictedResources(m_fullEntries); | |
| 39 clearUploadsToEvictedResources(m_partialEntries); | |
| 40 } | |
| 41 | |
| 42 void TextureUpdateQueue::clearUploadsToEvictedResources(std::deque<ResourceUpdat
e>& entryQueue) | |
| 43 { | |
| 44 std::deque<ResourceUpdate> temp; | |
| 45 entryQueue.swap(temp); | |
| 46 while (temp.size()) { | |
| 47 ResourceUpdate upload = temp.front(); | |
| 48 temp.pop_front(); | |
| 49 if (!upload.texture->backingResourceWasEvicted()) | |
| 50 entryQueue.push_back(upload); | |
| 51 } | |
| 52 } | |
| 53 | |
| 54 ResourceUpdate TextureUpdateQueue::takeFirstFullUpload() | |
| 55 { | |
| 56 ResourceUpdate first = m_fullEntries.front(); | |
| 57 m_fullEntries.pop_front(); | |
| 58 return first; | |
| 59 } | |
| 60 | |
| 61 ResourceUpdate TextureUpdateQueue::takeFirstPartialUpload() | |
| 62 { | |
| 63 ResourceUpdate first = m_partialEntries.front(); | |
| 64 m_partialEntries.pop_front(); | |
| 65 return first; | |
| 66 } | |
| 67 | |
| 68 TextureCopier::Parameters TextureUpdateQueue::takeFirstCopy() | |
| 69 { | |
| 70 TextureCopier::Parameters first = m_copyEntries.front(); | |
| 71 m_copyEntries.pop_front(); | |
| 72 return first; | |
| 73 } | |
| 74 | |
| 75 bool TextureUpdateQueue::hasMoreUpdates() const | |
| 76 { | |
| 77 return m_fullEntries.size() || m_partialEntries.size() || m_copyEntries.size
(); | |
| 78 } | |
| 79 | |
| 80 } | |
| OLD | NEW |