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_ITEM_H_ | 5 #ifndef CC_PLAYBACK_DISPLAY_ITEM_H_ |
6 #define CC_PLAYBACK_DISPLAY_ITEM_H_ | 6 #define CC_PLAYBACK_DISPLAY_ITEM_H_ |
7 | 7 |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "cc/base/cc_export.h" | 9 #include "cc/base/cc_export.h" |
10 #include "cc/debug/traced_value.h" | 10 #include "cc/debug/traced_value.h" |
11 #include "cc/playback/display_item_list_bounds_calculator.h" | 11 #include "cc/playback/display_item_list_bounds_calculator.h" |
12 #include "third_party/skia/include/core/SkPicture.h" | 12 #include "third_party/skia/include/core/SkPicture.h" |
13 #include "ui/gfx/geometry/rect.h" | 13 #include "ui/gfx/geometry/rect.h" |
14 | 14 |
15 class SkCanvas; | 15 class SkCanvas; |
16 | 16 |
17 namespace cc { | 17 namespace cc { |
18 | 18 |
19 namespace proto { | |
20 class DisplayItem; | |
21 } | |
22 | |
19 class CC_EXPORT DisplayItem { | 23 class CC_EXPORT DisplayItem { |
20 public: | 24 public: |
21 virtual ~DisplayItem() {} | 25 virtual ~DisplayItem() {} |
22 | 26 |
23 void SetNew(bool is_suitable_for_gpu_rasterization, | 27 void SetNew(bool is_suitable_for_gpu_rasterization, |
24 int approximate_op_count, | 28 int approximate_op_count, |
25 size_t external_memory_usage) { | 29 size_t external_memory_usage) { |
26 is_suitable_for_gpu_rasterization_ = is_suitable_for_gpu_rasterization; | 30 is_suitable_for_gpu_rasterization_ = is_suitable_for_gpu_rasterization; |
27 approximate_op_count_ = approximate_op_count; | 31 approximate_op_count_ = approximate_op_count; |
28 external_memory_usage_ = external_memory_usage; | 32 external_memory_usage_ = external_memory_usage; |
29 } | 33 } |
30 | 34 |
35 virtual void ToProtobuf(proto::DisplayItem* proto) = 0; | |
vmpstr
2015/10/26 17:46:17
Make this const, please.
David Trainor- moved to gerrit
2015/10/26 20:42:56
Sure. This might change in the future if we start
| |
36 virtual void FromProtobuf(const proto::DisplayItem& proto) = 0; | |
31 virtual void Raster(SkCanvas* canvas, | 37 virtual void Raster(SkCanvas* canvas, |
32 const gfx::Rect& canvas_target_playback_rect, | 38 const gfx::Rect& canvas_target_playback_rect, |
33 SkPicture::AbortCallback* callback) const = 0; | 39 SkPicture::AbortCallback* callback) const = 0; |
34 virtual void AsValueInto(base::trace_event::TracedValue* array) const = 0; | 40 virtual void AsValueInto(base::trace_event::TracedValue* array) const = 0; |
35 virtual void ProcessForBounds( | 41 virtual void ProcessForBounds( |
36 DisplayItemListBoundsCalculator* calculator) const = 0; | 42 DisplayItemListBoundsCalculator* calculator) const = 0; |
37 | 43 |
38 bool is_suitable_for_gpu_rasterization() const { | 44 bool is_suitable_for_gpu_rasterization() const { |
39 return is_suitable_for_gpu_rasterization_; | 45 return is_suitable_for_gpu_rasterization_; |
40 } | 46 } |
41 int approximate_op_count() const { return approximate_op_count_; } | 47 int approximate_op_count() const { return approximate_op_count_; } |
42 size_t external_memory_usage() const { return external_memory_usage_; } | 48 size_t external_memory_usage() const { return external_memory_usage_; } |
43 | 49 |
44 protected: | 50 protected: |
45 DisplayItem(); | 51 DisplayItem(); |
46 | 52 |
47 bool is_suitable_for_gpu_rasterization_; | 53 bool is_suitable_for_gpu_rasterization_; |
48 int approximate_op_count_; | 54 int approximate_op_count_; |
49 | 55 |
50 // The size, in bytes, of the memory owned by this display item but not | 56 // The size, in bytes, of the memory owned by this display item but not |
51 // allocated within it (e.g. held through scoped_ptr or vector). | 57 // allocated within it (e.g. held through scoped_ptr or vector). |
52 size_t external_memory_usage_; | 58 size_t external_memory_usage_; |
53 }; | 59 }; |
54 | 60 |
55 } // namespace cc | 61 } // namespace cc |
56 | 62 |
57 #endif // CC_PLAYBACK_DISPLAY_ITEM_H_ | 63 #endif // CC_PLAYBACK_DISPLAY_ITEM_H_ |
OLD | NEW |