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