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

Side by Side Diff: cc/texture_update_controller.h

Issue 11232051: Remove static thread pointers from CC (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Address code review comments and fix all cc_unittests Created 8 years, 2 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 "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/time.h" 10 #include "base/time.h"
11 #include "cc/texture_update_queue.h" 11 #include "cc/texture_update_queue.h"
12 #include "cc/timer.h" 12 #include "cc/timer.h"
13 13
14 namespace cc { 14 namespace cc {
15 15
16 class ResourceProvider; 16 class ResourceProvider;
17 17
18 class TextureUpdateControllerClient { 18 class TextureUpdateControllerClient {
19 public: 19 public:
20 virtual void readyToFinalizeTextureUpdates() = 0; 20 virtual void readyToFinalizeTextureUpdates() = 0;
21 21
22 protected: 22 protected:
23 virtual ~TextureUpdateControllerClient() { } 23 virtual ~TextureUpdateControllerClient() { }
24 }; 24 };
25 25
26 class TextureUpdateController : public TimerClient { 26 class TextureUpdateController : public TimerClient {
27 public: 27 public:
28 static scoped_ptr<TextureUpdateController> create(TextureUpdateControllerCli ent* client, Thread* thread, scoped_ptr<TextureUpdateQueue> queue, ResourceProvi der* resourceProvider) 28 static scoped_ptr<TextureUpdateController> create(TextureUpdateControllerCli ent* client, Thread* thread, scoped_ptr<TextureUpdateQueue> queue, ResourceProvi der* resourceProvider, bool hasImplThread)
29 { 29 {
30 return make_scoped_ptr(new TextureUpdateController(client, thread, queue .Pass(), resourceProvider)); 30 return make_scoped_ptr(new TextureUpdateController(client, thread, queue .Pass(), resourceProvider, hasImplThread));
31 } 31 }
32 static size_t maxPartialTextureUpdates(); 32 static size_t maxPartialTextureUpdates();
33 33
34 virtual ~TextureUpdateController(); 34 virtual ~TextureUpdateController();
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(base::TimeTicks timeLimit); 39 void performMoreUpdates(base::TimeTicks timeLimit);
40 void finalize(); 40 void finalize();
41 41
42 // TimerClient implementation. 42 // TimerClient implementation.
43 virtual void onTimerFired() OVERRIDE; 43 virtual void onTimerFired() OVERRIDE;
44 44
45 // Virtual for testing. 45 // Virtual for testing.
46 virtual base::TimeTicks now() const; 46 virtual base::TimeTicks now() const;
47 virtual base::TimeDelta updateMoreTexturesTime() const; 47 virtual base::TimeDelta updateMoreTexturesTime() const;
48 virtual size_t updateMoreTexturesSize() const; 48 virtual size_t updateMoreTexturesSize() const;
49 49
50 protected: 50 protected:
51 TextureUpdateController(TextureUpdateControllerClient*, Thread*, scoped_ptr< TextureUpdateQueue>, ResourceProvider*); 51 TextureUpdateController(TextureUpdateControllerClient*, Thread*, scoped_ptr< TextureUpdateQueue>, ResourceProvider*, bool hasImplThread);
52 52
53 static size_t maxFullUpdatesPerTick(ResourceProvider*); 53 static size_t maxFullUpdatesPerTick(ResourceProvider*);
54 54
55 size_t maxBlockingUpdates() const; 55 size_t maxBlockingUpdates() const;
56 56
57 void updateTexture(ResourceUpdate); 57 void updateTexture(ResourceUpdate);
58 58
59 // This returns true when there were textures left to update. 59 // This returns true when there were textures left to update.
60 bool updateMoreTexturesIfEnoughTimeRemaining(); 60 bool updateMoreTexturesIfEnoughTimeRemaining();
61 void updateMoreTexturesNow(); 61 void updateMoreTexturesNow();
62 62
63 TextureUpdateControllerClient* m_client; 63 TextureUpdateControllerClient* m_client;
64 bool m_hasImplThread;
64 scoped_ptr<Timer> m_timer; 65 scoped_ptr<Timer> m_timer;
65 scoped_ptr<TextureUpdateQueue> m_queue; 66 scoped_ptr<TextureUpdateQueue> m_queue;
66 bool m_contentsTexturesPurged; 67 bool m_contentsTexturesPurged;
67 ResourceProvider* m_resourceProvider; 68 ResourceProvider* m_resourceProvider;
68 base::TimeTicks m_timeLimit; 69 base::TimeTicks m_timeLimit;
69 size_t m_textureUpdatesPerTick; 70 size_t m_textureUpdatesPerTick;
70 bool m_firstUpdateAttempt; 71 bool m_firstUpdateAttempt;
71 72
72 private: 73 private:
73 DISALLOW_COPY_AND_ASSIGN(TextureUpdateController); 74 DISALLOW_COPY_AND_ASSIGN(TextureUpdateController);
74 }; 75 };
75 76
76 } // namespace cc 77 } // namespace cc
77 78
78 #endif // CCTextureUpdateController_h 79 #endif // CCTextureUpdateController_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698