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

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

Issue 2141233002: cc: Clean up RecordingSource API (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove recoding_source_ from PictureLayer, and move all its internal state to PictureLayer Created 4 years, 5 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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_RECORDING_SOURCE_H_ 5 #ifndef CC_TEST_FAKE_RECORDING_SOURCE_H_
6 #define CC_TEST_FAKE_RECORDING_SOURCE_H_ 6 #define CC_TEST_FAKE_RECORDING_SOURCE_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include "cc/base/region.h" 10 #include "cc/base/region.h"
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 // RecordingSource overrides. 50 // RecordingSource overrides.
51 scoped_refptr<RasterSource> CreateRasterSource( 51 scoped_refptr<RasterSource> CreateRasterSource(
52 bool can_use_lcd) const override; 52 bool can_use_lcd) const override;
53 bool IsSuitableForGpuRasterization() const override; 53 bool IsSuitableForGpuRasterization() const override;
54 54
55 void SetDisplayListUsesCachedPicture(bool use_cached_picture) { 55 void SetDisplayListUsesCachedPicture(bool use_cached_picture) {
56 client_.set_display_list_use_cached_picture(use_cached_picture); 56 client_.set_display_list_use_cached_picture(use_cached_picture);
57 } 57 }
58 58
59 void SetRecordedViewport(const gfx::Rect& recorded_viewport) { 59 void SetRecordedViewport(const gfx::Rect& recorded_viewport) {
60 recorded_viewport_ = recorded_viewport; 60 clc_data_.recorded_viewport = recorded_viewport;
Menglin 2016/07/19 22:56:37 Oh I think you don't have to look into the change
61 } 61 }
62 62
63 void SetLayerBounds(const gfx::Size& layer_bounds) { 63 void SetLayerBounds(const gfx::Size& layer_bounds) {
64 size_ = layer_bounds; 64 pl_data_.size = layer_bounds;
65 client_.set_bounds(layer_bounds); 65 client_.set_bounds(layer_bounds);
66 } 66 }
67 67
68 void SetClearCanvasWithDebugColor(bool clear) { 68 void SetClearCanvasWithDebugColor(bool clear) {
69 clear_canvas_with_debug_color_ = clear; 69 pl_data_.clear_canvas_with_debug_color = clear;
70 } 70 }
71 71
72 void Rerecord() { 72 void Rerecord() {
73 SetNeedsDisplayRect(recorded_viewport_); 73 SetNeedsDisplayRect(clc_data_.recorded_viewport);
74 Region invalidation; 74 Region invalidation;
75 UpdateAndExpandInvalidation(&client_, &invalidation, size_, 0, 75 UpdateAndExpandInvalidation(&client_, &invalidation, pl_data_.size,
76 RECORD_NORMALLY); 76 RECORD_NORMALLY);
77 } 77 }
78 78
79 void add_draw_rect(const gfx::Rect& rect) { 79 void add_draw_rect(const gfx::Rect& rect) {
80 client_.add_draw_rect(rect, default_paint_); 80 client_.add_draw_rect(rect, default_paint_);
81 } 81 }
82 82
83 void add_draw_rect_with_paint(const gfx::Rect& rect, const SkPaint& paint) { 83 void add_draw_rect_with_paint(const gfx::Rect& rect, const SkPaint& paint) {
84 client_.add_draw_rect(rect, paint); 84 client_.add_draw_rect(rect, paint);
85 } 85 }
(...skipping 23 matching lines...) Expand all
109 } 109 }
110 110
111 void set_default_paint(const SkPaint& paint) { default_paint_ = paint; } 111 void set_default_paint(const SkPaint& paint) { default_paint_ = paint; }
112 112
113 void set_reported_memory_usage(size_t reported_memory_usage) { 113 void set_reported_memory_usage(size_t reported_memory_usage) {
114 client_.set_reported_memory_usage(reported_memory_usage); 114 client_.set_reported_memory_usage(reported_memory_usage);
115 } 115 }
116 116
117 void reset_draws() { 117 void reset_draws() {
118 client_ = FakeContentLayerClient(); 118 client_ = FakeContentLayerClient();
119 client_.set_bounds(size_); 119 client_.set_bounds(pl_data_.size);
120 } 120 }
121 121
122 void SetUnsuitableForGpuRasterization() { 122 void SetUnsuitableForGpuRasterization() {
123 force_unsuitable_for_gpu_rasterization_ = true; 123 force_unsuitable_for_gpu_rasterization_ = true;
124 } 124 }
125 125
126 void SetPlaybackAllowedEvent(base::WaitableEvent* event) { 126 void SetPlaybackAllowedEvent(base::WaitableEvent* event) {
127 playback_allowed_event_ = event; 127 playback_allowed_event_ = event;
128 } 128 }
129 129
130 DisplayItemList* display_list() const { return display_list_.get(); } 130 DisplayItemList* display_list() const { return clc_data_.display_list.get(); }
131 131
132 // Checks that the basic properties of the |other| match |this|. For the 132 // Checks that the basic properties of the |other| match |this|. For the
133 // DisplayItemList, it checks that the painted result matches the painted 133 // DisplayItemList, it checks that the painted result matches the painted
134 // result of |other|. 134 // result of |other|.
135 bool EqualsTo(const FakeRecordingSource& other); 135 bool EqualsTo(const FakeRecordingSource& other);
136 136
137 private: 137 private:
138 FakeContentLayerClient client_; 138 FakeContentLayerClient client_;
139 SkPaint default_paint_; 139 SkPaint default_paint_;
140 bool force_unsuitable_for_gpu_rasterization_; 140 bool force_unsuitable_for_gpu_rasterization_;
141 base::WaitableEvent* playback_allowed_event_; 141 base::WaitableEvent* playback_allowed_event_;
142 }; 142 };
143 143
144 } // namespace cc 144 } // namespace cc
145 145
146 #endif // CC_TEST_FAKE_RECORDING_SOURCE_H_ 146 #endif // CC_TEST_FAKE_RECORDING_SOURCE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698