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

Side by Side Diff: third_party/WebKit/Source/core/css/CSSRule.cpp

Issue 2616093003: Make CSSParserContext be garbage collected. (Closed)
Patch Set: fix fuzzer compile again Created 3 years, 11 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 * (C) 1999-2003 Lars Knoll (knoll@kde.org) 2 * (C) 1999-2003 Lars Knoll (knoll@kde.org)
3 * (C) 2002-2003 Dirk Mueller (mueller@kde.org) 3 * (C) 2002-2003 Dirk Mueller (mueller@kde.org)
4 * Copyright (C) 2002, 2005, 2006, 2007, 2012 Apple Inc. All rights reserved. 4 * Copyright (C) 2002, 2005, 2006, 2007, 2012 Apple Inc. All rights reserved.
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
(...skipping 20 matching lines...) Expand all
31 struct SameSizeAsCSSRule : public GarbageCollectedFinalized<SameSizeAsCSSRule>, 31 struct SameSizeAsCSSRule : public GarbageCollectedFinalized<SameSizeAsCSSRule>,
32 public ScriptWrappable { 32 public ScriptWrappable {
33 virtual ~SameSizeAsCSSRule(); 33 virtual ~SameSizeAsCSSRule();
34 unsigned char bitfields; 34 unsigned char bitfields;
35 void* pointerUnion; 35 void* pointerUnion;
36 }; 36 };
37 37
38 static_assert(sizeof(CSSRule) == sizeof(SameSizeAsCSSRule), 38 static_assert(sizeof(CSSRule) == sizeof(SameSizeAsCSSRule),
39 "CSSRule should stay small"); 39 "CSSRule should stay small");
40 40
41 const CSSParserContext& CSSRule::parserContext() const { 41 const CSSParserContext* CSSRule::parserContext() const {
42 CSSStyleSheet* styleSheet = parentStyleSheet(); 42 CSSStyleSheet* styleSheet = parentStyleSheet();
43 return styleSheet ? styleSheet->contents()->parserContext() 43 return styleSheet ? styleSheet->contents()->parserContext()
44 : strictCSSParserContext(); 44 : strictCSSParserContext();
45 } 45 }
46 46
47 void CSSRule::setParentStyleSheet(CSSStyleSheet* styleSheet) { 47 void CSSRule::setParentStyleSheet(CSSStyleSheet* styleSheet) {
48 m_parentIsRule = false; 48 m_parentIsRule = false;
49 m_parentStyleSheet = styleSheet; 49 m_parentStyleSheet = styleSheet;
50 ScriptWrappableVisitor::writeBarrier(this, m_parentStyleSheet); 50 ScriptWrappableVisitor::writeBarrier(this, m_parentStyleSheet);
51 } 51 }
52 52
53 void CSSRule::setParentRule(CSSRule* rule) { 53 void CSSRule::setParentRule(CSSRule* rule) {
54 m_parentIsRule = true; 54 m_parentIsRule = true;
55 m_parentRule = rule; 55 m_parentRule = rule;
56 ScriptWrappableVisitor::writeBarrier(this, m_parentRule); 56 ScriptWrappableVisitor::writeBarrier(this, m_parentRule);
57 } 57 }
58 58
59 DEFINE_TRACE(CSSRule) { 59 DEFINE_TRACE(CSSRule) {
60 // This makes the parent link strong, which is different from the 60 // This makes the parent link strong, which is different from the
61 // pre-oilpan world, where the parent link is mysteriously zeroed under 61 // pre-oilpan world, where the parent link is mysteriously zeroed under
62 // some circumstances. 62 // some circumstances.
63 if (m_parentIsRule) 63 if (m_parentIsRule)
64 visitor->trace(m_parentRule); 64 visitor->trace(m_parentRule);
65 else 65 else
66 visitor->trace(m_parentStyleSheet); 66 visitor->trace(m_parentStyleSheet);
67 } 67 }
68 68
69 } // namespace blink 69 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/css/CSSRule.h ('k') | third_party/WebKit/Source/core/css/CSSStyleRule.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698