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

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

Issue 2873433003: Move MediaQuery classes off BlinkGC heap (Closed)
Patch Set: Created 3 years, 7 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 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) 2 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
3 * 3 *
4 * This library is free software; you can redistribute it and/or 4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public 5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either 6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version. 7 * version 2 of the License, or (at your option) any later version.
8 * 8 *
9 * This library is distributed in the hope that it will be useful, 9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 ASSERT(!m_document || m_document->frame() || !m_evaluator); 59 ASSERT(!m_document || m_document->frame() || !m_evaluator);
60 60
61 if (!media) 61 if (!media)
62 return false; 62 return false;
63 63
64 // Cache the evaluator to avoid allocating one per evaluation. 64 // Cache the evaluator to avoid allocating one per evaluation.
65 if (!m_evaluator) 65 if (!m_evaluator)
66 m_evaluator = createEvaluator(); 66 m_evaluator = createEvaluator();
67 67
68 if (m_evaluator) 68 if (m_evaluator)
69 return m_evaluator->eval(media); 69 return m_evaluator->eval(*media);
70 70
71 return false; 71 return false;
72 } 72 }
73 73
74 MediaQueryList* MediaQueryMatcher::matchMedia(const String& query) { 74 MediaQueryList* MediaQueryMatcher::matchMedia(const String& query) {
75 if (!m_document) 75 if (!m_document)
76 return nullptr; 76 return nullptr;
77 77
78 MediaQuerySet* media = MediaQuerySet::create(query); 78 RefPtr<MediaQuerySet> media = MediaQuerySet::create(query);
79 return MediaQueryList::create(m_document, this, media); 79 return MediaQueryList::create(m_document, this, media);
80 } 80 }
81 81
82 void MediaQueryMatcher::addMediaQueryList(MediaQueryList* query) { 82 void MediaQueryMatcher::addMediaQueryList(MediaQueryList* query) {
83 if (!m_document) 83 if (!m_document)
84 return; 84 return;
85 m_mediaLists.insert(query); 85 m_mediaLists.insert(query);
86 } 86 }
87 87
88 void MediaQueryMatcher::removeMediaQueryList(MediaQueryList* query) { 88 void MediaQueryMatcher::removeMediaQueryList(MediaQueryList* query) {
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 } 131 }
132 132
133 DEFINE_TRACE(MediaQueryMatcher) { 133 DEFINE_TRACE(MediaQueryMatcher) {
134 visitor->trace(m_document); 134 visitor->trace(m_document);
135 visitor->trace(m_evaluator); 135 visitor->trace(m_evaluator);
136 visitor->trace(m_mediaLists); 136 visitor->trace(m_mediaLists);
137 visitor->trace(m_viewportListeners); 137 visitor->trace(m_viewportListeners);
138 } 138 }
139 139
140 } // namespace blink 140 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/css/MediaQueryList.cpp ('k') | third_party/WebKit/Source/core/css/MediaQueryMatcherTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698