| 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 #ifndef CCTextureUpdateController_h | 5 #ifndef CCTextureUpdateController_h |
| 6 #define CCTextureUpdateController_h | 6 #define CCTextureUpdateController_h |
| 7 | 7 |
| 8 #include "CCTextureUpdateQueue.h" | 8 #include "CCTextureUpdateQueue.h" |
| 9 #include "CCTimer.h" | 9 #include "CCTimer.h" |
| 10 #include <wtf/Noncopyable.h> | 10 #include <wtf/Noncopyable.h> |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 { | 29 { |
| 30 return adoptPtr(new CCTextureUpdateController(client, thread, queue, res
ourceProvider, uploader)); | 30 return adoptPtr(new CCTextureUpdateController(client, thread, queue, res
ourceProvider, uploader)); |
| 31 } | 31 } |
| 32 static size_t maxPartialTextureUpdates(); | 32 static size_t maxPartialTextureUpdates(); |
| 33 | 33 |
| 34 virtual ~CCTextureUpdateController(); | 34 virtual ~CCTextureUpdateController(); |
| 35 | 35 |
| 36 // Discard uploads to textures that were evicted on the impl thread. | 36 // Discard uploads to textures that were evicted on the impl thread. |
| 37 void discardUploadsToEvictedResources(); | 37 void discardUploadsToEvictedResources(); |
| 38 | 38 |
| 39 void performMoreUpdates(double monotonicTimeLimit); | 39 // readyToFinalizeTextureUpdates() will be called when lazy updates are |
| 40 // complete and finalize() need to be called to finish updates. |
| 41 void start(); |
| 42 |
| 40 void finalize(); | 43 void finalize(); |
| 41 | 44 |
| 42 // CCTimerClient implementation. | 45 // CCTimerClient implementation. |
| 43 virtual void onTimerFired() OVERRIDE; | 46 virtual void onTimerFired() OVERRIDE; |
| 44 | 47 |
| 45 // Virtual for testing. | 48 // Virtual for testing. |
| 46 virtual double monotonicTimeNow() const; | |
| 47 virtual double updateMoreTexturesTime() const; | 49 virtual double updateMoreTexturesTime() const; |
| 48 virtual size_t updateMoreTexturesSize() const; | 50 virtual size_t updateMoreTexturesSize() const; |
| 49 | 51 |
| 50 protected: | 52 protected: |
| 51 CCTextureUpdateController(CCTextureUpdateControllerClient*, CCThread*, PassO
wnPtr<CCTextureUpdateQueue>, CCResourceProvider*, TextureUploader*); | 53 CCTextureUpdateController(CCTextureUpdateControllerClient*, CCThread*, PassO
wnPtr<CCTextureUpdateQueue>, CCResourceProvider*, TextureUploader*); |
| 52 | 54 |
| 53 static size_t maxFullUpdatesPerTick(TextureUploader*); | 55 static size_t maxFullUpdatesPerTick(TextureUploader*); |
| 54 | 56 |
| 55 // This returns true when there were textures left to update. | 57 // This returns true when there were textures left to update. |
| 56 bool updateMoreTexturesIfEnoughTimeRemaining(); | 58 bool updateMoreTextures(); |
| 57 void updateMoreTexturesNow(); | |
| 58 | 59 |
| 59 CCTextureUpdateControllerClient* m_client; | 60 CCTextureUpdateControllerClient* m_client; |
| 60 OwnPtr<CCTimer> m_timer; | 61 OwnPtr<CCTimer> m_timer; |
| 61 OwnPtr<CCTextureUpdateQueue> m_queue; | 62 OwnPtr<CCTextureUpdateQueue> m_queue; |
| 62 bool m_contentsTexturesPurged; | |
| 63 CCResourceProvider* m_resourceProvider; | 63 CCResourceProvider* m_resourceProvider; |
| 64 TextureUploader* m_uploader; | 64 TextureUploader* m_uploader; |
| 65 double m_monotonicTimeLimit; | |
| 66 size_t m_textureUpdatesPerTick; | 65 size_t m_textureUpdatesPerTick; |
| 67 bool m_firstUpdateAttempt; | |
| 68 }; | 66 }; |
| 69 | 67 |
| 70 } | 68 } |
| 71 | 69 |
| 72 #endif // CCTextureUpdateController_h | 70 #endif // CCTextureUpdateController_h |
| OLD | NEW |