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

Side by Side Diff: third_party/WebKit/Source/core/dom/Node.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) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved. 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved.
6 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 6 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) 7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/)
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 { 121 {
122 ASSERT(isMainThread()); 122 ASSERT(isMainThread());
123 partitionFree(ptr); 123 partitionFree(ptr);
124 } 124 }
125 #endif 125 #endif
126 126
127 #if DUMP_NODE_STATISTICS 127 #if DUMP_NODE_STATISTICS
128 using WeakNodeSet = HeapHashSet<WeakMember<Node>>; 128 using WeakNodeSet = HeapHashSet<WeakMember<Node>>;
129 static WeakNodeSet& liveNodeSet() 129 static WeakNodeSet& liveNodeSet()
130 { 130 {
131 DEFINE_STATIC_LOCAL(Persistent<WeakNodeSet>, set, (new WeakNodeSet())); 131 DEFINE_STATIC_LOCAL(WeakNodeSet, set, (new WeakNodeSet));
132 return *set; 132 return set;
133 } 133 }
134 #endif 134 #endif
135 135
136 void Node::dumpStatistics() 136 void Node::dumpStatistics()
137 { 137 {
138 #if DUMP_NODE_STATISTICS 138 #if DUMP_NODE_STATISTICS
139 size_t nodesWithRareData = 0; 139 size_t nodesWithRareData = 0;
140 140
141 size_t elementNodes = 0; 141 size_t elementNodes = 0;
142 size_t attrNodes = 0; 142 size_t attrNodes = 0;
(...skipping 1736 matching lines...) Expand 10 before | Expand all | Expand 10 after
1879 for (Node& node : NodeTraversal::startsAt(this)) { 1879 for (Node& node : NodeTraversal::startsAt(this)) {
1880 node.removeAllEventListeners(); 1880 node.removeAllEventListeners();
1881 for (ShadowRoot* root = node.youngestShadowRoot(); root; root = root->ol derShadowRoot()) 1881 for (ShadowRoot* root = node.youngestShadowRoot(); root; root = root->ol derShadowRoot())
1882 root->removeAllEventListenersRecursively(); 1882 root->removeAllEventListenersRecursively();
1883 } 1883 }
1884 } 1884 }
1885 1885
1886 using EventTargetDataMap = HeapHashMap<WeakMember<Node>, Member<EventTargetData> >; 1886 using EventTargetDataMap = HeapHashMap<WeakMember<Node>, Member<EventTargetData> >;
1887 static EventTargetDataMap& eventTargetDataMap() 1887 static EventTargetDataMap& eventTargetDataMap()
1888 { 1888 {
1889 DEFINE_STATIC_LOCAL(Persistent<EventTargetDataMap>, map, (new EventTargetDat aMap())); 1889 DEFINE_STATIC_LOCAL(EventTargetDataMap, map, (new EventTargetDataMap));
1890 return *map; 1890 return map;
1891 } 1891 }
1892 1892
1893 EventTargetData* Node::eventTargetData() 1893 EventTargetData* Node::eventTargetData()
1894 { 1894 {
1895 return hasEventTargetData() ? eventTargetDataMap().get(this) : nullptr; 1895 return hasEventTargetData() ? eventTargetDataMap().get(this) : nullptr;
1896 } 1896 }
1897 1897
1898 EventTargetData& Node::ensureEventTargetData() 1898 EventTargetData& Node::ensureEventTargetData()
1899 { 1899 {
1900 if (hasEventTargetData()) 1900 if (hasEventTargetData())
(...skipping 548 matching lines...) Expand 10 before | Expand all | Expand 10 after
2449 2449
2450 void showNodePath(const blink::Node* node) 2450 void showNodePath(const blink::Node* node)
2451 { 2451 {
2452 if (node) 2452 if (node)
2453 node->showNodePathForThis(); 2453 node->showNodePathForThis();
2454 else 2454 else
2455 fprintf(stderr, "Cannot showNodePath for (nil)\n"); 2455 fprintf(stderr, "Cannot showNodePath for (nil)\n");
2456 } 2456 }
2457 2457
2458 #endif 2458 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698