Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(281)

Side by Side Diff: cc/CCTextureUpdateController.h

Issue 10916292: Adaptively throttle texture uploads (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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>
11 #include <wtf/OwnPtr.h> 11 #include <wtf/OwnPtr.h>
12 12
13 namespace WebCore { 13 namespace WebCore {
14 14
15 class TextureCopier; 15 class TextureCopier;
16 class TextureUploader; 16 class TextureUploader;
17 17
18 class CCTextureUpdateController : public CCTimerClient { 18 class CCTextureUpdateController : public CCTimerClient {
19 WTF_MAKE_NONCOPYABLE(CCTextureUpdateController); 19 WTF_MAKE_NONCOPYABLE(CCTextureUpdateController);
20 public: 20 public:
21 static PassOwnPtr<CCTextureUpdateController> create(CCThread* thread, PassOw nPtr<CCTextureUpdateQueue> queue, CCResourceProvider* resourceProvider, TextureC opier* copier, TextureUploader* uploader) 21 static PassOwnPtr<CCTextureUpdateController> create(CCThread*, PassOwnPtr<CC TextureUpdateQueue>, CCResourceProvider*, TextureCopier*, TextureUploader*, size _t maxTextureUpdates);
22 {
23 return adoptPtr(new CCTextureUpdateController(thread, queue, resourcePro vider, copier, uploader));
24 }
25 static size_t maxPartialTextureUpdates();
26 static void updateTextures(CCResourceProvider*, TextureCopier*, TextureUploa der*, CCTextureUpdateQueue*, size_t count); 22 static void updateTextures(CCResourceProvider*, TextureCopier*, TextureUploa der*, CCTextureUpdateQueue*, size_t count);
23 static size_t maxTextureUpdates(TextureUploader*);
27 24
28 virtual ~CCTextureUpdateController(); 25 virtual ~CCTextureUpdateController();
29 26
27
30 bool hasMoreUpdates() const; 28 bool hasMoreUpdates() const;
31 void updateMoreTextures(double monotonicTimeLimit); 29 void updateMoreTextures(double monotonicTimeLimit);
32 30
33 // CCTimerClient implementation. 31 // CCTimerClient implementation.
34 virtual void onTimerFired() OVERRIDE; 32 virtual void onTimerFired() OVERRIDE;
35 33
36 // Virtual for testing. 34 // Virtual for testing.
37 virtual double monotonicTimeNow() const; 35 virtual double monotonicTimeNow() const;
38 virtual double updateMoreTexturesTime() const; 36 virtual double updateMoreTexturesTime() const;
39 virtual size_t updateMoreTexturesSize() const; 37 virtual size_t updateMoreTexturesSize() const;
40 38
41 protected: 39 protected:
42 CCTextureUpdateController(CCThread*, PassOwnPtr<CCTextureUpdateQueue>, CCRes ourceProvider*, TextureCopier*, TextureUploader*); 40 CCTextureUpdateController(CCThread*, PassOwnPtr<CCTextureUpdateQueue>, CCRes ourceProvider*, TextureCopier*, TextureUploader*, size_t maxTextureUpdates);
43 41
44 void updateMoreTexturesIfEnoughTimeRemaining(); 42 void updateMoreTexturesIfEnoughTimeRemaining();
45 void updateMoreTexturesNow(); 43 void updateMoreTexturesNow();
46 44
47 OwnPtr<CCTimer> m_timer; 45 OwnPtr<CCTimer> m_timer;
48 OwnPtr<CCTextureUpdateQueue> m_queue; 46 OwnPtr<CCTextureUpdateQueue> m_queue;
49 bool m_contentsTexturesPurged; 47 bool m_contentsTexturesPurged;
50 CCResourceProvider* m_resourceProvider; 48 CCResourceProvider* m_resourceProvider;
51 TextureCopier* m_copier; 49 TextureCopier* m_copier;
52 TextureUploader* m_uploader; 50 TextureUploader* m_uploader;
53 double m_monotonicTimeLimit; 51 double m_monotonicTimeLimit;
52 size_t m_textureUpdatesPerTick;
54 bool m_firstUpdateAttempt; 53 bool m_firstUpdateAttempt;
55 }; 54 };
56 55
57 } 56 }
58 57
59 #endif // CCTextureUpdateController_h 58 #endif // CCTextureUpdateController_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698