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

Side by Side Diff: cc/resources/picture_pile.h

Issue 1061203002: cc: Remove invalidation history (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address vmpstr comments Created 5 years, 8 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
« no previous file with comments | « cc/resources/display_list_recording_source.cc ('k') | cc/resources/picture_pile.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_RESOURCES_PICTURE_PILE_H_ 5 #ifndef CC_RESOURCES_PICTURE_PILE_H_
6 #define CC_RESOURCES_PICTURE_PILE_H_ 6 #define CC_RESOURCES_PICTURE_PILE_H_
7 7
8 #include <bitset> 8 #include <bitset>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 11 matching lines...) Expand all
22 PicturePile(float min_contents_scale, const gfx::Size& tile_grid_size); 22 PicturePile(float min_contents_scale, const gfx::Size& tile_grid_size);
23 ~PicturePile() override; 23 ~PicturePile() override;
24 24
25 // RecordingSource overrides. 25 // RecordingSource overrides.
26 bool UpdateAndExpandInvalidation(ContentLayerClient* painter, 26 bool UpdateAndExpandInvalidation(ContentLayerClient* painter,
27 Region* invalidation, 27 Region* invalidation,
28 const gfx::Size& layer_size, 28 const gfx::Size& layer_size,
29 const gfx::Rect& visible_layer_rect, 29 const gfx::Rect& visible_layer_rect,
30 int frame_number, 30 int frame_number,
31 RecordingMode recording_mode) override; 31 RecordingMode recording_mode) override;
32 void DidMoveToNewCompositor() override;
33 scoped_refptr<RasterSource> CreateRasterSource( 32 scoped_refptr<RasterSource> CreateRasterSource(
34 bool can_use_lcd_text) const override; 33 bool can_use_lcd_text) const override;
35 gfx::Size GetSize() const final; 34 gfx::Size GetSize() const final;
36 void SetEmptyBounds() override; 35 void SetEmptyBounds() override;
37 void SetSlowdownRasterScaleFactor(int factor) override; 36 void SetSlowdownRasterScaleFactor(int factor) override;
38 void SetGatherPixelRefs(bool gather_pixel_refs) override; 37 void SetGatherPixelRefs(bool gather_pixel_refs) override;
39 void SetBackgroundColor(SkColor background_color) override; 38 void SetBackgroundColor(SkColor background_color) override;
40 void SetRequiresClear(bool requires_clear) override; 39 void SetRequiresClear(bool requires_clear) override;
41 bool IsSuitableForGpuRasterization() const override; 40 bool IsSuitableForGpuRasterization() const override;
42 void SetUnsuitableForGpuRasterizationForTesting() override; 41 void SetUnsuitableForGpuRasterizationForTesting() override;
43 gfx::Size GetTileGridSizeForTesting() const override; 42 gfx::Size GetTileGridSizeForTesting() const override;
44 43
45 protected:
46 class CC_EXPORT PictureInfo {
47 public:
48 enum { INVALIDATION_FRAMES_TRACKED = 32 };
49
50 PictureInfo();
51 ~PictureInfo();
52
53 bool Invalidate(int frame_number);
54 bool NeedsRecording(int frame_number, int distance_to_visible);
55 void SetPicture(scoped_refptr<Picture> picture);
56 const Picture* GetPicture() const;
57
58 float GetInvalidationFrequencyForTesting() const {
59 return GetInvalidationFrequency();
60 }
61
62 void ResetInvalidationHistory();
63
64 private:
65 void AdvanceInvalidationHistory(int frame_number);
66 float GetInvalidationFrequency() const;
67
68 int last_frame_number_;
69 scoped_refptr<const Picture> picture_;
70 std::bitset<INVALIDATION_FRAMES_TRACKED> invalidation_history_;
71 };
72
73 typedef std::pair<int, int> PictureMapKey; 44 typedef std::pair<int, int> PictureMapKey;
74 typedef base::hash_map<PictureMapKey, PictureInfo> PictureMap; 45 typedef base::hash_map<PictureMapKey, scoped_refptr<const Picture>>
46 PictureMap;
75 47
76 // An internal CanRaster check that goes to the picture_map rather than 48 // An internal CanRaster check that goes to the picture_map rather than
77 // using the recorded_viewport hint. 49 // using the recorded_viewport hint.
78 bool CanRasterSlowTileCheck(const gfx::Rect& layer_rect) const; 50 bool CanRasterSlowTileCheck(const gfx::Rect& layer_rect) const;
79 51
80 void Clear(); 52 void Clear();
81 53
82 void SetMinContentsScale(float min_contents_scale); 54 void SetMinContentsScale(float min_contents_scale);
83 void SetTileGridSize(const gfx::Size& tile_grid_size); 55 void SetTileGridSize(const gfx::Size& tile_grid_size);
84 56
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 void SetBufferPixels(int buffer_pixels); 101 void SetBufferPixels(int buffer_pixels);
130 102
131 bool is_suitable_for_gpu_rasterization_; 103 bool is_suitable_for_gpu_rasterization_;
132 104
133 DISALLOW_COPY_AND_ASSIGN(PicturePile); 105 DISALLOW_COPY_AND_ASSIGN(PicturePile);
134 }; 106 };
135 107
136 } // namespace cc 108 } // namespace cc
137 109
138 #endif // CC_RESOURCES_PICTURE_PILE_H_ 110 #endif // CC_RESOURCES_PICTURE_PILE_H_
OLDNEW
« no previous file with comments | « cc/resources/display_list_recording_source.cc ('k') | cc/resources/picture_pile.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698