Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(807)

Side by Side Diff: cc/resources/display_item_list.h

Issue 1077033004: cc: Make DisplayItemList::Append replay into an SkPicture (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_RESOURCES_DISPLAY_ITEM_LIST_H_ 5 #ifndef CC_RESOURCES_DISPLAY_ITEM_LIST_H_
6 #define CC_RESOURCES_DISPLAY_ITEM_LIST_H_ 6 #define CC_RESOURCES_DISPLAY_ITEM_LIST_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 "base/trace_event/trace_event.h" 10 #include "base/trace_event/trace_event.h"
11 #include "cc/base/cc_export.h" 11 #include "cc/base/cc_export.h"
12 #include "cc/base/scoped_ptr_vector.h" 12 #include "cc/base/scoped_ptr_vector.h"
13 #include "cc/resources/display_item.h" 13 #include "cc/resources/display_item.h"
14 #include "cc/resources/pixel_ref_map.h" 14 #include "cc/resources/pixel_ref_map.h"
15 #include "skia/ext/refptr.h" 15 #include "skia/ext/refptr.h"
16 #include "third_party/skia/include/core/SkPicture.h" 16 #include "third_party/skia/include/core/SkPicture.h"
17 #include "ui/gfx/geometry/rect.h" 17 #include "ui/gfx/geometry/rect.h"
18 18
19 class SkCanvas; 19 class SkCanvas;
20 class SkDrawPictureCallback; 20 class SkDrawPictureCallback;
21 class SkPictureRecorder;
21 22
22 namespace cc { 23 namespace cc {
23 24
24 class CC_EXPORT DisplayItemList 25 class CC_EXPORT DisplayItemList
25 : public base::RefCountedThreadSafe<DisplayItemList> { 26 : public base::RefCountedThreadSafe<DisplayItemList> {
26 public: 27 public:
27 static scoped_refptr<DisplayItemList> Create(); 28 static scoped_refptr<DisplayItemList> Create(gfx::Rect layer_rect);
28 29
29 void Raster(SkCanvas* canvas, 30 void Raster(SkCanvas* canvas,
30 SkDrawPictureCallback* callback, 31 SkDrawPictureCallback* callback,
31 float contents_scale) const; 32 float contents_scale) const;
32 33
33 void AppendItem(scoped_ptr<DisplayItem> item); 34 void AppendItem(scoped_ptr<DisplayItem> item);
34 35
35 void set_layer_rect(gfx::Rect layer_rect) { layer_rect_ = layer_rect; }
36 gfx::Rect layer_rect() const { return layer_rect_; }
37
38 void CreateAndCacheSkPicture(); 36 void CreateAndCacheSkPicture();
39 37
40 bool IsSuitableForGpuRasterization() const; 38 bool IsSuitableForGpuRasterization() const;
41 int ApproximateOpCount() const; 39 int ApproximateOpCount() const;
42 size_t PictureMemoryUsage() const; 40 size_t PictureMemoryUsage() const;
43 41
44 scoped_refptr<base::trace_event::ConvertableToTraceFormat> AsValue() const; 42 scoped_refptr<base::trace_event::ConvertableToTraceFormat> AsValue() const;
45 43
46 void EmitTraceSnapshot() const; 44 void EmitTraceSnapshot() const;
47 45
48 void GatherPixelRefs(const gfx::Size& grid_cell_size); 46 void GatherPixelRefs(const gfx::Size& grid_cell_size);
49 47
50 private: 48 private:
51 DisplayItemList(); 49 explicit DisplayItemList(gfx::Rect layer_rect);
52 ~DisplayItemList(); 50 ~DisplayItemList();
53 ScopedPtrVector<DisplayItem> items_; 51 ScopedPtrVector<DisplayItem> items_;
54 skia::RefPtr<SkPicture> picture_; 52 skia::RefPtr<SkPicture> picture_;
55 53
54 scoped_ptr<SkPictureRecorder> recorder_;
55 skia::RefPtr<SkCanvas> canvas_;
56 bool retain_individual_display_items_;
57
56 gfx::Rect layer_rect_; 58 gfx::Rect layer_rect_;
57 bool is_suitable_for_gpu_rasterization_; 59 bool is_suitable_for_gpu_rasterization_;
58 int approximate_op_count_; 60 int approximate_op_count_;
59 61
60 scoped_ptr<PixelRefMap> pixel_refs_; 62 scoped_ptr<PixelRefMap> pixel_refs_;
61 63
62 friend class base::RefCountedThreadSafe<DisplayItemList>; 64 friend class base::RefCountedThreadSafe<DisplayItemList>;
63 friend class PixelRefMap::Iterator; 65 friend class PixelRefMap::Iterator;
64 DISALLOW_COPY_AND_ASSIGN(DisplayItemList); 66 DISALLOW_COPY_AND_ASSIGN(DisplayItemList);
65 }; 67 };
66 68
67 } // namespace cc 69 } // namespace cc
68 70
69 #endif // CC_RESOURCES_DISPLAY_ITEM_LIST_H_ 71 #endif // CC_RESOURCES_DISPLAY_ITEM_LIST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698