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

Side by Side Diff: third_party/WebKit/Source/core/css/MediaQueryExp.h

Issue 2837023005: Move MediaQuery classes off BlinkGC heap (Closed)
Patch Set: fix Created 3 years, 8 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 * CSS Media Query 2 * CSS Media Query
3 * 3 *
4 * Copyright (C) 2006 Kimmo Kinnunen <kimmo.t.kinnunen@nokia.com>. 4 * Copyright (C) 2006 Kimmo Kinnunen <kimmo.t.kinnunen@nokia.com>.
5 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 5 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 return (id == exp_value.id); 70 return (id == exp_value.id);
71 if (is_value) 71 if (is_value)
72 return (value == exp_value.value); 72 return (value == exp_value.value);
73 if (is_ratio) 73 if (is_ratio)
74 return (numerator == exp_value.numerator && 74 return (numerator == exp_value.numerator &&
75 denominator == exp_value.denominator); 75 denominator == exp_value.denominator);
76 return !exp_value.IsValid(); 76 return !exp_value.IsValid();
77 } 77 }
78 }; 78 };
79 79
80 class CORE_EXPORT MediaQueryExp 80 class CORE_EXPORT MediaQueryExp {
81 : public GarbageCollectedFinalized<MediaQueryExp> { 81 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW();
82
82 public: 83 public:
83 static MediaQueryExp* CreateIfValid(const String& media_feature, 84 // Returns an invalid MediaQueryExp if the arguments are invalid.
84 const Vector<CSSParserToken, 4>&); 85 static MediaQueryExp Create(const String& media_feature,
86 const Vector<CSSParserToken, 4>&);
87 static MediaQueryExp Invalid() {
88 return MediaQueryExp(String(), MediaQueryExpValue());
89 }
90
91 MediaQueryExp(const MediaQueryExp& other);
85 ~MediaQueryExp(); 92 ~MediaQueryExp();
86 93
87 const String& MediaFeature() const { return media_feature_; } 94 const String& MediaFeature() const { return media_feature_; }
88 95
89 MediaQueryExpValue ExpValue() const { return exp_value_; } 96 MediaQueryExpValue ExpValue() const { return exp_value_; }
90 97
98 bool IsValid() const { return !media_feature_.IsNull(); }
99
91 bool operator==(const MediaQueryExp& other) const; 100 bool operator==(const MediaQueryExp& other) const;
92 101
93 bool IsViewportDependent() const; 102 bool IsViewportDependent() const;
94 103
95 bool IsDeviceDependent() const; 104 bool IsDeviceDependent() const;
96 105
97 String Serialize() const; 106 String Serialize() const;
98 107
99 MediaQueryExp* Copy() const { return new MediaQueryExp(*this); }
100
101 MediaQueryExp(const MediaQueryExp& other);
102
103 DEFINE_INLINE_TRACE() {}
104
105 private: 108 private:
106 MediaQueryExp(const String&, const MediaQueryExpValue&); 109 MediaQueryExp(const String&, const MediaQueryExpValue&);
107 110
108 String media_feature_; 111 String media_feature_;
109 MediaQueryExpValue exp_value_; 112 MediaQueryExpValue exp_value_;
110 }; 113 };
111 114
112 } // namespace blink 115 } // namespace blink
113 116
114 #endif 117 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698