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

Side by Side Diff: cc/test/fake_picture_pile.h

Issue 671653005: SetNeedsRedraw directly when updating a visible tile. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: pinchblurmerge-test: . Created 6 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_TEST_FAKE_PICTURE_PILE_H_ 5 #ifndef CC_TEST_FAKE_PICTURE_PILE_H_
6 #define CC_TEST_FAKE_PICTURE_PILE_H_ 6 #define CC_TEST_FAKE_PICTURE_PILE_H_
7 7
8 #include "cc/resources/picture_pile.h" 8 #include "cc/resources/picture_pile.h"
9 9
10 namespace base {
11 class WaitableEvent;
12 }
13
10 namespace cc { 14 namespace cc {
11 15
12 class FakePicturePile : public PicturePile { 16 class FakePicturePile : public PicturePile {
13 public: 17 public:
18 FakePicturePile() : raster_thread_blocker_(nullptr) {}
14 ~FakePicturePile() override {} 19 ~FakePicturePile() override {}
15 20
21 // PicturePile overrides.
22 scoped_refptr<RasterSource> CreateRasterSource() const override;
23
16 using PicturePile::buffer_pixels; 24 using PicturePile::buffer_pixels;
17 using PicturePile::CanRasterSlowTileCheck; 25 using PicturePile::CanRasterSlowTileCheck;
18 using PicturePile::Clear; 26 using PicturePile::Clear;
19 27
20 PictureMap& picture_map() { return picture_map_; } 28 PictureMap& picture_map() { return picture_map_; }
21 const gfx::Rect& recorded_viewport() const { return recorded_viewport_; } 29 const gfx::Rect& recorded_viewport() const { return recorded_viewport_; }
22 30
23 bool CanRasterLayerRect(gfx::Rect layer_rect) { 31 bool CanRasterLayerRect(gfx::Rect layer_rect) {
24 layer_rect.Intersect(gfx::Rect(tiling_.tiling_size())); 32 layer_rect.Intersect(gfx::Rect(tiling_.tiling_size()));
25 if (recorded_viewport_.Contains(layer_rect)) 33 if (recorded_viewport_.Contains(layer_rect))
26 return true; 34 return true;
27 return CanRasterSlowTileCheck(layer_rect); 35 return CanRasterSlowTileCheck(layer_rect);
28 } 36 }
29 37
30 bool HasRecordings() const { return has_any_recordings_; } 38 bool HasRecordings() const { return has_any_recordings_; }
31 39
32 void SetRecordedViewport(const gfx::Rect& viewport) { 40 void SetRecordedViewport(const gfx::Rect& viewport) {
33 recorded_viewport_ = viewport; 41 recorded_viewport_ = viewport;
34 } 42 }
35 43
36 void SetHasAnyRecordings(bool has_recordings) { 44 void SetHasAnyRecordings(bool has_recordings) {
37 has_any_recordings_ = has_recordings; 45 has_any_recordings_ = has_recordings;
38 } 46 }
39 47
48 void SetRasterThreadBlocker(base::WaitableEvent* blocker) {
49 raster_thread_blocker_ = blocker;
50 }
51
40 TilingData& tiling() { return tiling_; } 52 TilingData& tiling() { return tiling_; }
41 53
42 bool is_solid_color() const { return is_solid_color_; } 54 bool is_solid_color() const { return is_solid_color_; }
43 SkColor solid_color() const { return solid_color_; } 55 SkColor solid_color() const { return solid_color_; }
44 56
45 void SetPixelRecordDistance(int d) { pixel_record_distance_ = d; } 57 void SetPixelRecordDistance(int d) { pixel_record_distance_ = d; }
46 58
47 typedef PicturePile::PictureInfo PictureInfo; 59 typedef PicturePile::PictureInfo PictureInfo;
48 typedef PicturePile::PictureMapKey PictureMapKey; 60 typedef PicturePile::PictureMapKey PictureMapKey;
49 typedef PicturePile::PictureMap PictureMap; 61 typedef PicturePile::PictureMap PictureMap;
62
63 private:
64 base::WaitableEvent* raster_thread_blocker_;
reveman 2014/11/13 20:50:58 I don't think this code should be aware of raster
danakj 2014/11/13 21:24:40 Hm, heh. I named it this thinking "it blocks the t
50 }; 65 };
66
51 } // namespace cc 67 } // namespace cc
52 68
53 #endif // CC_TEST_FAKE_PICTURE_PILE_H_ 69 #endif // CC_TEST_FAKE_PICTURE_PILE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698