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 "CCTextureUpdateController.h" | 7 #include "CCTextureUpdateController.h" |
8 | 8 |
9 #include "GraphicsContext3D.h" | 9 #include "GraphicsContext3D.h" |
10 #include "TextureCopier.h" | 10 #include "TextureCopier.h" |
11 #include "TextureUploader.h" | 11 #include "TextureUploader.h" |
12 #include <wtf/CurrentTime.h> | 12 #include <wtf/CurrentTime.h> |
13 | 13 |
14 namespace { | 14 namespace { |
15 | 15 |
16 // Number of textures to update with each call to updateMoreTexturesIfEnoughTime
Remaining(). | 16 // Number of textures to update with each call to updateMoreTexturesIfEnoughTime
Remaining(). |
17 static const size_t textureUpdatesPerTick = 12; | 17 static const size_t textureUpdatesPerTick = 12; |
18 | 18 |
19 // Measured in seconds. | 19 // Measured in seconds. |
20 static const double textureUpdateTickRate = 0.004; | 20 static const double textureUpdateTickRate = 0.004; |
21 | 21 |
22 // Flush interval when performing texture uploads. | 22 // Flush interval when performing texture uploads. |
23 static const int textureUploadFlushPeriod = 4; | 23 static const int textureUploadFlushPeriod = 4; |
24 | 24 |
25 } // anonymous namespace | 25 } // anonymous namespace |
26 | 26 |
27 namespace WebCore { | 27 namespace cc { |
28 | 28 |
29 size_t CCTextureUpdateController::maxPartialTextureUpdates() | 29 size_t CCTextureUpdateController::maxPartialTextureUpdates() |
30 { | 30 { |
31 return textureUpdatesPerTick; | 31 return textureUpdatesPerTick; |
32 } | 32 } |
33 | 33 |
34 void CCTextureUpdateController::updateTextures(CCResourceProvider* resourceProvi
der, TextureCopier* copier, TextureUploader* uploader, CCTextureUpdateQueue* que
ue, size_t count) | 34 void CCTextureUpdateController::updateTextures(CCResourceProvider* resourceProvi
der, TextureCopier* copier, TextureUploader* uploader, CCTextureUpdateQueue* que
ue, size_t count) |
35 { | 35 { |
36 if (queue->fullUploadSize() || queue->partialUploadSize()) { | 36 if (queue->fullUploadSize() || queue->partialUploadSize()) { |
37 if (uploader->isBusy()) | 37 if (uploader->isBusy()) |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 return true; | 164 return true; |
165 } | 165 } |
166 | 166 |
167 void CCTextureUpdateController::updateMoreTexturesNow() | 167 void CCTextureUpdateController::updateMoreTexturesNow() |
168 { | 168 { |
169 m_timer->startOneShot(updateMoreTexturesTime()); | 169 m_timer->startOneShot(updateMoreTexturesTime()); |
170 updateTextures(m_resourceProvider, m_copier, m_uploader, m_queue.get(), upda
teMoreTexturesSize()); | 170 updateTextures(m_resourceProvider, m_copier, m_uploader, m_queue.get(), upda
teMoreTexturesSize()); |
171 } | 171 } |
172 | 172 |
173 } | 173 } |
OLD | NEW |