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