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

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

Issue 2116693002: PaintChunk::id (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@CommitOnTheWay
Patch Set: - Created 4 years, 5 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 ScopedPaintChunkProperties_h 5 #ifndef ScopedPaintChunkProperties_h
6 #define ScopedPaintChunkProperties_h 6 #define ScopedPaintChunkProperties_h
7 7
8 #include "platform/graphics/paint/DisplayItem.h"
8 #include "platform/graphics/paint/PaintChunkProperties.h" 9 #include "platform/graphics/paint/PaintChunkProperties.h"
9 #include "platform/graphics/paint/PaintController.h" 10 #include "platform/graphics/paint/PaintController.h"
10 #include "wtf/Allocator.h" 11 #include "wtf/Allocator.h"
11 #include "wtf/Noncopyable.h" 12 #include "wtf/Noncopyable.h"
12 13
13 namespace blink { 14 namespace blink {
14 15
15 class ScopedPaintChunkProperties { 16 class ScopedPaintChunkProperties {
16 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); 17 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW();
17 WTF_MAKE_NONCOPYABLE(ScopedPaintChunkProperties); 18 WTF_MAKE_NONCOPYABLE(ScopedPaintChunkProperties);
18 public: 19 public:
19 ScopedPaintChunkProperties(PaintController& paintController, const PaintChun kProperties& properties) 20 ScopedPaintChunkProperties(PaintController& paintController, const DisplayIt emClient& client, DisplayItem::Type type, const PaintChunkProperties& properties )
20 : m_paintController(paintController) 21 : m_paintController(paintController)
21 , m_previousProperties(paintController.currentPaintChunkProperties()) 22 , m_previousProperties(paintController.currentPaintChunkProperties())
22 { 23 {
23 m_paintController.updateCurrentPaintChunkProperties(properties); 24 DisplayItem::Id id(client, type);
25 m_paintController.updateCurrentPaintChunkProperties(&id, properties);
24 } 26 }
25 27
28 // Omits the type parameter, in case that the client creates only one PaintC hunkProperties node during each painting.
29 ScopedPaintChunkProperties(PaintController& paintController, const DisplayIt emClient& client, const PaintChunkProperties& properties)
30 : ScopedPaintChunkProperties(paintController, client, DisplayItem::Unini tializedType, properties)
31 { }
32
26 ~ScopedPaintChunkProperties() 33 ~ScopedPaintChunkProperties()
27 { 34 {
28 m_paintController.updateCurrentPaintChunkProperties(m_previousProperties ); 35 // We should not return to the previous id, because that may cause a new chunk to use
36 // the same id as that of the previous chunk before this ScopedPaintChun kProperties.
pdr. 2016/07/14 22:22:06 Can this happen when we are not skipping the cache
Xianzhu 2016/07/14 23:03:24 Skipping cache will cause chunk with null id, caus
37 // The painter should create another scope of paint properties with new id, or the
38 // new chunk will have no id and will not match any old chunk and will b e treated as
39 // fully invalidated for rasterization.
40 m_paintController.updateCurrentPaintChunkProperties(nullptr, m_previousP roperties);
29 } 41 }
30 42
31 private: 43 private:
32 PaintController& m_paintController; 44 PaintController& m_paintController;
33 PaintChunkProperties m_previousProperties; 45 PaintChunkProperties m_previousProperties;
34 }; 46 };
35 47
36 } // namespace blink 48 } // namespace blink
37 49
38 #endif // ScopedPaintChunkProperties_h 50 #endif // ScopedPaintChunkProperties_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698