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

Unified Diff: Source/core/css/MediaQueryList.h

Issue 348893004: Rework MediaQueryMatcher to batch up listener notification (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: MediaQueryList constructor needs to call updateMatches to avoid "fake" transitions from "unknown st… Created 6 years, 6 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
Index: Source/core/css/MediaQueryList.h
diff --git a/Source/core/css/MediaQueryList.h b/Source/core/css/MediaQueryList.h
index ba04100cc723e42cb75d7e957d579b52408ff66d..a05beee3d07b40367b60f00347f0c9361237ab68 100644
--- a/Source/core/css/MediaQueryList.h
+++ b/Source/core/css/MediaQueryList.h
@@ -38,27 +38,32 @@ class MediaQuerySet;
// will be called whenever the value of the query changes.
class MediaQueryList FINAL : public RefCountedWillBeGarbageCollected<MediaQueryList> {
Mads Ager (chromium) 2014/06/26 06:06:22 Since the class now has a non-trivial destructor i
cbiesinger 2014/06/26 20:27:59 Done.
- DECLARE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(MediaQueryList);
public:
- static PassRefPtrWillBeRawPtr<MediaQueryList> create(PassRefPtrWillBeRawPtr<MediaQueryMatcher>, PassRefPtrWillBeRawPtr<MediaQuerySet>, bool);
+ static PassRefPtrWillBeRawPtr<MediaQueryList> create(PassRefPtrWillBeRawPtr<MediaQueryMatcher>, PassRefPtrWillBeRawPtr<MediaQuerySet>);
+ virtual ~MediaQueryList();
+
String media() const;
bool matches();
void addListener(PassRefPtrWillBeRawPtr<MediaQueryListListener>);
void removeListener(PassRefPtrWillBeRawPtr<MediaQueryListListener>);
- bool evaluate(MediaQueryEvaluator*);
+ void mediaFeaturesChanged(WillBeHeapVector<RefPtrWillBeMember<MediaQueryListListener> >* toNotify);
void trace(Visitor*);
+ void documentDetached();
+
private:
- MediaQueryList(PassRefPtrWillBeRawPtr<MediaQueryMatcher>, PassRefPtrWillBeRawPtr<MediaQuerySet>, bool matches);
- void setMatches(bool);
+ MediaQueryList(PassRefPtrWillBeRawPtr<MediaQueryMatcher>, PassRefPtrWillBeRawPtr<MediaQuerySet>);
+
+ bool updateMatches();
RefPtrWillBeMember<MediaQueryMatcher> m_matcher;
RefPtrWillBeMember<MediaQuerySet> m_media;
- unsigned m_evaluationRound; // Indicates if the query has been evaluated after the last style selector change.
- unsigned m_changeRound; // Used to know if the query has changed in the last style selector change.
+ typedef HeapListHashSet<RefPtrWillBePersistent<MediaQueryListListener> > ListenerList;
esprehn 2014/06/26 05:43:24 I think this should be a Member, you only need to
Mads Ager (chromium) 2014/06/26 06:06:22 MediaQueryList, MediaQueryListListener and HeapLis
cbiesinger 2014/06/26 20:27:59 Done.
+ ListenerList m_listeners;
+ bool m_matchesDirty;
bool m_matches;
};

Powered by Google App Engine
This is Rietveld 408576698