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

Side by Side Diff: third_party/WebKit/Source/platform/graphics/paint/DisplayItemClient.cpp

Issue 2066603005: Check DisplayItemCient aliveness in cached subsequences (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update comments Created 4 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 #include "platform/graphics/paint/DisplayItemClient.h" 5 #include "platform/graphics/paint/DisplayItemClient.h"
6 6
7 #if CHECK_DISPLAY_ITEM_CLIENT_ALIVENESS 7 #if CHECK_DISPLAY_ITEM_CLIENT_ALIVENESS
8 #include "wtf/HashMap.h" 8 #include "wtf/HashMap.h"
9 #include "wtf/HashSet.h" 9 #include "wtf/HashSet.h"
10 #endif 10 #endif
(...skipping 21 matching lines...) Expand all
32 DisplayItemClient::~DisplayItemClient() 32 DisplayItemClient::~DisplayItemClient()
33 { 33 {
34 if (displayItemClientsShouldKeepAlive) { 34 if (displayItemClientsShouldKeepAlive) {
35 for (auto& item : *displayItemClientsShouldKeepAlive) { 35 for (auto& item : *displayItemClientsShouldKeepAlive) {
36 CHECK(!item.value.contains(this)) 36 CHECK(!item.value.contains(this))
37 << "Short-lived DisplayItemClient: " << item.value.get(this) 37 << "Short-lived DisplayItemClient: " << item.value.get(this)
38 << ". See crbug.com/570030."; 38 << ". See crbug.com/570030.";
39 } 39 }
40 } 40 }
41 liveDisplayItemClients->remove(this); 41 liveDisplayItemClients->remove(this);
42 // In case this object is a subsequence owner.
43 endShouldKeepAliveAllClients(this);
42 } 44 }
43 45
44 bool DisplayItemClient::isAlive() const 46 bool DisplayItemClient::isAlive() const
45 { 47 {
46 return liveDisplayItemClients && liveDisplayItemClients->contains(this); 48 return liveDisplayItemClients && liveDisplayItemClients->contains(this);
47 } 49 }
48 50
49 void DisplayItemClient::beginShouldKeepAlive(const void* paintController) const 51 void DisplayItemClient::beginShouldKeepAlive(const void* owner) const
50 { 52 {
51 CHECK(isAlive()); 53 CHECK(isAlive());
52 if (!displayItemClientsShouldKeepAlive) 54 if (!displayItemClientsShouldKeepAlive)
53 displayItemClientsShouldKeepAlive = new HashMap<const void*, HashMap<con st DisplayItemClient*, String>>(); 55 displayItemClientsShouldKeepAlive = new HashMap<const void*, HashMap<con st DisplayItemClient*, String>>();
54 auto addResult = displayItemClientsShouldKeepAlive->add(paintController, Has hMap<const DisplayItemClient*, String>()).storedValue->value.add(this, ""); 56 auto addResult = displayItemClientsShouldKeepAlive->add(owner, HashMap<const DisplayItemClient*, String>()).storedValue->value.add(this, "");
55 if (addResult.isNewEntry) 57 if (addResult.isNewEntry)
56 addResult.storedValue->value = debugName(); 58 addResult.storedValue->value = debugName();
57 } 59 }
58 60
59 void DisplayItemClient::endShouldKeepAliveAllClients(const void* paintController ) 61 void DisplayItemClient::endShouldKeepAliveAllClients(const void* owner)
60 { 62 {
61 if (displayItemClientsShouldKeepAlive) 63 if (displayItemClientsShouldKeepAlive)
62 displayItemClientsShouldKeepAlive->remove(paintController); 64 displayItemClientsShouldKeepAlive->remove(owner);
63 } 65 }
64 66
65 void DisplayItemClient::endShouldKeepAliveAllClients() 67 void DisplayItemClient::endShouldKeepAliveAllClients()
66 { 68 {
67 delete displayItemClientsShouldKeepAlive; 69 delete displayItemClientsShouldKeepAlive;
68 displayItemClientsShouldKeepAlive = nullptr; 70 displayItemClientsShouldKeepAlive = nullptr;
69 } 71 }
70 72
71 #endif // CHECK_DISPLAY_ITEM_CLIENT_ALIVENESS 73 #endif // CHECK_DISPLAY_ITEM_CLIENT_ALIVENESS
72 74
73 } // namespace blink 75 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698