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

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

Issue 178803006: Turn MQ classes into thread safe (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebased after MediaFeature generation landed Created 6 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 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 15 matching lines...) Expand all
26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */ 27 */
28 28
29 #ifndef MediaQueryExp_h 29 #ifndef MediaQueryExp_h
30 #define MediaQueryExp_h 30 #define MediaQueryExp_h
31 31
32 #include "MediaFeatureNames.h" 32 #include "MediaFeatureNames.h"
33 #include "core/css/CSSValue.h" 33 #include "core/css/CSSValue.h"
34 #include "wtf/PassOwnPtr.h" 34 #include "wtf/PassOwnPtr.h"
35 #include "wtf/RefPtr.h" 35 #include "wtf/RefPtr.h"
36 #include "wtf/text/AtomicString.h"
37 36
38 namespace WebCore { 37 namespace WebCore {
39 class CSSParserValueList; 38 class CSSParserValueList;
40 39
41 class MediaQueryExp : public NoBaseWillBeGarbageCollectedFinalized<MediaQueryExp > { 40 class MediaQueryExp : public NoBaseWillBeGarbageCollectedFinalized<MediaQueryExp > {
42 WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED; 41 WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED;
43 public: 42 public:
44 static PassOwnPtrWillBeRawPtr<MediaQueryExp> create(const AtomicString& medi aFeature, CSSParserValueList*); 43 static PassOwnPtrWillBeRawPtr<MediaQueryExp> create(const String& mediaFeatu re, CSSParserValueList*);
45 ~MediaQueryExp(); 44 ~MediaQueryExp();
46 45
47 AtomicString mediaFeature() const { return m_mediaFeature; } 46 String mediaFeature() const { return m_mediaFeature; }
abarth-chromium 2014/03/06 08:03:57 This can return a const String&
48 47
49 CSSValue* value() const { return m_value.get(); } 48 CSSValue* value() const { return m_value.get(); }
50 49
51 bool operator==(const MediaQueryExp& other) const 50 bool operator==(const MediaQueryExp& other) const
52 { 51 {
53 return (other.m_mediaFeature == m_mediaFeature) 52 return (other.m_mediaFeatureHash == m_mediaFeatureHash)
abarth-chromium 2014/03/06 08:03:57 Why do you need a hash? Don't you need to check m
54 && ((!other.m_value && !m_value) 53 && ((!other.m_value && !m_value)
55 || (other.m_value && m_value && other.m_value->equals(*m_value)) ); 54 || (other.m_value && m_value && other.m_value->equals(*m_value)) );
56 } 55 }
57 56
58 bool isViewportDependent() const; 57 bool isViewportDependent() const;
59 58
60 String serialize() const; 59 String serialize() const;
61 60
62 PassOwnPtrWillBeRawPtr<MediaQueryExp> copy() const { return adoptPtrWillBeNo op(new MediaQueryExp(*this)); } 61 PassOwnPtrWillBeRawPtr<MediaQueryExp> copy() const { return adoptPtrWillBeNo op(new MediaQueryExp(*this)); }
63 62
64 void trace(Visitor* visitor) { visitor->trace(m_value); } 63 void trace(Visitor* visitor) { visitor->trace(m_value); }
65 64
66 MediaQueryExp(const MediaQueryExp& other); 65 MediaQueryExp(const MediaQueryExp& other);
67 66
68 private: 67 private:
69 MediaQueryExp(const AtomicString& mediaFeature, PassRefPtrWillBeRawPtr<CSSVa lue>); 68 MediaQueryExp(StringImpl*, PassRefPtrWillBeRawPtr<CSSValue>);
abarth-chromium 2014/03/06 08:03:57 Why not const String& ?
70 69
71 AtomicString m_mediaFeature; 70 String m_mediaFeature;
71 unsigned m_mediaFeatureHash;
abarth-chromium 2014/03/06 08:03:57 Is this needed for performance?
72 RefPtrWillBeMember<CSSValue> m_value; 72 RefPtrWillBeMember<CSSValue> m_value;
73 }; 73 };
74 74
75 } // namespace 75 } // namespace
76 76
77 #endif 77 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698