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

Side by Side Diff: Source/core/dom/shadow/ElementShadow.cpp

Issue 262093006: Oilpan: Make the Node hierarchy RefCountedGarbageCollected instead of TreeShared. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Another build fix. Created 6 years, 7 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 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 * * Neither the name of Google Inc. nor the names of its 10 * * Neither the name of Google Inc. nor the names of its
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 } 128 }
129 129
130 ElementShadow::ElementShadow() 130 ElementShadow::ElementShadow()
131 : m_needsDistributionRecalc(false) 131 : m_needsDistributionRecalc(false)
132 , m_needsSelectFeatureSet(false) 132 , m_needsSelectFeatureSet(false)
133 { 133 {
134 } 134 }
135 135
136 ElementShadow::~ElementShadow() 136 ElementShadow::~ElementShadow()
137 { 137 {
138 #if !ENABLE(OILPAN)
138 removeDetachedShadowRoots(); 139 removeDetachedShadowRoots();
140 #endif
139 } 141 }
140 142
141 ShadowRoot& ElementShadow::addShadowRoot(Element& shadowHost, ShadowRoot::Shadow RootType type) 143 ShadowRoot& ElementShadow::addShadowRoot(Element& shadowHost, ShadowRoot::Shadow RootType type)
142 { 144 {
143 RefPtr<ShadowRoot> shadowRoot = ShadowRoot::create(shadowHost.document(), ty pe); 145 RefPtr<ShadowRoot> shadowRoot = ShadowRoot::create(shadowHost.document(), ty pe);
144 146
145 if (type == ShadowRoot::AuthorShadowRoot && (!youngestShadowRoot() || younge stShadowRoot()->type() == ShadowRoot::UserAgentShadowRoot)) 147 if (type == ShadowRoot::AuthorShadowRoot && (!youngestShadowRoot() || younge stShadowRoot()->type() == ShadowRoot::UserAgentShadowRoot))
146 shadowHost.willAddFirstAuthorShadowRoot(); 148 shadowHost.willAddFirstAuthorShadowRoot();
147 149
148 for (ShadowRoot* root = youngestShadowRoot(); root; root = root->olderShadow Root()) 150 for (ShadowRoot* root = youngestShadowRoot(); root; root = root->olderShadow Root())
(...skipping 12 matching lines...) Expand all
161 return *m_shadowRoots.head(); 163 return *m_shadowRoots.head();
162 } 164 }
163 165
164 void ElementShadow::removeDetachedShadowRoots() 166 void ElementShadow::removeDetachedShadowRoots()
165 { 167 {
166 // Dont protect this ref count. 168 // Dont protect this ref count.
167 Element* shadowHost = host(); 169 Element* shadowHost = host();
168 ASSERT(shadowHost); 170 ASSERT(shadowHost);
169 171
170 while (RefPtr<ShadowRoot> oldRoot = m_shadowRoots.head()) { 172 while (RefPtr<ShadowRoot> oldRoot = m_shadowRoots.head()) {
171 InspectorInstrumentation::willPopShadowRoot(shadowHost, oldRoot.get()); 173 InspectorInstrumentation::willPopShadowRoot(shadowHost, oldRoot.get());
haraken 2014/05/06 15:59:42 Add a FIXME and mention if this is OK to remove or
Mads Ager (chromium) 2014/05/07 12:13:16 I'll file a bug report to investigate and reach ou
172 shadowHost->document().removeFocusedElementOfSubtree(oldRoot.get()); 174 shadowHost->document().removeFocusedElementOfSubtree(oldRoot.get());
173 m_shadowRoots.removeHead(); 175 m_shadowRoots.removeHead();
174 oldRoot->setParentOrShadowHostNode(0); 176 oldRoot->setParentOrShadowHostNode(0);
175 oldRoot->setParentTreeScope(shadowHost->document()); 177 oldRoot->setParentTreeScope(shadowHost->document());
176 oldRoot->setPrev(0); 178 oldRoot->setPrev(0);
177 oldRoot->setNext(0); 179 oldRoot->setNext(0);
178 } 180 }
179 181
180 } 182 }
181 183
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
343 } 345 }
344 346
345 void ElementShadow::clearDistribution() 347 void ElementShadow::clearDistribution()
346 { 348 {
347 m_nodeToInsertionPoints.clear(); 349 m_nodeToInsertionPoints.clear();
348 350
349 for (ShadowRoot* root = youngestShadowRoot(); root; root = root->olderShadow Root()) 351 for (ShadowRoot* root = youngestShadowRoot(); root; root = root->olderShadow Root())
350 root->setShadowInsertionPointOfYoungerShadowRoot(nullptr); 352 root->setShadowInsertionPointOfYoungerShadowRoot(nullptr);
351 } 353 }
352 354
355 void ElementShadow::trace(Visitor* visitor)
356 {
357 // Shadow roots are linked with previous and next pointers which are traced.
358 // It is therefore enough to trace one of the shadow roots here and the
359 // rest will be traced from there.
360 visitor->trace(m_shadowRoots.head());
361 }
362
353 } // namespace 363 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698