OLD | NEW |
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" |
11 #include "cc/playback/recording_source.h" | 11 #include "cc/playback/recording_source.h" |
12 #include "cc/test/fake_content_layer_client.h" | 12 #include "cc/test/fake_content_layer_client.h" |
13 #include "cc/trees/layer_tree_settings.h" | 13 #include "cc/trees/layer_tree_settings.h" |
14 | 14 |
15 namespace base { | 15 namespace base { |
16 class WaitableEvent; | 16 class WaitableEvent; |
17 } // namespace base | 17 } // namespace base |
18 | 18 |
19 namespace cc { | 19 namespace cc { |
20 | 20 |
21 // This class provides method for test to add bitmap and draw rect to content | 21 // This class provides method for test to add bitmap and draw rect to content |
22 // layer client. This class also provides function to rerecord to generate a new | 22 // layer client. This class also provides function to rerecord to generate a new |
23 // display list. | 23 // display list. |
24 class FakeRecordingSource : public RecordingSource { | 24 class FakeRecordingSource : public RecordingSource { |
25 public: | 25 public: |
26 FakeRecordingSource(); | 26 FakeRecordingSource(); |
27 ~FakeRecordingSource() override {} | 27 ~FakeRecordingSource() override {} |
28 | 28 |
29 static scoped_ptr<FakeRecordingSource> CreateRecordingSource( | 29 static std::unique_ptr<FakeRecordingSource> CreateRecordingSource( |
30 const gfx::Rect& recorded_viewport, | 30 const gfx::Rect& recorded_viewport, |
31 const gfx::Size& layer_bounds) { | 31 const gfx::Size& layer_bounds) { |
32 scoped_ptr<FakeRecordingSource> recording_source(new FakeRecordingSource); | 32 std::unique_ptr<FakeRecordingSource> recording_source( |
| 33 new FakeRecordingSource); |
33 recording_source->SetRecordedViewport(recorded_viewport); | 34 recording_source->SetRecordedViewport(recorded_viewport); |
34 recording_source->SetLayerBounds(layer_bounds); | 35 recording_source->SetLayerBounds(layer_bounds); |
35 return recording_source; | 36 return recording_source; |
36 } | 37 } |
37 | 38 |
38 static scoped_ptr<FakeRecordingSource> CreateFilledRecordingSource( | 39 static std::unique_ptr<FakeRecordingSource> CreateFilledRecordingSource( |
39 const gfx::Size& layer_bounds) { | 40 const gfx::Size& layer_bounds) { |
40 scoped_ptr<FakeRecordingSource> recording_source(new FakeRecordingSource); | 41 std::unique_ptr<FakeRecordingSource> recording_source( |
| 42 new FakeRecordingSource); |
41 recording_source->SetRecordedViewport(gfx::Rect(layer_bounds)); | 43 recording_source->SetRecordedViewport(gfx::Rect(layer_bounds)); |
42 recording_source->SetLayerBounds(layer_bounds); | 44 recording_source->SetLayerBounds(layer_bounds); |
43 return recording_source; | 45 return recording_source; |
44 } | 46 } |
45 | 47 |
46 // RecordingSource overrides. | 48 // RecordingSource overrides. |
47 scoped_refptr<RasterSource> CreateRasterSource( | 49 scoped_refptr<RasterSource> CreateRasterSource( |
48 bool can_use_lcd) const override; | 50 bool can_use_lcd) const override; |
49 bool IsSuitableForGpuRasterization() const override; | 51 bool IsSuitableForGpuRasterization() const override; |
50 | 52 |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 private: | 134 private: |
133 FakeContentLayerClient client_; | 135 FakeContentLayerClient client_; |
134 SkPaint default_paint_; | 136 SkPaint default_paint_; |
135 bool force_unsuitable_for_gpu_rasterization_; | 137 bool force_unsuitable_for_gpu_rasterization_; |
136 base::WaitableEvent* playback_allowed_event_; | 138 base::WaitableEvent* playback_allowed_event_; |
137 }; | 139 }; |
138 | 140 |
139 } // namespace cc | 141 } // namespace cc |
140 | 142 |
141 #endif // CC_TEST_FAKE_RECORDING_SOURCE_H_ | 143 #endif // CC_TEST_FAKE_RECORDING_SOURCE_H_ |
OLD | NEW |