OLD | NEW |
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_PLAYBACK_DISPLAY_LIST_RECORDING_SOURCE_H_ | 5 #ifndef CC_PLAYBACK_DISPLAY_LIST_RECORDING_SOURCE_H_ |
6 #define CC_PLAYBACK_DISPLAY_LIST_RECORDING_SOURCE_H_ | 6 #define CC_PLAYBACK_DISPLAY_LIST_RECORDING_SOURCE_H_ |
7 | 7 |
8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "cc/base/cc_export.h" | 10 #include "cc/base/cc_export.h" |
11 #include "third_party/skia/include/core/SkColor.h" | 11 #include "third_party/skia/include/core/SkColor.h" |
12 #include "ui/gfx/geometry/rect.h" | 12 #include "ui/gfx/geometry/rect.h" |
13 #include "ui/gfx/geometry/size.h" | 13 #include "ui/gfx/geometry/size.h" |
14 | 14 |
15 namespace cc { | 15 namespace cc { |
| 16 |
| 17 namespace proto { |
| 18 class DisplayListRecordingSource; |
| 19 } |
| 20 |
16 class ContentLayerClient; | 21 class ContentLayerClient; |
17 class DisplayItemList; | 22 class DisplayItemList; |
18 class DisplayListRasterSource; | 23 class DisplayListRasterSource; |
19 class Region; | 24 class Region; |
20 | 25 |
21 class CC_EXPORT DisplayListRecordingSource { | 26 class CC_EXPORT DisplayListRecordingSource { |
22 public: | 27 public: |
23 // TODO(schenney) Remove RECORD_WITH_SK_NULL_CANVAS when we no longer | 28 // TODO(schenney) Remove RECORD_WITH_SK_NULL_CANVAS when we no longer |
24 // support a non-Slimming Paint path. | 29 // support a non-Slimming Paint path. |
25 enum RecordingMode { | 30 enum RecordingMode { |
26 RECORD_NORMALLY, | 31 RECORD_NORMALLY, |
27 RECORD_WITH_SK_NULL_CANVAS, | 32 RECORD_WITH_SK_NULL_CANVAS, |
28 RECORD_WITH_PAINTING_DISABLED, | 33 RECORD_WITH_PAINTING_DISABLED, |
29 RECORD_WITH_CACHING_DISABLED, | 34 RECORD_WITH_CACHING_DISABLED, |
30 RECORD_WITH_CONSTRUCTION_DISABLED, | 35 RECORD_WITH_CONSTRUCTION_DISABLED, |
31 RECORDING_MODE_COUNT, // Must be the last entry. | 36 RECORDING_MODE_COUNT, // Must be the last entry. |
32 }; | 37 }; |
33 | 38 |
34 DisplayListRecordingSource(); | 39 DisplayListRecordingSource(); |
35 virtual ~DisplayListRecordingSource(); | 40 virtual ~DisplayListRecordingSource(); |
36 | 41 |
| 42 void ToProtobuf(proto::DisplayListRecordingSource* proto) const; |
| 43 void FromProtobuf(const proto::DisplayListRecordingSource& proto); |
| 44 |
37 bool UpdateAndExpandInvalidation(ContentLayerClient* painter, | 45 bool UpdateAndExpandInvalidation(ContentLayerClient* painter, |
38 Region* invalidation, | 46 Region* invalidation, |
39 const gfx::Size& layer_size, | 47 const gfx::Size& layer_size, |
40 const gfx::Rect& visible_layer_rect, | 48 const gfx::Rect& visible_layer_rect, |
41 int frame_number, | 49 int frame_number, |
42 RecordingMode recording_mode); | 50 RecordingMode recording_mode); |
43 gfx::Size GetSize() const; | 51 gfx::Size GetSize() const; |
44 void SetEmptyBounds(); | 52 void SetEmptyBounds(); |
45 void SetSlowdownRasterScaleFactor(int factor); | 53 void SetSlowdownRasterScaleFactor(int factor); |
46 void SetGenerateDiscardableImagesMetadata(bool generate_metadata); | 54 void SetGenerateDiscardableImagesMetadata(bool generate_metadata); |
(...skipping 20 matching lines...) Expand all Loading... |
67 SkColor solid_color_; | 75 SkColor solid_color_; |
68 SkColor background_color_; | 76 SkColor background_color_; |
69 | 77 |
70 scoped_refptr<DisplayItemList> display_list_; | 78 scoped_refptr<DisplayItemList> display_list_; |
71 size_t painter_reported_memory_usage_; | 79 size_t painter_reported_memory_usage_; |
72 | 80 |
73 private: | 81 private: |
74 void UpdateInvalidationForNewViewport(const gfx::Rect& old_recorded_viewport, | 82 void UpdateInvalidationForNewViewport(const gfx::Rect& old_recorded_viewport, |
75 const gfx::Rect& new_recorded_viewport, | 83 const gfx::Rect& new_recorded_viewport, |
76 Region* invalidation); | 84 Region* invalidation); |
| 85 void FinishDisplayItemListUpdate(); |
77 | 86 |
78 friend class DisplayListRasterSource; | 87 friend class DisplayListRasterSource; |
79 | 88 |
80 void DetermineIfSolidColor(); | 89 void DetermineIfSolidColor(); |
81 | 90 |
82 DISALLOW_COPY_AND_ASSIGN(DisplayListRecordingSource); | 91 DISALLOW_COPY_AND_ASSIGN(DisplayListRecordingSource); |
83 }; | 92 }; |
84 | 93 |
85 } // namespace cc | 94 } // namespace cc |
86 | 95 |
87 #endif // CC_PLAYBACK_DISPLAY_LIST_RECORDING_SOURCE_H_ | 96 #endif // CC_PLAYBACK_DISPLAY_LIST_RECORDING_SOURCE_H_ |
OLD | NEW |