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

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

Issue 1494223003: cc: Shrink size of display item (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Make ui compile too oops Created 5 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
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_DISPLAY_ITEM_H_ 5 #ifndef CC_PLAYBACK_DISPLAY_ITEM_H_
6 #define CC_PLAYBACK_DISPLAY_ITEM_H_ 6 #define CC_PLAYBACK_DISPLAY_ITEM_H_
7 7
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "cc/base/cc_export.h" 9 #include "cc/base/cc_export.h"
10 #include "cc/debug/traced_value.h" 10 #include "cc/debug/traced_value.h"
11 #include "third_party/skia/include/core/SkPicture.h" 11 #include "third_party/skia/include/core/SkPicture.h"
12 #include "ui/gfx/geometry/rect.h" 12 #include "ui/gfx/geometry/rect.h"
13 13
14 class SkCanvas; 14 class SkCanvas;
15 15
16 namespace cc { 16 namespace cc {
17 17
18 namespace proto { 18 namespace proto {
19 class DisplayItem; 19 class DisplayItem;
20 } 20 }
21 21
22 class CC_EXPORT DisplayItem { 22 class CC_EXPORT DisplayItem {
23 public: 23 public:
24 virtual ~DisplayItem() {} 24 virtual ~DisplayItem() {}
25 25
26 void SetNew(bool is_suitable_for_gpu_rasterization,
27 int approximate_op_count,
28 size_t external_memory_usage) {
29 is_suitable_for_gpu_rasterization_ = is_suitable_for_gpu_rasterization;
30 approximate_op_count_ = approximate_op_count;
31 external_memory_usage_ = external_memory_usage;
32 }
33
34 virtual void ToProtobuf(proto::DisplayItem* proto) const = 0; 26 virtual void ToProtobuf(proto::DisplayItem* proto) const = 0;
35 virtual void FromProtobuf(const proto::DisplayItem& proto) = 0; 27 virtual void FromProtobuf(const proto::DisplayItem& proto) = 0;
36 virtual void Raster(SkCanvas* canvas, 28 virtual void Raster(SkCanvas* canvas,
37 const gfx::Rect& canvas_target_playback_rect, 29 const gfx::Rect& canvas_target_playback_rect,
38 SkPicture::AbortCallback* callback) const = 0; 30 SkPicture::AbortCallback* callback) const = 0;
39 virtual void AsValueInto(const gfx::Rect& visual_rect, 31 virtual void AsValueInto(const gfx::Rect& visual_rect,
40 base::trace_event::TracedValue* array) const = 0; 32 base::trace_event::TracedValue* array) const = 0;
41 33 virtual size_t ExternalMemoryUsage() const = 0;
42 bool is_suitable_for_gpu_rasterization() const { 34 virtual int ApproximateOpCount() const = 0;
43 return is_suitable_for_gpu_rasterization_; 35 virtual bool IsSuitableForGpuRasterization() const;
44 }
45 int approximate_op_count() const { return approximate_op_count_; }
46 size_t external_memory_usage() const { return external_memory_usage_; }
47 36
48 protected: 37 protected:
49 DisplayItem(); 38 DisplayItem();
50
51 bool is_suitable_for_gpu_rasterization_;
52 int approximate_op_count_;
53
54 // The size, in bytes, of the memory owned by this display item but not
55 // allocated within it (e.g. held through scoped_ptr or vector).
56 size_t external_memory_usage_;
57 }; 39 };
58 40
59 } // namespace cc 41 } // namespace cc
60 42
61 #endif // CC_PLAYBACK_DISPLAY_ITEM_H_ 43 #endif // CC_PLAYBACK_DISPLAY_ITEM_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698