| 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 17 matching lines...) Expand all Loading... |
| 28 public: | 28 public: |
| 29 static PassOwnPtr<CCTextureUpdateController> create(CCTextureUpdateControlle
rClient* client, CCThread* thread, PassOwnPtr<CCTextureUpdateQueue> queue, CCRes
ourceProvider* resourceProvider, TextureCopier* copier, TextureUploader* uploade
r) | 29 static PassOwnPtr<CCTextureUpdateController> create(CCTextureUpdateControlle
rClient* client, CCThread* thread, PassOwnPtr<CCTextureUpdateQueue> queue, CCRes
ourceProvider* resourceProvider, TextureCopier* copier, TextureUploader* uploade
r) |
| 30 { | 30 { |
| 31 return adoptPtr(new CCTextureUpdateController(client, thread, queue, res
ourceProvider, copier, uploader)); | 31 return adoptPtr(new CCTextureUpdateController(client, thread, queue, res
ourceProvider, copier, uploader)); |
| 32 } | 32 } |
| 33 static size_t maxPartialTextureUpdates(); | 33 static size_t maxPartialTextureUpdates(); |
| 34 static void updateTextures(CCResourceProvider*, TextureCopier*, TextureUploa
der*, CCTextureUpdateQueue*, size_t count); | 34 static void updateTextures(CCResourceProvider*, TextureCopier*, TextureUploa
der*, CCTextureUpdateQueue*, size_t count); |
| 35 | 35 |
| 36 virtual ~CCTextureUpdateController(); | 36 virtual ~CCTextureUpdateController(); |
| 37 | 37 |
| 38 void updateMoreTextures(double monotonicTimeLimit); | 38 // updateTexturesCompleted() will be called when finished. |
| 39 void start(); |
| 40 |
| 41 void updateAllTexturesNow(); |
| 39 | 42 |
| 40 // CCTimerClient implementation. | 43 // CCTimerClient implementation. |
| 41 virtual void onTimerFired() OVERRIDE; | 44 virtual void onTimerFired() OVERRIDE; |
| 42 | 45 |
| 43 // Virtual for testing. | 46 // Virtual for testing. |
| 44 virtual double monotonicTimeNow() const; | |
| 45 virtual double updateMoreTexturesTime() const; | 47 virtual double updateMoreTexturesTime() const; |
| 46 virtual size_t updateMoreTexturesSize() const; | 48 virtual size_t updateMoreTexturesSize() const; |
| 47 | 49 |
| 48 protected: | 50 protected: |
| 49 CCTextureUpdateController(CCTextureUpdateControllerClient*, CCThread*, PassO
wnPtr<CCTextureUpdateQueue>, CCResourceProvider*, TextureCopier*, TextureUploade
r*); | 51 CCTextureUpdateController(CCTextureUpdateControllerClient*, CCThread*, PassO
wnPtr<CCTextureUpdateQueue>, CCResourceProvider*, TextureCopier*, TextureUploade
r*); |
| 50 | 52 |
| 51 // This returns true when there were textures left to update. | 53 // This returns true when there were textures left to update. |
| 52 bool updateMoreTexturesIfEnoughTimeRemaining(); | 54 bool updateMoreTextures(); |
| 53 void updateMoreTexturesNow(); | |
| 54 | 55 |
| 55 CCTextureUpdateControllerClient* m_client; | 56 CCTextureUpdateControllerClient* m_client; |
| 56 OwnPtr<CCTimer> m_timer; | 57 OwnPtr<CCTimer> m_timer; |
| 57 OwnPtr<CCTextureUpdateQueue> m_queue; | 58 OwnPtr<CCTextureUpdateQueue> m_queue; |
| 58 bool m_contentsTexturesPurged; | |
| 59 CCResourceProvider* m_resourceProvider; | 59 CCResourceProvider* m_resourceProvider; |
| 60 TextureCopier* m_copier; | 60 TextureCopier* m_copier; |
| 61 TextureUploader* m_uploader; | 61 TextureUploader* m_uploader; |
| 62 double m_monotonicTimeLimit; | |
| 63 bool m_firstUpdateAttempt; | |
| 64 }; | 62 }; |
| 65 | 63 |
| 66 } | 64 } |
| 67 | 65 |
| 68 #endif // CCTextureUpdateController_h | 66 #endif // CCTextureUpdateController_h |
| OLD | NEW |