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

Side by Side Diff: Source/platform/graphics/paint/DrawingDisplayItem.h

Issue 1193433004: Blink-side contiguous allocation of display items. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Ready for review Created 5 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 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 DrawingDisplayItem_h 5 #ifndef DrawingDisplayItem_h
6 #define DrawingDisplayItem_h 6 #define DrawingDisplayItem_h
7 7
8 #include "platform/PlatformExport.h" 8 #include "platform/PlatformExport.h"
9 #include "platform/geometry/FloatPoint.h" 9 #include "platform/geometry/FloatPoint.h"
10 #include "platform/graphics/paint/DisplayItem.h" 10 #include "platform/graphics/paint/DisplayItem.h"
11 #include "third_party/skia/include/core/SkPicture.h" 11 #include "third_party/skia/include/core/SkPicture.h"
12 #include "wtf/PassOwnPtr.h" 12 #include "wtf/PassOwnPtr.h"
13 13
14 namespace blink { 14 namespace blink {
15 15
16 class PLATFORM_EXPORT DrawingDisplayItem : public DisplayItem { 16 class PLATFORM_EXPORT DrawingDisplayItem : public DisplayItem {
17 public: 17 public:
18 #if ENABLE(ASSERT) 18 #if ENABLE(ASSERT)
19 enum UnderInvalidationCheckingMode { 19 enum UnderInvalidationCheckingMode {
20 CheckPicture, // Check if the new picture and the old picture are the sa me 20 CheckPicture, // Check if the new picture and the old picture are the sa me
21 CheckBitmap, // Check if the new picture and the old picture produce the same bitmap 21 CheckBitmap, // Check if the new picture and the old picture produce the same bitmap
22 }; 22 };
23 #endif 23 #endif
24 24
25 DrawingDisplayItem(const DisplayItemClientWrapper& client, Type type, PassRe fPtr<const SkPicture> picture) 25 DrawingDisplayItem(const DisplayItemClientWrapper& client, Type type, PassRe fPtr<const SkPicture> picture)
26 : DisplayItem(client, type) 26 : DisplayItem(client, type)
27 , m_picture(picture && picture->approximateOpCount() ? picture : nullptr ) 27 , m_picture(picture && picture->approximateOpCount() ? picture : nullptr )
28 #if ENABLE(ASSERT)
29 , m_underInvalidationCheckingMode(CheckPicture)
30 #endif
31 { 28 {
32 ASSERT(isDrawingType(type)); 29 ASSERT(isDrawingType(type));
33 } 30 }
34 31
35 static PassOwnPtr<DrawingDisplayItem> create(const DisplayItemClientWrapper& client, Type type, PassRefPtr<const SkPicture> picture) 32 #if ENABLE(ASSERT)
33 DrawingDisplayItem(const DisplayItemClientWrapper& client, Type type, PassRe fPtr<const SkPicture> picture, UnderInvalidationCheckingMode underInvalidationCh eckingMode)
34 : DisplayItem(client, type)
35 , m_picture(picture && picture->approximateOpCount() ? picture : nullptr )
36 , m_underInvalidationCheckingMode(underInvalidationCheckingMode)
36 { 37 {
37 return adoptPtr(new DrawingDisplayItem(client, type, picture)); 38 ASSERT(isDrawingType(type));
38 } 39 }
40 #endif
39 41
40 virtual void replay(GraphicsContext&); 42 void replay(GraphicsContext&) override;
41 virtual void appendToWebDisplayItemList(WebDisplayItemList*) const override; 43 void appendToWebDisplayItemList(WebDisplayItemList*) const override;
42 virtual bool drawsContent() const override; 44 void appendByMoving(DisplayItems&) override;
45 bool drawsContent() const override;
43 46
44 const SkPicture* picture() const { return m_picture.get(); } 47 const SkPicture* picture() const { return m_picture.get(); }
45 48
46 #if ENABLE(ASSERT) 49 #if ENABLE(ASSERT)
47 void setUnderInvalidationCheckingMode(UnderInvalidationCheckingMode mode) { m_underInvalidationCheckingMode = mode; } 50 void setUnderInvalidationCheckingMode(UnderInvalidationCheckingMode mode) { m_underInvalidationCheckingMode = mode; }
48 UnderInvalidationCheckingMode underInvalidationCheckingMode() const { return m_underInvalidationCheckingMode; } 51 UnderInvalidationCheckingMode underInvalidationCheckingMode() const { return m_underInvalidationCheckingMode; }
49 #endif 52 #endif
50 53
51 private: 54 private:
52 #ifndef NDEBUG 55 #ifndef NDEBUG
53 virtual void dumpPropertiesAsDebugString(WTF::StringBuilder&) const override ; 56 virtual void dumpPropertiesAsDebugString(WTF::StringBuilder&) const override ;
54 #endif 57 #endif
55 58
56 RefPtr<const SkPicture> m_picture; 59 RefPtr<const SkPicture> m_picture;
57 60
58 #if ENABLE(ASSERT) 61 #if ENABLE(ASSERT)
59 UnderInvalidationCheckingMode m_underInvalidationCheckingMode; 62 UnderInvalidationCheckingMode m_underInvalidationCheckingMode;
60 #endif 63 #endif
61 }; 64 };
62 65
63 } // namespace blink 66 } // namespace blink
64 67
65 #endif // DrawingDisplayItem_h 68 #endif // DrawingDisplayItem_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698