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

Side by Side Diff: third_party/WebKit/Source/core/css/resolver/MatchedPropertiesCache.h

Issue 1477023003: Refactor the Heap into ThreadHeap to prepare for per thread heaps Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. 3 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
4 * Copyright (C) 2013 Google Inc. All rights reserved. 4 * Copyright (C) 2013 Google Inc. All rights reserved.
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 static bool traceInCollection(VisitorDispatcher visitor, Member<CachedMatche dProperties>& cachedProperties, WTF::ShouldWeakPointersBeMarkedStrongly strongif y) 63 static bool traceInCollection(VisitorDispatcher visitor, Member<CachedMatche dProperties>& cachedProperties, WTF::ShouldWeakPointersBeMarkedStrongly strongif y)
64 { 64 {
65 // Only honor the cache's weakness semantics if the collection is traced 65 // Only honor the cache's weakness semantics if the collection is traced
66 // with WeakPointersActWeak. Otherwise just trace the cachedProperties 66 // with WeakPointersActWeak. Otherwise just trace the cachedProperties
67 // strongly, ie. call trace on it. 67 // strongly, ie. call trace on it.
68 if (cachedProperties && strongify == WTF::WeakPointersActWeak) { 68 if (cachedProperties && strongify == WTF::WeakPointersActWeak) {
69 // A given cache entry is only kept alive if none of the MatchedProp erties 69 // A given cache entry is only kept alive if none of the MatchedProp erties
70 // in the CachedMatchedProperties value contain a dead "properties" field. 70 // in the CachedMatchedProperties value contain a dead "properties" field.
71 // If there is a dead field the entire cache entry is removed. 71 // If there is a dead field the entire cache entry is removed.
72 for (const auto& matchedProperties : cachedProperties->matchedProper ties) { 72 for (const auto& matchedProperties : cachedProperties->matchedProper ties) {
73 if (!Heap::isHeapObjectAlive(matchedProperties.properties)) { 73 if (!ThreadHeap::isHeapObjectAlive(matchedProperties.properties) ) {
74 // For now report the cache entry as dead. This might not 74 // For now report the cache entry as dead. This might not
75 // be the final result if in a subsequent call for this entr y, 75 // be the final result if in a subsequent call for this entr y,
76 // the "properties" field has been marked via another path. 76 // the "properties" field has been marked via another path.
77 return true; 77 return true;
78 } 78 }
79 } 79 }
80 } 80 }
81 // At this point none of the entries in the matchedProperties vector 81 // At this point none of the entries in the matchedProperties vector
82 // had a dead "properties" field so trace CachedMatchedProperties strong ly. 82 // had a dead "properties" field so trace CachedMatchedProperties strong ly.
83 // FIXME: traceInCollection is also called from WeakProcessing to check if the entry is dead. 83 // FIXME: traceInCollection is also called from WeakProcessing to check if the entry is dead.
84 // Avoid calling trace in that case by only calling trace when cachedPro perties is not yet marked. 84 // Avoid calling trace in that case by only calling trace when cachedPro perties is not yet marked.
85 if (!Heap::isHeapObjectAlive(cachedProperties)) 85 if (!ThreadHeap::isHeapObjectAlive(cachedProperties))
86 visitor->trace(cachedProperties); 86 visitor->trace(cachedProperties);
87 return false; 87 return false;
88 } 88 }
89 }; 89 };
90 #endif 90 #endif
91 91
92 class MatchedPropertiesCache { 92 class MatchedPropertiesCache {
93 DISALLOW_NEW(); 93 DISALLOW_NEW();
94 WTF_MAKE_NONCOPYABLE(MatchedPropertiesCache); 94 WTF_MAKE_NONCOPYABLE(MatchedPropertiesCache);
95 public: 95 public:
(...skipping 25 matching lines...) Expand all
121 121
122 using Cache = HashMap<unsigned, OwnPtr<CachedMatchedProperties>>; 122 using Cache = HashMap<unsigned, OwnPtr<CachedMatchedProperties>>;
123 Timer<MatchedPropertiesCache> m_sweepTimer; 123 Timer<MatchedPropertiesCache> m_sweepTimer;
124 #endif 124 #endif
125 Cache m_cache; 125 Cache m_cache;
126 }; 126 };
127 127
128 } // namespace blink 128 } // namespace blink
129 129
130 #endif 130 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/css/StylePropertySet.cpp ('k') | third_party/WebKit/Source/core/dom/CrossThreadTaskTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698