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

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

Issue 1396783003: Factor PaintArtifact out of DisplayItemList. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@const-replay
Patch Set: Created 5 years, 2 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef DisplayItems_h
6 #define DisplayItems_h
7
8 #include "platform/graphics/ContiguousContainer.h"
9 #include "platform/graphics/paint/DisplayItem.h"
10 #include "platform/graphics/paint/Transform3DDisplayItem.h"
11 #include "wtf/Alignment.h"
12 #include "wtf/Assertions.h"
13
14 #ifndef NDEBUG
15 #include "wtf/text/WTFString.h"
16 #endif
17
18 namespace blink {
19
20 // kDisplayItemAlignment must be a multiple of alignof(derived display item) for
21 // each derived display item; the ideal value is the least common multiple.
22 // Currently the limiting factor is TransformtionMatrix (in
wkorman 2015/10/09 04:45:50 Transformtion -> Transformation
23 // BeginTransform3DDisplayItem), which requests 16-byte alignment.
24 static const size_t kDisplayItemAlignment = WTF_ALIGN_OF(BeginTransform3DDisplay Item);
25 static const size_t kMaximumDisplayItemSize = sizeof(BeginTransform3DDisplayItem );
26
27 // A container for a list of display items.
28 class DisplayItems : public ContiguousContainer<DisplayItem, kDisplayItemAlignme nt> {
pdr. 2015/10/09 03:57:51 What do you think about expanding this class a bit
pdr. 2015/10/13 18:30:32 This is kind of high-level but I'd like your thoug
29 public:
30 DisplayItems(size_t initialSizeBytes)
31 : ContiguousContainer(kMaximumDisplayItemSize, initialSizeBytes) {}
32
33 DisplayItem& appendByMoving(DisplayItem& item)
34 {
35 #ifndef NDEBUG
36 WTF::String originalDebugString = item.asDebugString();
37 #endif
38 ASSERT(item.isValid());
39 DisplayItem& result = ContiguousContainer::appendByMoving(item, item.der ivedSize());
40 // ContiguousContainer::appendByMoving() called in-place constructor on item, which invalidated it.
41 ASSERT(!item.isValid());
42 #ifndef NDEBUG
43 // Save original debug string in the old item to help debugging.
44 item.setClientDebugString(originalDebugString);
45 #endif
46 return result;
47 }
48 };
49
50 } // namespace blink
51
52 #endif // DisplayItems_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698