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

Side by Side Diff: Source/core/dom/TreeScope.cpp

Issue 235113002: Oilpan: Remove guardRef and guardDeref from TreeScope. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Address comments. 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
« no previous file with comments | « Source/core/dom/TreeScope.h ('k') | Source/core/dom/TreeScopeAdopter.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All Rights Reserved. 2 * Copyright (C) 2011 Google Inc. All Rights Reserved.
3 * Copyright (C) 2012 Apple Inc. All rights reserved. 3 * Copyright (C) 2012 Apple Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 #include "wtf/Vector.h" 52 #include "wtf/Vector.h"
53 53
54 namespace WebCore { 54 namespace WebCore {
55 55
56 using namespace HTMLNames; 56 using namespace HTMLNames;
57 57
58 TreeScope::TreeScope(ContainerNode& rootNode, Document& document) 58 TreeScope::TreeScope(ContainerNode& rootNode, Document& document)
59 : m_rootNode(rootNode) 59 : m_rootNode(rootNode)
60 , m_document(&document) 60 , m_document(&document)
61 , m_parentTreeScope(&document) 61 , m_parentTreeScope(&document)
62 #if !ENABLE(OILPAN)
62 , m_guardRefCount(0) 63 , m_guardRefCount(0)
64 #endif
63 , m_idTargetObserverRegistry(IdTargetObserverRegistry::create()) 65 , m_idTargetObserverRegistry(IdTargetObserverRegistry::create())
64 { 66 {
65 ASSERT(rootNode != document); 67 ASSERT(rootNode != document);
68 #if !ENABLE(OILPAN)
66 m_parentTreeScope->guardRef(); 69 m_parentTreeScope->guardRef();
70 #endif
67 m_rootNode.setTreeScope(this); 71 m_rootNode.setTreeScope(this);
68 } 72 }
69 73
70 TreeScope::TreeScope(Document& document) 74 TreeScope::TreeScope(Document& document)
71 : m_rootNode(document) 75 : m_rootNode(document)
72 , m_document(&document) 76 , m_document(&document)
73 , m_parentTreeScope(0) 77 , m_parentTreeScope(nullptr)
78 #if !ENABLE(OILPAN)
74 , m_guardRefCount(0) 79 , m_guardRefCount(0)
80 #endif
75 , m_idTargetObserverRegistry(IdTargetObserverRegistry::create()) 81 , m_idTargetObserverRegistry(IdTargetObserverRegistry::create())
76 { 82 {
77 m_rootNode.setTreeScope(this); 83 m_rootNode.setTreeScope(this);
78 } 84 }
79 85
80 TreeScope::~TreeScope() 86 TreeScope::~TreeScope()
81 { 87 {
88 #if !ENABLE(OILPAN)
82 ASSERT(!m_guardRefCount); 89 ASSERT(!m_guardRefCount);
90 #endif
83 m_rootNode.setTreeScope(0); 91 m_rootNode.setTreeScope(0);
84 92
93 #if !ENABLE(OILPAN)
85 if (m_selection) { 94 if (m_selection) {
86 m_selection->clearTreeScope(); 95 m_selection->clearTreeScope();
87 m_selection = nullptr; 96 m_selection = nullptr;
88 } 97 }
89 98
90 if (m_parentTreeScope) 99 if (m_parentTreeScope)
91 m_parentTreeScope->guardDeref(); 100 m_parentTreeScope->guardDeref();
101 #endif
92 } 102 }
93 103
94 TreeScope* TreeScope::olderShadowRootOrParentTreeScope() const 104 TreeScope* TreeScope::olderShadowRootOrParentTreeScope() const
95 { 105 {
96 if (rootNode().isShadowRoot()) { 106 if (rootNode().isShadowRoot()) {
97 if (ShadowRoot* olderShadowRoot = toShadowRoot(rootNode()).olderShadowRo ot()) 107 if (ShadowRoot* olderShadowRoot = toShadowRoot(rootNode()).olderShadowRo ot())
98 return olderShadowRoot; 108 return olderShadowRoot;
99 } 109 }
100 return parentTreeScope(); 110 return parentTreeScope();
101 } 111 }
(...skipping 17 matching lines...) Expand all
119 m_elementsById.clear(); 129 m_elementsById.clear();
120 m_imageMapsByName.clear(); 130 m_imageMapsByName.clear();
121 m_labelsByForAttribute.clear(); 131 m_labelsByForAttribute.clear();
122 } 132 }
123 133
124 void TreeScope::setParentTreeScope(TreeScope& newParentScope) 134 void TreeScope::setParentTreeScope(TreeScope& newParentScope)
125 { 135 {
126 // A document node cannot be re-parented. 136 // A document node cannot be re-parented.
127 ASSERT(!rootNode().isDocumentNode()); 137 ASSERT(!rootNode().isDocumentNode());
128 138
139 #if !ENABLE(OILPAN)
129 newParentScope.guardRef(); 140 newParentScope.guardRef();
130 if (m_parentTreeScope) 141 if (m_parentTreeScope)
131 m_parentTreeScope->guardDeref(); 142 m_parentTreeScope->guardDeref();
143 #endif
132 m_parentTreeScope = &newParentScope; 144 m_parentTreeScope = &newParentScope;
133 setDocument(newParentScope.document()); 145 setDocument(newParentScope.document());
134 } 146 }
135 147
136 Element* TreeScope::getElementById(const AtomicString& elementId) const 148 Element* TreeScope::getElementById(const AtomicString& elementId) const
137 { 149 {
138 if (elementId.isEmpty()) 150 if (elementId.isEmpty())
139 return 0; 151 return 0;
140 if (!m_elementsById) 152 if (!m_elementsById)
141 return 0; 153 return 0;
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after
514 { 526 {
515 for (Element* element = ElementTraversal::firstWithin(rootNode()); element; element = ElementTraversal::nextIncludingPseudo(*element)) { 527 for (Element* element = ElementTraversal::firstWithin(rootNode()); element; element = ElementTraversal::nextIncludingPseudo(*element)) {
516 for (ShadowRoot* root = element->youngestShadowRoot(); root; root = root ->olderShadowRoot()) 528 for (ShadowRoot* root = element->youngestShadowRoot(); root; root = root ->olderShadowRoot())
517 root->setNeedsStyleRecalcForViewportUnits(); 529 root->setNeedsStyleRecalcForViewportUnits();
518 RenderStyle* style = element->renderStyle(); 530 RenderStyle* style = element->renderStyle();
519 if (style && style->hasViewportUnits()) 531 if (style && style->hasViewportUnits())
520 element->setNeedsStyleRecalc(LocalStyleChange); 532 element->setNeedsStyleRecalc(LocalStyleChange);
521 } 533 }
522 } 534 }
523 535
536 void TreeScope::trace(Visitor* visitor)
537 {
538 visitor->trace(m_parentTreeScope);
539 visitor->trace(m_selection);
540 }
541
524 } // namespace WebCore 542 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/dom/TreeScope.h ('k') | Source/core/dom/TreeScopeAdopter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698