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

Side by Side Diff: cc/tile_manager.h

Issue 11637022: Send memory management policies to the tile manager (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Incorporate review feedback Created 7 years, 12 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 | Annotate | Revision Log
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_TILE_MANAGER_H_ 5 #ifndef CC_TILE_MANAGER_H_
6 #define CC_TILE_MANAGER_H_ 6 #define CC_TILE_MANAGER_H_
7 7
8 #include <list> 8 #include <list>
9 #include <queue> 9 #include <queue>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/hash_tables.h" 12 #include "base/hash_tables.h"
13 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
14 #include "base/values.h" 14 #include "base/values.h"
15 #include "cc/resource_pool.h" 15 #include "cc/resource_pool.h"
16 #include "cc/tile_priority.h" 16 #include "cc/tile_priority.h"
17 17
18 namespace cc { 18 namespace cc {
19 19
20 class RasterThread; 20 class RasterThread;
21 class ResourceProvider; 21 class ResourceProvider;
22 class Tile; 22 class Tile;
23 class TileVersion; 23 class TileVersion;
24 struct RenderingStats; 24 struct RenderingStats;
25 25
26 class CC_EXPORT TileManagerClient { 26 class CC_EXPORT TileManagerClient {
27 public: 27 public:
28 virtual void ScheduleManageTiles() = 0; 28 virtual void ScheduleManageTiles() = 0;
29 virtual void ScheduleCheckForCompletedSetPixels() = 0; 29 virtual void ScheduleCheckForCompletedSetPixels() = 0;
30 virtual void SendTileManagerMemoryStats(
nduca 2012/12/28 02:16:03 Lets flip this to GetMemoryStats and just have the
ccameron 2012/12/28 19:56:00 Done.
31 size_t memoryRequiredBytes,
32 size_t memoryNiceToHaveBytes,
33 size_t memoryUsedBytes) = 0;
30 34
31 protected: 35 protected:
32 virtual ~TileManagerClient() {} 36 virtual ~TileManagerClient() {}
33 }; 37 };
34 38
35 // Tile manager classifying tiles into a few basic 39 // Tile manager classifying tiles into a few basic
36 // bins: 40 // bins:
37 enum TileManagerBin { 41 enum TileManagerBin {
38 NOW_BIN = 0, // Needed ASAP. 42 NOW_BIN = 0, // Needed ASAP.
39 SOON_BIN = 1, // Impl-side version of prepainting. 43 SOON_BIN = 1, // Impl-side version of prepainting.
(...skipping 15 matching lines...) Expand all
55 scoped_ptr<ResourcePool::Resource> resource; 59 scoped_ptr<ResourcePool::Resource> resource;
56 bool resource_is_being_initialized; 60 bool resource_is_being_initialized;
57 bool contents_swizzled; 61 bool contents_swizzled;
58 bool need_to_gather_pixel_refs; 62 bool need_to_gather_pixel_refs;
59 std::list<skia::LazyPixelRef*> pending_pixel_refs; 63 std::list<skia::LazyPixelRef*> pending_pixel_refs;
60 64
61 // Ephemeral state, valid only during Manage. 65 // Ephemeral state, valid only during Manage.
62 TileManagerBin bin[NUM_TREES]; 66 TileManagerBin bin[NUM_TREES];
63 // Bin used to determine raster priority. 67 // Bin used to determine raster priority.
64 TileManagerBin raster_bin; 68 TileManagerBin raster_bin;
69 // The bin that the tile would have if the GPU memory manager had a maximally permissive policy,
70 // send to the GPU memory manager to determine policy.
71 TileManagerBin gpu_memmgr_stats_bin;
65 TileResolution resolution; 72 TileResolution resolution;
66 float time_to_needed_in_seconds; 73 float time_to_needed_in_seconds;
67 }; 74 };
68 75
69 // This class manages tiles, deciding which should get rasterized and which 76 // This class manages tiles, deciding which should get rasterized and which
70 // should no longer have any memory assigned to them. Tile objects are "owned" 77 // should no longer have any memory assigned to them. Tile objects are "owned"
71 // by layers; they automatically register with the manager when they are 78 // by layers; they automatically register with the manager when they are
72 // created, and unregister from the manager when they are deleted. 79 // created, and unregister from the manager when they are deleted.
73 class CC_EXPORT TileManager { 80 class CC_EXPORT TileManager {
74 public: 81 public:
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 RenderingStats*); 118 RenderingStats*);
112 void DidFinishTileInitialization(Tile*); 119 void DidFinishTileInitialization(Tile*);
113 void DispatchImageDecodingTasksForTile(Tile*); 120 void DispatchImageDecodingTasksForTile(Tile*);
114 void OnImageDecodingTaskCompleted(scoped_refptr<Tile>, 121 void OnImageDecodingTaskCompleted(scoped_refptr<Tile>,
115 uint32_t, 122 uint32_t,
116 RenderingStats*); 123 RenderingStats*);
117 void DispatchOneImageDecodingTask( 124 void DispatchOneImageDecodingTask(
118 RasterThread*, scoped_refptr<Tile>, skia::LazyPixelRef*); 125 RasterThread*, scoped_refptr<Tile>, skia::LazyPixelRef*);
119 void GatherPixelRefsForTile(Tile*); 126 void GatherPixelRefsForTile(Tile*);
120 RasterThread* GetFreeRasterThread(); 127 RasterThread* GetFreeRasterThread();
128 void SendManagedMemoryStats();
121 129
122 TileManagerClient* client_; 130 TileManagerClient* client_;
123 scoped_ptr<ResourcePool> resource_pool_; 131 scoped_ptr<ResourcePool> resource_pool_;
124 bool manage_tiles_pending_; 132 bool manage_tiles_pending_;
125 int manage_tiles_call_count_; 133 int manage_tiles_call_count_;
126 bool check_for_completed_set_pixels_pending_; 134 bool check_for_completed_set_pixels_pending_;
127 135
128 GlobalStateThatImpactsTilePriority global_state_; 136 GlobalStateThatImpactsTilePriority global_state_;
129 137
130 int tiles_in_bin_count_[NUM_BINS][NUM_TREES]; 138 int tiles_in_bin_count_[NUM_BINS][NUM_TREES];
(...skipping 18 matching lines...) Expand all
149 RasterThreadVector raster_threads_; 157 RasterThreadVector raster_threads_;
150 158
151 RenderingStats rendering_stats_; 159 RenderingStats rendering_stats_;
152 160
153 DISALLOW_COPY_AND_ASSIGN(TileManager); 161 DISALLOW_COPY_AND_ASSIGN(TileManager);
154 }; 162 };
155 163
156 } // namespace cc 164 } // namespace cc
157 165
158 #endif // CC_TILE_MANAGER_H_ 166 #endif // CC_TILE_MANAGER_H_
OLDNEW
« cc/thread_proxy.cc ('K') | « cc/thread_proxy.cc ('k') | cc/tile_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698