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 #include "cc/texture_uploader.h" | 7 #include "cc/texture_uploader.h" |
7 | 8 |
8 #include "CCPrioritizedTexture.h" | 9 #include <algorithm> |
| 10 #include <vector> |
| 11 |
9 #include "base/debug/alias.h" | 12 #include "base/debug/alias.h" |
10 #include "base/debug/trace_event.h" | 13 #include "base/debug/trace_event.h" |
11 #include "base/metrics/histogram.h" | 14 #include "base/metrics/histogram.h" |
| 15 #include "cc/prioritized_texture.h" |
12 #include "third_party/khronos/GLES2/gl2.h" | 16 #include "third_party/khronos/GLES2/gl2.h" |
13 #include "third_party/khronos/GLES2/gl2ext.h" | 17 #include "third_party/khronos/GLES2/gl2ext.h" |
14 #include <algorithm> | |
15 #include <public/WebGraphicsContext3D.h> | 18 #include <public/WebGraphicsContext3D.h> |
16 #include <vector> | |
17 | 19 |
18 namespace { | 20 namespace { |
19 | 21 |
20 // How many previous uploads to use when predicting future throughput. | 22 // How many previous uploads to use when predicting future throughput. |
21 static const size_t uploadHistorySize = 100; | 23 static const size_t uploadHistorySize = 100; |
22 | 24 |
23 // Global estimated number of textures per second to maintain estimates across | 25 // Global estimated number of textures per second to maintain estimates across |
24 // subsequent instances of TextureUploader. | 26 // subsequent instances of TextureUploader. |
25 // More than one thread will not access this variable, so we do not need to sync
hronize access. | 27 // More than one thread will not access this variable, so we do not need to sync
hronize access. |
26 static double estimatedTexturesPerSecondGlobal = 48.0 * 60.0; | 28 static double estimatedTexturesPerSecondGlobal = 48.0 * 60.0; |
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
340 // Remove the oldest values from our history and insert the new one | 342 // Remove the oldest values from our history and insert the new one |
341 double texturesPerSecond = 1.0 / (usElapsed * 1e-6); | 343 double texturesPerSecond = 1.0 / (usElapsed * 1e-6); |
342 m_texturesPerSecondHistory.pop_back(); | 344 m_texturesPerSecondHistory.pop_back(); |
343 m_texturesPerSecondHistory.push_front(texturesPerSecond); | 345 m_texturesPerSecondHistory.push_front(texturesPerSecond); |
344 | 346 |
345 m_availableQueries.append(m_pendingQueries.takeFirst()); | 347 m_availableQueries.append(m_pendingQueries.takeFirst()); |
346 } | 348 } |
347 } | 349 } |
348 | 350 |
349 } | 351 } |
OLD | NEW |