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

Side by Side Diff: cc/playback/clip_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 | « no previous file | cc/playback/clip_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_CLIP_DISPLAY_ITEM_H_ 5 #ifndef CC_PLAYBACK_CLIP_DISPLAY_ITEM_H_
6 #define CC_PLAYBACK_CLIP_DISPLAY_ITEM_H_ 6 #define CC_PLAYBACK_CLIP_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 std::vector<SkRRect>& rounded_clip_rects, 25 const std::vector<SkRRect>& rounded_clip_rects,
26 bool antialias); 26 bool antialias);
27 explicit ClipDisplayItem(const proto::DisplayItem& proto); 27 explicit ClipDisplayItem(const proto::DisplayItem& proto);
28 ~ClipDisplayItem() override; 28 ~ClipDisplayItem() 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 return rounded_clip_rects_.capacity() * sizeof(rounded_clip_rects_[0]);
38 }
37 int ApproximateOpCount() const { return 1; } 39 int ApproximateOpCount() const { return 1; }
38 40
39 private: 41 private:
40 void SetNew(const gfx::Rect& clip_rect, 42 void SetNew(const gfx::Rect& clip_rect,
41 const std::vector<SkRRect>& rounded_clip_rects, 43 const std::vector<SkRRect>& rounded_clip_rects,
42 bool antialias); 44 bool antialias);
43 45
44 gfx::Rect clip_rect_; 46 gfx::Rect clip_rect_;
45 std::vector<SkRRect> rounded_clip_rects_; 47 std::vector<SkRRect> rounded_clip_rects_;
46 bool antialias_; 48 bool antialias_;
47 }; 49 };
48 50
49 class CC_EXPORT EndClipDisplayItem : public DisplayItem { 51 class CC_EXPORT EndClipDisplayItem : public DisplayItem {
50 public: 52 public:
51 EndClipDisplayItem(); 53 EndClipDisplayItem();
52 explicit EndClipDisplayItem(const proto::DisplayItem& proto); 54 explicit EndClipDisplayItem(const proto::DisplayItem& proto);
53 ~EndClipDisplayItem() override; 55 ~EndClipDisplayItem() override;
54 56
55 void ToProtobuf(proto::DisplayItem* proto) const override; 57 void ToProtobuf(proto::DisplayItem* proto) const override;
56 void Raster(SkCanvas* canvas, 58 void Raster(SkCanvas* canvas,
57 SkPicture::AbortCallback* callback) const override; 59 SkPicture::AbortCallback* callback) const override;
58 void AsValueInto(const gfx::Rect& visual_rect, 60 void AsValueInto(const gfx::Rect& visual_rect,
59 base::trace_event::TracedValue* array) const override; 61 base::trace_event::TracedValue* array) const override;
60 size_t ExternalMemoryUsage() const override;
61 62
62 int ApproximateOpCount() const { return 0; } 63 int ApproximateOpCount() const { return 0; }
63 }; 64 };
64 65
65 } // namespace cc 66 } // namespace cc
66 67
67 #endif // CC_PLAYBACK_CLIP_DISPLAY_ITEM_H_ 68 #endif // CC_PLAYBACK_CLIP_DISPLAY_ITEM_H_
OLDNEW
« no previous file with comments | « no previous file | cc/playback/clip_display_item.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698