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

Side by Side Diff: cc/managed_tile_state.h

Issue 12353003: cc: Refactored Tile::GetResourceId (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 9 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
(Empty)
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CC_MANAGED_TILE_STATE_H_
6 #define CC_MANAGED_TILE_STATE_H_
7
8 #include "base/memory/scoped_ptr.h"
9 #include "cc/resource_pool.h"
10 #include "cc/resource_provider.h"
11 #include "cc/tile_manager.h"
12
13 namespace cc {
14
15 class TileManager;
16
17 // This is state that is specific to a tile that is
18 // managed by the TileManager.
19 class CC_EXPORT ManagedTileState {
20 public:
21
reveman 2013/03/12 22:47:02 nit: no blank line here please
22 class CC_EXPORT DrawingInfo {
23 public:
24 enum Mode {
25 TEXTURE_MODE,
26 SOLID_COLOR_MODE,
27 TRANSPARENT_MODE,
28 PICTURE_PILE_MODE,
29 NUM_MODES
30 };
31
32 DrawingInfo()
33 : mode_(TEXTURE_MODE),
34 resource_is_being_initialized_(false),
35 can_be_freed_(true),
36 contents_swizzled_(false) {}
37
38 Mode mode() const {
39 return mode_;
40 }
41
42 bool IsReadyToDraw() const;
43
44 ResourceProvider::ResourceId get_resource_id() const {
45 DCHECK(mode_ == TEXTURE_MODE);
46 DCHECK(resource_);
47 DCHECK(!resource_is_being_initialized_);
48 return resource_->id();
49 }
50
51 SkColor get_solid_color() const {
52 DCHECK(mode_ == SOLID_COLOR_MODE);
53
reveman 2013/03/12 22:47:02 nit: no trailing whitespace here please
54 return solid_color_;
55 }
56
57 bool contents_swizzled() const {
58 return contents_swizzled_;
59 }
60
61 scoped_ptr<ResourcePool::Resource>& GetResourceForTesting() {
62 return resource_;
63 }
64
65 private:
66 friend class TileManager;
67 friend class ManagedTileState;
68
69 void set_transparent() {
70 mode_ = TRANSPARENT_MODE;
71 }
72
73 void set_solid_color(const SkColor& color) {
74 mode_ = SOLID_COLOR_MODE;
75 solid_color_ = color;
76 }
77
78 Mode mode_;
79 SkColor solid_color_;
80
81 scoped_ptr<ResourcePool::Resource> resource_;
82 bool resource_is_being_initialized_;
83 bool can_be_freed_;
84 bool contents_swizzled_;
85 };
86
87
88 ManagedTileState();
89 ~ManagedTileState();
90 scoped_ptr<base::Value> AsValue() const;
91
92 // Persisted state: valid all the time.
93 bool can_use_gpu_memory;
94 bool need_to_gather_pixel_refs;
95 std::list<skia::LazyPixelRef*> pending_pixel_refs;
reveman 2013/03/12 22:47:02 add #include <list> above
96 TileRasterState raster_state;
97 DrawingInfo drawing_info;
98 PicturePileImpl::Analysis picture_pile_analysis;
99 bool picture_pile_analyzed;
100
101 // Ephemeral state, valid only during TileManager::ManageTiles.
102 TileManagerBin bin[NUM_BIN_PRIORITIES];
103 TileManagerBin tree_bin[NUM_TREES];
104
105 // The bin that the tile would have if the GPU memory manager had
106 // a maximally permissive policy, send to the GPU memory manager
107 // to determine policy.
108 TileManagerBin gpu_memmgr_stats_bin;
109 TileResolution resolution;
110 float time_to_needed_in_seconds;
111 float distance_to_visible_in_pixels;
112 };
113
114 } // namespace cc
reveman 2013/03/12 22:47:02 nit: 2 spaces between } and // please
115
116 #endif
OLDNEW
« no previous file with comments | « cc/cc.gyp ('k') | cc/managed_tile_state.cc » ('j') | cc/managed_tile_state.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698