| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CC_RESOURCES_DISPLAY_ITEM_LIST_H_ | |
| 6 #define CC_RESOURCES_DISPLAY_ITEM_LIST_H_ | |
| 7 | |
| 8 #include "base/memory/ref_counted.h" | |
| 9 #include "base/memory/scoped_ptr.h" | |
| 10 #include "base/trace_event/trace_event.h" | |
| 11 #include "cc/base/cc_export.h" | |
| 12 #include "cc/base/scoped_ptr_vector.h" | |
| 13 #include "cc/resources/display_item.h" | |
| 14 #include "skia/ext/refptr.h" | |
| 15 #include "third_party/skia/include/core/SkPicture.h" | |
| 16 #include "ui/gfx/geometry/rect.h" | |
| 17 | |
| 18 class SkCanvas; | |
| 19 class SkDrawPictureCallback; | |
| 20 | |
| 21 namespace cc { | |
| 22 | |
| 23 class CC_EXPORT DisplayItemList | |
| 24 : public base::RefCountedThreadSafe<DisplayItemList> { | |
| 25 public: | |
| 26 static scoped_refptr<DisplayItemList> Create(); | |
| 27 | |
| 28 void Raster(SkCanvas* canvas, | |
| 29 SkDrawPictureCallback* callback, | |
| 30 float contents_scale) const; | |
| 31 | |
| 32 void AppendItem(scoped_ptr<DisplayItem> item); | |
| 33 | |
| 34 void set_layer_rect(gfx::Rect layer_rect) { layer_rect_ = layer_rect; } | |
| 35 gfx::Rect layer_rect() const { return layer_rect_; } | |
| 36 | |
| 37 void CreateAndCacheSkPicture(); | |
| 38 | |
| 39 bool IsSuitableForGpuRasterization() const; | |
| 40 int ApproximateOpCount() const; | |
| 41 size_t PictureMemoryUsage() const; | |
| 42 | |
| 43 scoped_refptr<base::trace_event::ConvertableToTraceFormat> AsValue() const; | |
| 44 | |
| 45 void EmitTraceSnapshot() const; | |
| 46 | |
| 47 private: | |
| 48 DisplayItemList(); | |
| 49 ~DisplayItemList(); | |
| 50 ScopedPtrVector<DisplayItem> items_; | |
| 51 skia::RefPtr<SkPicture> picture_; | |
| 52 | |
| 53 gfx::Rect layer_rect_; | |
| 54 bool is_suitable_for_gpu_rasterization_; | |
| 55 int approximate_op_count_; | |
| 56 | |
| 57 friend class base::RefCountedThreadSafe<DisplayItemList>; | |
| 58 DISALLOW_COPY_AND_ASSIGN(DisplayItemList); | |
| 59 }; | |
| 60 | |
| 61 } // namespace cc | |
| 62 | |
| 63 #endif // CC_RESOURCES_DISPLAY_ITEM_LIST_H_ | |
| OLD | NEW |