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

Side by Side Diff: third_party/WebKit/Source/platform/graphics/paint/PaintArtifact.h

Issue 2876033005: Track slow paths in DisplayItemList (Closed)
Patch Set: danakj review Created 3 years, 6 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 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 #ifndef PaintArtifact_h 5 #ifndef PaintArtifact_h
6 #define PaintArtifact_h 6 #define PaintArtifact_h
7 7
8 #include "platform/PlatformExport.h" 8 #include "platform/PlatformExport.h"
9 #include "platform/graphics/paint/DisplayItemList.h" 9 #include "platform/graphics/paint/DisplayItemList.h"
10 #include "platform/graphics/paint/PaintCanvas.h" 10 #include "platform/graphics/paint/PaintCanvas.h"
(...skipping 18 matching lines...) Expand all
29 // state (e.g. chunk bounding boxes computed). 29 // state (e.g. chunk bounding boxes computed).
30 // 30 //
31 // Reminder: moved-from objects may not be in a known state. They can only 31 // Reminder: moved-from objects may not be in a known state. They can only
32 // safely be assigned to or destroyed. 32 // safely be assigned to or destroyed.
33 class PLATFORM_EXPORT PaintArtifact final { 33 class PLATFORM_EXPORT PaintArtifact final {
34 DISALLOW_NEW(); 34 DISALLOW_NEW();
35 WTF_MAKE_NONCOPYABLE(PaintArtifact); 35 WTF_MAKE_NONCOPYABLE(PaintArtifact);
36 36
37 public: 37 public:
38 PaintArtifact(); 38 PaintArtifact();
39 PaintArtifact(DisplayItemList, 39 PaintArtifact(DisplayItemList, Vector<PaintChunk>, int num_slow_paths);
40 Vector<PaintChunk>,
41 bool is_suitable_for_gpu_rasterization);
42 PaintArtifact(PaintArtifact&&); 40 PaintArtifact(PaintArtifact&&);
43 ~PaintArtifact(); 41 ~PaintArtifact();
44 42
45 PaintArtifact& operator=(PaintArtifact&&); 43 PaintArtifact& operator=(PaintArtifact&&);
46 44
47 bool IsEmpty() const { return display_item_list_.IsEmpty(); } 45 bool IsEmpty() const { return display_item_list_.IsEmpty(); }
48 46
49 DisplayItemList& GetDisplayItemList() { return display_item_list_; } 47 DisplayItemList& GetDisplayItemList() { return display_item_list_; }
50 const DisplayItemList& GetDisplayItemList() const { 48 const DisplayItemList& GetDisplayItemList() const {
51 return display_item_list_; 49 return display_item_list_;
52 } 50 }
53 51
54 Vector<PaintChunk>& PaintChunks() { return paint_chunks_; } 52 Vector<PaintChunk>& PaintChunks() { return paint_chunks_; }
55 const Vector<PaintChunk>& PaintChunks() const { return paint_chunks_; } 53 const Vector<PaintChunk>& PaintChunks() const { return paint_chunks_; }
56 54
57 Vector<PaintChunk>::const_iterator FindChunkByDisplayItemIndex( 55 Vector<PaintChunk>::const_iterator FindChunkByDisplayItemIndex(
58 size_t index) const { 56 size_t index) const {
59 return FindChunkInVectorByDisplayItemIndex(paint_chunks_, index); 57 return FindChunkInVectorByDisplayItemIndex(paint_chunks_, index);
60 } 58 }
61 59
62 bool IsSuitableForGpuRasterization() const { 60 int NumSlowPaths() const { return num_slow_paths_; }
63 return is_suitable_for_gpu_rasterization_;
64 }
65 61
66 // Resets to an empty paint artifact. 62 // Resets to an empty paint artifact.
67 void Reset(); 63 void Reset();
68 64
69 // Returns the approximate memory usage, excluding memory likely to be 65 // Returns the approximate memory usage, excluding memory likely to be
70 // shared with the embedder after copying to WebDisplayItemList. 66 // shared with the embedder after copying to WebDisplayItemList.
71 size_t ApproximateUnsharedMemoryUsage() const; 67 size_t ApproximateUnsharedMemoryUsage() const;
72 68
73 // Draws the paint artifact to a GraphicsContext. 69 // Draws the paint artifact to a GraphicsContext.
74 // |bounds| is the bounding box of the paint artifact's display list. 70 // |bounds| is the bounding box of the paint artifact's display list.
75 void Replay(const FloatRect& bounds, GraphicsContext&) const; 71 void Replay(const FloatRect& bounds, GraphicsContext&) const;
76 72
77 // Draws the paint artifact to a PaintCanvas. 73 // Draws the paint artifact to a PaintCanvas.
78 // |bounds| is the bounding box of the paint artifact's display list. 74 // |bounds| is the bounding box of the paint artifact's display list.
79 // SPv2 only. 75 // SPv2 only.
80 // In SPv2 mode, replays into the ancestor state given by |replayState|. 76 // In SPv2 mode, replays into the ancestor state given by |replayState|.
81 void Replay( 77 void Replay(
82 const FloatRect& bounds, 78 const FloatRect& bounds,
83 PaintCanvas&, 79 PaintCanvas&,
84 const PropertyTreeState& replay_state = PropertyTreeState::Root()) const; 80 const PropertyTreeState& replay_state = PropertyTreeState::Root()) const;
85 81
86 // Writes the paint artifact into a WebDisplayItemList. 82 // Writes the paint artifact into a WebDisplayItemList.
87 void AppendToWebDisplayItemList(const LayoutSize& visual_rect_offset, 83 void AppendToWebDisplayItemList(const LayoutSize& visual_rect_offset,
88 WebDisplayItemList*) const; 84 WebDisplayItemList*) const;
89 85
90 private: 86 private:
91 DisplayItemList display_item_list_; 87 DisplayItemList display_item_list_;
92 Vector<PaintChunk> paint_chunks_; 88 Vector<PaintChunk> paint_chunks_;
93 bool is_suitable_for_gpu_rasterization_; 89 int num_slow_paths_ = 0;
94 }; 90 };
95 91
96 } // namespace blink 92 } // namespace blink
97 93
98 #endif // PaintArtifact_h 94 #endif // PaintArtifact_h
OLDNEW
« no previous file with comments | « cc/paint/paint_op_buffer_unittest.cc ('k') | third_party/WebKit/Source/platform/graphics/paint/PaintArtifact.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698