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

Side by Side Diff: cc/resource_update_controller.h

Issue 11232051: Remove static thread pointers from CC (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Apply code review comments Created 8 years, 1 month 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
« no previous file with comments | « cc/resource_provider_unittest.cc ('k') | cc/resource_update_controller.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 CC_RESOURCE_UPDATE_CONTROLLER_H_ 5 #ifndef CC_RESOURCE_UPDATE_CONTROLLER_H_
6 #define CC_RESOURCE_UPDATE_CONTROLLER_H_ 6 #define CC_RESOURCE_UPDATE_CONTROLLER_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/memory/weak_ptr.h" 10 #include "base/memory/weak_ptr.h"
11 #include "base/time.h" 11 #include "base/time.h"
12 #include "cc/cc_export.h" 12 #include "cc/cc_export.h"
13 #include "cc/resource_update_queue.h" 13 #include "cc/resource_update_queue.h"
14 14
15 namespace cc { 15 namespace cc {
16 16
17 class ResourceProvider; 17 class ResourceProvider;
18 class Thread; 18 class Thread;
19 19
20 class ResourceUpdateControllerClient { 20 class ResourceUpdateControllerClient {
21 public: 21 public:
22 virtual void readyToFinalizeTextureUpdates() = 0; 22 virtual void readyToFinalizeTextureUpdates() = 0;
23 23
24 protected: 24 protected:
25 virtual ~ResourceUpdateControllerClient() { } 25 virtual ~ResourceUpdateControllerClient() { }
26 }; 26 };
27 27
28 class CC_EXPORT ResourceUpdateController { 28 class CC_EXPORT ResourceUpdateController {
29 public: 29 public:
30 static scoped_ptr<ResourceUpdateController> create(ResourceUpdateControllerC lient* client, Thread* thread, scoped_ptr<ResourceUpdateQueue> queue, ResourcePr ovider* resourceProvider) 30 static scoped_ptr<ResourceUpdateController> create(ResourceUpdateControllerC lient* client, Thread* thread, scoped_ptr<ResourceUpdateQueue> queue, ResourcePr ovider* resourceProvider, bool hasImplThread)
31 { 31 {
32 return make_scoped_ptr(new ResourceUpdateController(client, thread, queu e.Pass(), resourceProvider)); 32 return make_scoped_ptr(new ResourceUpdateController(client, thread, queu e.Pass(), resourceProvider, hasImplThread));
33 } 33 }
34 static size_t maxPartialTextureUpdates(); 34 static size_t maxPartialTextureUpdates();
35 35
36 virtual ~ResourceUpdateController(); 36 virtual ~ResourceUpdateController();
37 37
38 // Discard uploads to textures that were evicted on the impl thread. 38 // Discard uploads to textures that were evicted on the impl thread.
39 void discardUploadsToEvictedResources(); 39 void discardUploadsToEvictedResources();
40 40
41 void performMoreUpdates(base::TimeTicks timeLimit); 41 void performMoreUpdates(base::TimeTicks timeLimit);
42 void finalize(); 42 void finalize();
43 43
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 ResourceUpdateController(ResourceUpdateControllerClient*, Thread*, scoped_pt r<ResourceUpdateQueue>, ResourceProvider*); 51 ResourceUpdateController(ResourceUpdateControllerClient*, Thread*, scoped_pt r<ResourceUpdateQueue>, ResourceProvider*, bool hasImplThread);
52 52
53 private: 53 private:
54 static size_t maxFullUpdatesPerTick(ResourceProvider*); 54 static size_t maxFullUpdatesPerTick(ResourceProvider*);
55 55
56 size_t maxBlockingUpdates() const; 56 size_t maxBlockingUpdates() const;
57 base::TimeDelta pendingUpdateTime() const; 57 base::TimeDelta pendingUpdateTime() const;
58 58
59 void updateTexture(ResourceUpdate); 59 void updateTexture(ResourceUpdate);
60 60
61 // This returns true when there were textures left to update. 61 // This returns true when there were textures left to update.
62 bool updateMoreTexturesIfEnoughTimeRemaining(); 62 bool updateMoreTexturesIfEnoughTimeRemaining();
63 void updateMoreTexturesNow(); 63 void updateMoreTexturesNow();
64 void onTimerFired(); 64 void onTimerFired();
65 65
66 ResourceUpdateControllerClient* m_client; 66 ResourceUpdateControllerClient* m_client;
67 bool m_hasImplThread;
67 scoped_ptr<ResourceUpdateQueue> m_queue; 68 scoped_ptr<ResourceUpdateQueue> m_queue;
68 bool m_contentsTexturesPurged; 69 bool m_contentsTexturesPurged;
69 ResourceProvider* m_resourceProvider; 70 ResourceProvider* m_resourceProvider;
70 base::TimeTicks m_timeLimit; 71 base::TimeTicks m_timeLimit;
71 size_t m_textureUpdatesPerTick; 72 size_t m_textureUpdatesPerTick;
72 bool m_firstUpdateAttempt; 73 bool m_firstUpdateAttempt;
73 Thread* m_thread; 74 Thread* m_thread;
74 base::WeakPtrFactory<ResourceUpdateController> m_weakFactory; 75 base::WeakPtrFactory<ResourceUpdateController> m_weakFactory;
75 bool m_taskPosted; 76 bool m_taskPosted;
76 77
77 DISALLOW_COPY_AND_ASSIGN(ResourceUpdateController); 78 DISALLOW_COPY_AND_ASSIGN(ResourceUpdateController);
78 }; 79 };
79 80
80 } // namespace cc 81 } // namespace cc
81 82
82 #endif // CC_RESOURCE_UPDATE_CONTROLLER_H_ 83 #endif // CC_RESOURCE_UPDATE_CONTROLLER_H_
OLDNEW
« no previous file with comments | « cc/resource_provider_unittest.cc ('k') | cc/resource_update_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698