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 #include "cc/throttled_texture_uploader.h" | 6 #include "cc/throttled_texture_uploader.h" |
7 | 7 |
8 #include "CCPrioritizedTexture.h" | 8 #include "CCPrioritizedTexture.h" |
9 #include "Extensions3DChromium.h" | 9 #include "Extensions3DChromium.h" |
10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 { | 107 { |
108 for (ScopedPtrDeque<Query>::iterator it = m_pendingQueries.begin(); | 108 for (ScopedPtrDeque<Query>::iterator it = m_pendingQueries.begin(); |
109 it != m_pendingQueries.end(); ++it) { | 109 it != m_pendingQueries.end(); ++it) { |
110 if ((*it)->isNonBlocking()) | 110 if ((*it)->isNonBlocking()) |
111 continue; | 111 continue; |
112 | 112 |
113 m_numBlockingTextureUploads--; | 113 m_numBlockingTextureUploads--; |
114 (*it)->markAsNonBlocking(); | 114 (*it)->markAsNonBlocking(); |
115 } | 115 } |
116 | 116 |
117 ASSERT(!m_numBlockingTextureUploads); | 117 DCHECK(!m_numBlockingTextureUploads); |
118 } | 118 } |
119 | 119 |
120 double ThrottledTextureUploader::estimatedTexturesPerSecond() | 120 double ThrottledTextureUploader::estimatedTexturesPerSecond() |
121 { | 121 { |
122 processQueries(); | 122 processQueries(); |
123 | 123 |
124 // The history should never be empty because we initialize all elements with
an estimate. | 124 // The history should never be empty because we initialize all elements with
an estimate. |
125 ASSERT(m_texturesPerSecondHistory.size() == uploadHistorySize); | 125 DCHECK(m_texturesPerSecondHistory.size() == uploadHistorySize); |
126 | 126 |
127 // Sort the history and use the median as our estimate. | 127 // Sort the history and use the median as our estimate. |
128 std::vector<double> sortedHistory(m_texturesPerSecondHistory.begin(), | 128 std::vector<double> sortedHistory(m_texturesPerSecondHistory.begin(), |
129 m_texturesPerSecondHistory.end()); | 129 m_texturesPerSecondHistory.end()); |
130 std::sort(sortedHistory.begin(), sortedHistory.end()); | 130 std::sort(sortedHistory.begin(), sortedHistory.end()); |
131 | 131 |
132 estimatedTexturesPerSecondGlobal = sortedHistory[sortedHistory.size() * 2 /
3]; | 132 estimatedTexturesPerSecondGlobal = sortedHistory[sortedHistory.size() * 2 /
3]; |
133 TRACE_COUNTER1("cc", "estimatedTexturesPerSecond", estimatedTexturesPerSecon
dGlobal); | 133 TRACE_COUNTER1("cc", "estimatedTexturesPerSecond", estimatedTexturesPerSecon
dGlobal); |
134 return estimatedTexturesPerSecondGlobal; | 134 return estimatedTexturesPerSecondGlobal; |
135 } | 135 } |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 // Remove the oldest values from our history and insert the new one | 192 // Remove the oldest values from our history and insert the new one |
193 double texturesPerSecond = 1.0 / (usElapsed * 1e-6); | 193 double texturesPerSecond = 1.0 / (usElapsed * 1e-6); |
194 m_texturesPerSecondHistory.pop_back(); | 194 m_texturesPerSecondHistory.pop_back(); |
195 m_texturesPerSecondHistory.push_front(texturesPerSecond); | 195 m_texturesPerSecondHistory.push_front(texturesPerSecond); |
196 | 196 |
197 m_availableQueries.append(m_pendingQueries.takeFirst()); | 197 m_availableQueries.append(m_pendingQueries.takeFirst()); |
198 } | 198 } |
199 } | 199 } |
200 | 200 |
201 } | 201 } |
OLD | NEW |