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

Side by Side Diff: cc/playback/filter_display_item.h

Issue 2561523002: cc: Devirtualize DisplayItem::ExternalMemoryUsage(). (Closed)
Patch Set: externalmem: . Created 4 years 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
« no previous file with comments | « cc/playback/drawing_display_item.cc ('k') | cc/playback/filter_display_item.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_PLAYBACK_FILTER_DISPLAY_ITEM_H_ 5 #ifndef CC_PLAYBACK_FILTER_DISPLAY_ITEM_H_
6 #define CC_PLAYBACK_FILTER_DISPLAY_ITEM_H_ 6 #define CC_PLAYBACK_FILTER_DISPLAY_ITEM_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 14 matching lines...) Expand all
25 const gfx::RectF& bounds, 25 const gfx::RectF& bounds,
26 const gfx::PointF& origin); 26 const gfx::PointF& origin);
27 explicit FilterDisplayItem(const proto::DisplayItem& proto); 27 explicit FilterDisplayItem(const proto::DisplayItem& proto);
28 ~FilterDisplayItem() override; 28 ~FilterDisplayItem() override;
29 29
30 void ToProtobuf(proto::DisplayItem* proto) const override; 30 void ToProtobuf(proto::DisplayItem* proto) const override;
31 void Raster(SkCanvas* canvas, 31 void Raster(SkCanvas* canvas,
32 SkPicture::AbortCallback* callback) const override; 32 SkPicture::AbortCallback* callback) const override;
33 void AsValueInto(const gfx::Rect& visual_rect, 33 void AsValueInto(const gfx::Rect& visual_rect,
34 base::trace_event::TracedValue* array) const override; 34 base::trace_event::TracedValue* array) const override;
35 size_t ExternalMemoryUsage() const override;
36 35
36 size_t ExternalMemoryUsage() const {
37 // FilterOperations doesn't expose its capacity, but size is probably good
38 // enough.
39 return filters_.size() * sizeof(filters_.at(0));
40 }
37 int ApproximateOpCount() const { return 1; } 41 int ApproximateOpCount() const { return 1; }
38 42
39 private: 43 private:
40 void SetNew(const FilterOperations& filters, 44 void SetNew(const FilterOperations& filters,
41 const gfx::RectF& bounds, 45 const gfx::RectF& bounds,
42 const gfx::PointF& origin); 46 const gfx::PointF& origin);
43 47
44 FilterOperations filters_; 48 FilterOperations filters_;
45 gfx::RectF bounds_; 49 gfx::RectF bounds_;
46 gfx::PointF origin_; 50 gfx::PointF origin_;
47 }; 51 };
48 52
49 class CC_EXPORT EndFilterDisplayItem : public DisplayItem { 53 class CC_EXPORT EndFilterDisplayItem : public DisplayItem {
50 public: 54 public:
51 EndFilterDisplayItem(); 55 EndFilterDisplayItem();
52 explicit EndFilterDisplayItem(const proto::DisplayItem& proto); 56 explicit EndFilterDisplayItem(const proto::DisplayItem& proto);
53 ~EndFilterDisplayItem() override; 57 ~EndFilterDisplayItem() override;
54 58
55 static std::unique_ptr<EndFilterDisplayItem> Create() { 59 static std::unique_ptr<EndFilterDisplayItem> Create() {
56 return base::MakeUnique<EndFilterDisplayItem>(); 60 return base::MakeUnique<EndFilterDisplayItem>();
57 } 61 }
58 62
59 void ToProtobuf(proto::DisplayItem* proto) const override; 63 void ToProtobuf(proto::DisplayItem* proto) const override;
60 void Raster(SkCanvas* canvas, 64 void Raster(SkCanvas* canvas,
61 SkPicture::AbortCallback* callback) const override; 65 SkPicture::AbortCallback* callback) const override;
62 void AsValueInto(const gfx::Rect& visual_rect, 66 void AsValueInto(const gfx::Rect& visual_rect,
63 base::trace_event::TracedValue* array) const override; 67 base::trace_event::TracedValue* array) const override;
64 size_t ExternalMemoryUsage() const override;
65 68
66 int ApproximateOpCount() const { return 0; } 69 int ApproximateOpCount() const { return 0; }
67 }; 70 };
68 71
69 } // namespace cc 72 } // namespace cc
70 73
71 #endif // CC_PLAYBACK_FILTER_DISPLAY_ITEM_H_ 74 #endif // CC_PLAYBACK_FILTER_DISPLAY_ITEM_H_
OLDNEW
« no previous file with comments | « cc/playback/drawing_display_item.cc ('k') | cc/playback/filter_display_item.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698