| Index: third_party/WebKit/Source/core/css/CSSPropertySourceData.h
|
| diff --git a/third_party/WebKit/Source/core/css/CSSPropertySourceData.h b/third_party/WebKit/Source/core/css/CSSPropertySourceData.h
|
| index 8fa7cbc1aaaba9db64608efc829a0441d7dd8b3b..6f37617e13852f67c35ca826cc2f02511a248627 100644
|
| --- a/third_party/WebKit/Source/core/css/CSSPropertySourceData.h
|
| +++ b/third_party/WebKit/Source/core/css/CSSPropertySourceData.h
|
| @@ -34,20 +34,19 @@
|
| #include "core/css/StyleRule.h"
|
| #include "platform/heap/Handle.h"
|
| #include "wtf/Forward.h"
|
| +#include "wtf/RefCounted.h"
|
| #include "wtf/Vector.h"
|
| #include "wtf/text/WTFString.h"
|
|
|
| namespace blink {
|
|
|
| -struct SourceRange {
|
| +class SourceRange {
|
| DISALLOW_NEW_EXCEPT_PLACEMENT_NEW();
|
| public:
|
| SourceRange();
|
| SourceRange(unsigned start, unsigned end);
|
| unsigned length() const;
|
|
|
| - DEFINE_INLINE_TRACE() { }
|
| -
|
| unsigned start;
|
| unsigned end;
|
| };
|
| @@ -58,14 +57,12 @@ WTF_ALLOW_MOVE_AND_INIT_WITH_MEM_FUNCTIONS(blink::SourceRange);
|
|
|
| namespace blink {
|
|
|
| -struct CSSPropertySourceData {
|
| +class CSSPropertySourceData {
|
| DISALLOW_NEW_EXCEPT_PLACEMENT_NEW();
|
| public:
|
| CSSPropertySourceData(const String& name, const String& value, bool important, bool disabled, bool parsedOk, const SourceRange& range);
|
| CSSPropertySourceData(const CSSPropertySourceData& other);
|
|
|
| - DEFINE_INLINE_TRACE() { visitor->trace(range); }
|
| -
|
| String name;
|
| String value;
|
| bool important;
|
| @@ -80,28 +77,23 @@ WTF_ALLOW_MOVE_AND_INIT_WITH_MEM_FUNCTIONS(blink::CSSPropertySourceData);
|
|
|
| namespace blink {
|
|
|
| -struct CSSStyleSourceData : public GarbageCollected<CSSStyleSourceData> {
|
| - static CSSStyleSourceData* create()
|
| - {
|
| - return new CSSStyleSourceData();
|
| - }
|
| -
|
| - DEFINE_INLINE_TRACE()
|
| +class CSSStyleSourceData {
|
| + USING_FAST_MALLOC(CSSStyleSourceData);
|
| +public:
|
| + static std::unique_ptr<CSSStyleSourceData> create()
|
| {
|
| - visitor->trace(propertyData);
|
| + return wrapUnique(new CSSStyleSourceData);
|
| }
|
|
|
| - HeapVector<CSSPropertySourceData> propertyData;
|
| + Vector<CSSPropertySourceData> propertyData;
|
| };
|
|
|
| -struct CSSMediaQueryExpSourceData {
|
| +class CSSMediaQueryExpSourceData {
|
| DISALLOW_NEW_EXCEPT_PLACEMENT_NEW();
|
| public:
|
| CSSMediaQueryExpSourceData(const SourceRange& valueRange)
|
| : valueRange(valueRange) { }
|
|
|
| - DEFINE_INLINE_TRACE() { visitor->trace(valueRange); }
|
| -
|
| SourceRange valueRange;
|
| };
|
|
|
| @@ -111,55 +103,38 @@ WTF_ALLOW_MOVE_AND_INIT_WITH_MEM_FUNCTIONS(blink::CSSMediaQueryExpSourceData);
|
|
|
| namespace blink {
|
|
|
| -struct CSSMediaQuerySourceData : public GarbageCollected<CSSMediaQuerySourceData> {
|
| - static CSSMediaQuerySourceData* create()
|
| - {
|
| - return new CSSMediaQuerySourceData();
|
| - }
|
| -
|
| - DEFINE_INLINE_TRACE()
|
| +class CSSMediaQuerySourceData {
|
| +public:
|
| + static std::unique_ptr<CSSMediaQuerySourceData> create()
|
| {
|
| - visitor->trace(expData);
|
| + return wrapUnique(new CSSMediaQuerySourceData);
|
| }
|
|
|
| - HeapVector<CSSMediaQueryExpSourceData> expData;
|
| + Vector<CSSMediaQueryExpSourceData> expData;
|
| };
|
|
|
| -struct CSSMediaSourceData : public GarbageCollected<CSSMediaSourceData> {
|
| - static CSSMediaSourceData* create()
|
| - {
|
| - return new CSSMediaSourceData();
|
| - }
|
| -
|
| - DEFINE_INLINE_TRACE()
|
| +class CSSMediaSourceData {
|
| + USING_FAST_MALLOC(CSSMediaSourceData);
|
| +public:
|
| + static std::unique_ptr<CSSMediaSourceData> create()
|
| {
|
| - visitor->trace(queryData);
|
| + return wrapUnique(new CSSMediaSourceData);
|
| }
|
|
|
| - HeapVector<Member<CSSMediaQuerySourceData>> queryData;
|
| + Vector<std::unique_ptr<CSSMediaQuerySourceData>> queryData;
|
| };
|
|
|
| -struct CSSRuleSourceData;
|
| -using RuleSourceDataList = HeapVector<Member<CSSRuleSourceData>>;
|
| -using SelectorRangeList = HeapVector<SourceRange>;
|
| -
|
| -struct CSSRuleSourceData : public GarbageCollected<CSSRuleSourceData> {
|
| - static CSSRuleSourceData* create(StyleRule::RuleType type)
|
| - {
|
| - return new CSSRuleSourceData(type);
|
| - }
|
| +class CSSRuleSourceData;
|
| +using RuleSourceDataList = Vector<RefPtr<CSSRuleSourceData>>;
|
| +using SelectorRangeList = Vector<SourceRange>;
|
|
|
| - CSSRuleSourceData(StyleRule::RuleType type)
|
| - : type(type)
|
| +class CSSRuleSourceData : public RefCounted<CSSRuleSourceData> {
|
| +public:
|
| + static PassRefPtr<CSSRuleSourceData> create(StyleRule::RuleType type)
|
| {
|
| - if (type == StyleRule::Style || type == StyleRule::FontFace || type == StyleRule::Page || type == StyleRule::Keyframe)
|
| - styleSourceData = CSSStyleSourceData::create();
|
| - if (type == StyleRule::Media || type == StyleRule::Import)
|
| - mediaSourceData = CSSMediaSourceData::create();
|
| + return adoptRef(new CSSRuleSourceData(type));
|
| }
|
|
|
| - DECLARE_TRACE();
|
| -
|
| StyleRule::RuleType type;
|
|
|
| // Range of the selector list in the enclosing source.
|
| @@ -172,13 +147,24 @@ struct CSSRuleSourceData : public GarbageCollected<CSSRuleSourceData> {
|
| SelectorRangeList selectorRanges;
|
|
|
| // Only for CSSStyleRules, CSSFontFaceRules, and CSSPageRules.
|
| - Member<CSSStyleSourceData> styleSourceData;
|
| + std::unique_ptr<CSSStyleSourceData> styleSourceData;
|
|
|
| // Only for CSSMediaRules.
|
| RuleSourceDataList childRules;
|
|
|
| // Only for CSSMediaRules and CSSImportRules.
|
| - Member<CSSMediaSourceData> mediaSourceData;
|
| + std::unique_ptr<CSSMediaSourceData> mediaSourceData;
|
| +
|
| +private:
|
| + CSSRuleSourceData(StyleRule::RuleType type)
|
| + : type(type)
|
| + {
|
| + if (type == StyleRule::Style || type == StyleRule::FontFace || type == StyleRule::Page || type == StyleRule::Keyframe)
|
| + styleSourceData = CSSStyleSourceData::create();
|
| + if (type == StyleRule::Media || type == StyleRule::Import)
|
| + mediaSourceData = CSSMediaSourceData::create();
|
| + }
|
| +
|
| };
|
|
|
| } // namespace blink
|
|
|