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

Side by Side Diff: cc/playback/float_clip_display_item.cc

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/float_clip_display_item.h ('k') | cc/playback/transform_display_item.h » ('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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 #include "cc/playback/float_clip_display_item.h" 5 #include "cc/playback/float_clip_display_item.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/strings/stringprintf.h" 9 #include "base/strings/stringprintf.h"
10 #include "base/trace_event/trace_event_argument.h" 10 #include "base/trace_event/trace_event_argument.h"
11 #include "cc/proto/display_item.pb.h" 11 #include "cc/proto/display_item.pb.h"
12 #include "cc/proto/gfx_conversions.h" 12 #include "cc/proto/gfx_conversions.h"
13 #include "third_party/skia/include/core/SkCanvas.h" 13 #include "third_party/skia/include/core/SkCanvas.h"
14 #include "ui/gfx/skia_util.h" 14 #include "ui/gfx/skia_util.h"
15 15
16 namespace cc { 16 namespace cc {
17 17
18 FloatClipDisplayItem::FloatClipDisplayItem(const gfx::RectF& clip_rect) { 18 FloatClipDisplayItem::FloatClipDisplayItem(const gfx::RectF& clip_rect)
19 : DisplayItem(FLOAT_CLIP) {
19 SetNew(clip_rect); 20 SetNew(clip_rect);
20 } 21 }
21 22
22 FloatClipDisplayItem::FloatClipDisplayItem(const proto::DisplayItem& proto) { 23 FloatClipDisplayItem::FloatClipDisplayItem(const proto::DisplayItem& proto)
24 : DisplayItem(FLOAT_CLIP) {
23 DCHECK_EQ(proto::DisplayItem::Type_FloatClip, proto.type()); 25 DCHECK_EQ(proto::DisplayItem::Type_FloatClip, proto.type());
24 26
25 const proto::FloatClipDisplayItem& details = proto.float_clip_item(); 27 const proto::FloatClipDisplayItem& details = proto.float_clip_item();
26 gfx::RectF clip_rect = ProtoToRectF(details.clip_rect()); 28 gfx::RectF clip_rect = ProtoToRectF(details.clip_rect());
27 29
28 SetNew(clip_rect); 30 SetNew(clip_rect);
29 } 31 }
30 32
31 FloatClipDisplayItem::~FloatClipDisplayItem() { 33 FloatClipDisplayItem::~FloatClipDisplayItem() {
32 } 34 }
(...skipping 16 matching lines...) Expand all
49 } 51 }
50 52
51 void FloatClipDisplayItem::AsValueInto( 53 void FloatClipDisplayItem::AsValueInto(
52 const gfx::Rect& visual_rect, 54 const gfx::Rect& visual_rect,
53 base::trace_event::TracedValue* array) const { 55 base::trace_event::TracedValue* array) const {
54 array->AppendString(base::StringPrintf( 56 array->AppendString(base::StringPrintf(
55 "FloatClipDisplayItem rect: [%s] visualRect: [%s]", 57 "FloatClipDisplayItem rect: [%s] visualRect: [%s]",
56 clip_rect_.ToString().c_str(), visual_rect.ToString().c_str())); 58 clip_rect_.ToString().c_str(), visual_rect.ToString().c_str()));
57 } 59 }
58 60
59 size_t FloatClipDisplayItem::ExternalMemoryUsage() const { 61 EndFloatClipDisplayItem::EndFloatClipDisplayItem()
60 return 0; 62 : DisplayItem(END_FLOAT_CLIP) {}
61 }
62
63 EndFloatClipDisplayItem::EndFloatClipDisplayItem() {}
64 63
65 EndFloatClipDisplayItem::EndFloatClipDisplayItem( 64 EndFloatClipDisplayItem::EndFloatClipDisplayItem(
66 const proto::DisplayItem& proto) { 65 const proto::DisplayItem& proto)
66 : DisplayItem(END_FLOAT_CLIP) {
67 DCHECK_EQ(proto::DisplayItem::Type_EndFloatClip, proto.type()); 67 DCHECK_EQ(proto::DisplayItem::Type_EndFloatClip, proto.type());
68 } 68 }
69 69
70 EndFloatClipDisplayItem::~EndFloatClipDisplayItem() { 70 EndFloatClipDisplayItem::~EndFloatClipDisplayItem() {
71 } 71 }
72 72
73 void EndFloatClipDisplayItem::ToProtobuf(proto::DisplayItem* proto) const { 73 void EndFloatClipDisplayItem::ToProtobuf(proto::DisplayItem* proto) const {
74 proto->set_type(proto::DisplayItem::Type_EndFloatClip); 74 proto->set_type(proto::DisplayItem::Type_EndFloatClip);
75 } 75 }
76 76
77 void EndFloatClipDisplayItem::Raster( 77 void EndFloatClipDisplayItem::Raster(
78 SkCanvas* canvas, 78 SkCanvas* canvas,
79 SkPicture::AbortCallback* callback) const { 79 SkPicture::AbortCallback* callback) const {
80 canvas->restore(); 80 canvas->restore();
81 } 81 }
82 82
83 void EndFloatClipDisplayItem::AsValueInto( 83 void EndFloatClipDisplayItem::AsValueInto(
84 const gfx::Rect& visual_rect, 84 const gfx::Rect& visual_rect,
85 base::trace_event::TracedValue* array) const { 85 base::trace_event::TracedValue* array) const {
86 array->AppendString( 86 array->AppendString(
87 base::StringPrintf("EndFloatClipDisplayItem visualRect: [%s]", 87 base::StringPrintf("EndFloatClipDisplayItem visualRect: [%s]",
88 visual_rect.ToString().c_str())); 88 visual_rect.ToString().c_str()));
89 } 89 }
90 90
91 size_t EndFloatClipDisplayItem::ExternalMemoryUsage() const {
92 return 0;
93 }
94
95 } // namespace cc 91 } // namespace cc
OLDNEW
« no previous file with comments | « cc/playback/float_clip_display_item.h ('k') | cc/playback/transform_display_item.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698