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.
5 #ifndef CC_RESOURCES_DISPLAY_ITEM_LIST_H_
6 #define CC_RESOURCES_DISPLAY_ITEM_LIST_H_
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 "ui/gfx/geometry/rect.h"
17 class SkDrawPictureCallback
;
21 class CC_EXPORT DisplayItemList
22 : public base::RefCountedThreadSafe
<DisplayItemList
> {
24 static scoped_refptr
<DisplayItemList
> Create();
26 void Raster(SkCanvas
* canvas
,
27 SkDrawPictureCallback
* callback
,
28 float contents_scale
) const;
30 void AppendItem(scoped_ptr
<DisplayItem
> item
);
32 void set_layer_rect(gfx::Rect layer_rect
) { layer_rect_
= layer_rect
; }
33 gfx::Rect
layer_rect() const { return layer_rect_
; }
35 bool IsSuitableForGpuRasterization() const;
36 int ApproximateOpCount() const;
37 size_t PictureMemoryUsage() const;
39 scoped_refptr
<base::trace_event::ConvertableToTraceFormat
> AsValue() const;
41 void EmitTraceSnapshot() const;
46 ScopedPtrVector
<DisplayItem
> items_
;
47 gfx::Rect layer_rect_
;
48 bool is_suitable_for_gpu_rasterization_
;
49 int approximate_op_count_
;
51 friend class base::RefCountedThreadSafe
<DisplayItemList
>;
52 DISALLOW_COPY_AND_ASSIGN(DisplayItemList
);
57 #endif // CC_RESOURCES_DISPLAY_ITEM_LIST_H_