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

Unified Diff: Source/WebCore/bindings/v8/V8GCController.cpp

Issue 6691008: Merge 80842 - 2011-03-11 Anton Muhin <antonm@chromium.org>... (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/648/
Patch Set: Created 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/WebCore/ChangeLog ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/WebCore/bindings/v8/V8GCController.cpp
===================================================================
--- Source/WebCore/bindings/v8/V8GCController.cpp (revision 81026)
+++ Source/WebCore/bindings/v8/V8GCController.cpp (working copy)
@@ -328,6 +328,38 @@
}
};
+static uintptr_t calculateGroupId(StyleBase* styleBase)
+{
+ ASSERT(styleBase);
+ StyleBase* current = styleBase;
+ StyleSheet* styleSheet = 0;
+ while (true) {
+ // Special case: CSSStyleDeclarations should have CSSRule as a parent
+ // to proceed with parent traversal, otherwise they are coming from
+ // inlined style declaration and should be treated as a root.
+ if (current->isMutableStyleDeclaration()) {
+ CSSMutableStyleDeclaration* cssMutableStyleDeclaration = static_cast<CSSMutableStyleDeclaration*>(current);
+ if (CSSRule* parentRule = cssMutableStyleDeclaration->parentRule())
+ current = parentRule;
+ else
+ return reinterpret_cast<uintptr_t>(cssMutableStyleDeclaration);
+ }
+
+ if (current->isStyleSheet())
+ styleSheet = static_cast<StyleSheet*>(current);
+
+ StyleBase* parent = current->parent();
+ if (!parent)
+ break;
+ current = parent;
+ }
+
+ if (styleSheet)
+ return reinterpret_cast<uintptr_t>(styleSheet);
+
+ return reinterpret_cast<uintptr_t>(current);
+}
+
class DOMObjectGrouperVisitor : public DOMWrapperMap<void>::Visitor {
public:
DOMObjectGrouperVisitor()
@@ -359,18 +391,7 @@
|| V8CSSMediaRule::info.equals(typeInfo)) {
StyleBase* styleBase = static_cast<StyleBase*>(object);
- // We put the whole tree of style elements into a single object group.
- // To achieve that we group elements by the roots of their trees.
- StyleBase* root = styleBase;
- ASSERT(root);
- while (true) {
- StyleBase* parent = root->parent();
- if (!parent)
- break;
- root = parent;
- }
- // Group id is an address of the root.
- uintptr_t groupId = reinterpret_cast<uintptr_t>(root);
+ uintptr_t groupId = calculateGroupId(styleBase);
m_grouper.append(GrouperItem(groupId, wrapper));
if (V8CSSStyleDeclaration::info.equals(typeInfo)) {
« no previous file with comments | « Source/WebCore/ChangeLog ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698