| 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 "cc/resource_update_queue.h" | |
| 6 | |
| 7 #include "cc/prioritized_resource.h" | |
| 8 | |
| 9 namespace cc { | |
| 10 | |
| 11 ResourceUpdateQueue::ResourceUpdateQueue() | |
| 12 { | |
| 13 } | |
| 14 | |
| 15 ResourceUpdateQueue::~ResourceUpdateQueue() | |
| 16 { | |
| 17 } | |
| 18 | |
| 19 void ResourceUpdateQueue::appendFullUpload(const ResourceUpdate& upload) | |
| 20 { | |
| 21 m_fullEntries.push_back(upload); | |
| 22 } | |
| 23 | |
| 24 void ResourceUpdateQueue::appendPartialUpload(const ResourceUpdate& upload) | |
| 25 { | |
| 26 m_partialEntries.push_back(upload); | |
| 27 } | |
| 28 | |
| 29 void ResourceUpdateQueue::appendCopy(TextureCopier::Parameters copy) | |
| 30 { | |
| 31 m_copyEntries.push_back(copy); | |
| 32 } | |
| 33 | |
| 34 void ResourceUpdateQueue::clearUploadsToEvictedResources() | |
| 35 { | |
| 36 clearUploadsToEvictedResources(m_fullEntries); | |
| 37 clearUploadsToEvictedResources(m_partialEntries); | |
| 38 } | |
| 39 | |
| 40 void ResourceUpdateQueue::clearUploadsToEvictedResources(std::deque<ResourceUpda
te>& entryQueue) | |
| 41 { | |
| 42 std::deque<ResourceUpdate> temp; | |
| 43 entryQueue.swap(temp); | |
| 44 while (temp.size()) { | |
| 45 ResourceUpdate upload = temp.front(); | |
| 46 temp.pop_front(); | |
| 47 if (!upload.texture->backingResourceWasEvicted()) | |
| 48 entryQueue.push_back(upload); | |
| 49 } | |
| 50 } | |
| 51 | |
| 52 ResourceUpdate ResourceUpdateQueue::takeFirstFullUpload() | |
| 53 { | |
| 54 ResourceUpdate first = m_fullEntries.front(); | |
| 55 m_fullEntries.pop_front(); | |
| 56 return first; | |
| 57 } | |
| 58 | |
| 59 ResourceUpdate ResourceUpdateQueue::takeFirstPartialUpload() | |
| 60 { | |
| 61 ResourceUpdate first = m_partialEntries.front(); | |
| 62 m_partialEntries.pop_front(); | |
| 63 return first; | |
| 64 } | |
| 65 | |
| 66 TextureCopier::Parameters ResourceUpdateQueue::takeFirstCopy() | |
| 67 { | |
| 68 TextureCopier::Parameters first = m_copyEntries.front(); | |
| 69 m_copyEntries.pop_front(); | |
| 70 return first; | |
| 71 } | |
| 72 | |
| 73 bool ResourceUpdateQueue::hasMoreUpdates() const | |
| 74 { | |
| 75 return m_fullEntries.size() || m_partialEntries.size() || m_copyEntries.size
(); | |
| 76 } | |
| 77 | |
| 78 } // namespace cc | |
| OLD | NEW |