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

Side by Side Diff: third_party/WebKit/Source/core/dom/PresentationAttributeStyle.cpp

Issue 1850413002: Improve DEFINE_STATIC_LOCAL()'s handling of Blink GCed objects. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address compilation failure Created 4 years, 8 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) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 public: 61 public:
62 DEFINE_INLINE_TRACE() { visitor->trace(value); } 62 DEFINE_INLINE_TRACE() { visitor->trace(value); }
63 63
64 PresentationAttributeCacheKey key; 64 PresentationAttributeCacheKey key;
65 Member<StylePropertySet> value; 65 Member<StylePropertySet> value;
66 }; 66 };
67 67
68 using PresentationAttributeCache = HeapHashMap<unsigned, Member<PresentationAttr ibuteCacheEntry>, AlreadyHashed>; 68 using PresentationAttributeCache = HeapHashMap<unsigned, Member<PresentationAttr ibuteCacheEntry>, AlreadyHashed>;
69 static PresentationAttributeCache& presentationAttributeCache() 69 static PresentationAttributeCache& presentationAttributeCache()
70 { 70 {
71 DEFINE_STATIC_LOCAL(Persistent<PresentationAttributeCache>, cache, (new Pres entationAttributeCache())); 71 DEFINE_STATIC_LOCAL(PresentationAttributeCache, cache, (new PresentationAttr ibuteCache));
72 return *cache; 72 return cache;
73 } 73 }
74 74
75 class PresentationAttributeCacheCleaner { 75 class PresentationAttributeCacheCleaner {
76 WTF_MAKE_NONCOPYABLE(PresentationAttributeCacheCleaner); USING_FAST_MALLOC(P resentationAttributeCacheCleaner); 76 WTF_MAKE_NONCOPYABLE(PresentationAttributeCacheCleaner); USING_FAST_MALLOC(P resentationAttributeCacheCleaner);
77 public: 77 public:
78 PresentationAttributeCacheCleaner() 78 PresentationAttributeCacheCleaner()
79 : m_hitCount(0) 79 : m_hitCount(0)
80 , m_cleanTimer(this, &PresentationAttributeCacheCleaner::cleanCache) 80 , m_cleanTimer(this, &PresentationAttributeCacheCleaner::cleanCache)
81 { 81 {
82 } 82 }
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 presentationAttributeCache().clear(); 198 presentationAttributeCache().clear();
199 presentationAttributeCache().set(cacheHash, newEntry.release()); 199 presentationAttributeCache().set(cacheHash, newEntry.release());
200 } else { 200 } else {
201 cacheValue->value = newEntry.release(); 201 cacheValue->value = newEntry.release();
202 } 202 }
203 203
204 return style.release(); 204 return style.release();
205 } 205 }
206 206
207 } // namespace blink 207 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/Node.cpp ('k') | third_party/WebKit/Source/core/dom/TreeScope.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698