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

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

Issue 2776203002: Migrate WTF::Vector::remove() to ::erase() (Closed)
Patch Set: rebase, repatch VectorTest 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) 2005, 2006 Kimmo Kinnunen <kimmo.t.kinnunen@nokia.com>. 4 * Copyright (C) 2005, 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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 m_mediaType(attemptStaticStringCreation(mediaType.lower())), 93 m_mediaType(attemptStaticStringCreation(mediaType.lower())),
94 m_expressions(std::move(expressions)) { 94 m_expressions(std::move(expressions)) {
95 nonCopyingSort(m_expressions.begin(), m_expressions.end(), expressionCompare); 95 nonCopyingSort(m_expressions.begin(), m_expressions.end(), expressionCompare);
96 96
97 // Remove all duplicated expressions. 97 // Remove all duplicated expressions.
98 MediaQueryExp* key = 0; 98 MediaQueryExp* key = 0;
99 for (int i = m_expressions.size() - 1; i >= 0; --i) { 99 for (int i = m_expressions.size() - 1; i >= 0; --i) {
100 MediaQueryExp* exp = m_expressions.at(i).get(); 100 MediaQueryExp* exp = m_expressions.at(i).get();
101 101
102 if (key && *exp == *key) 102 if (key && *exp == *key)
103 m_expressions.remove(i); 103 m_expressions.erase(i);
104 else 104 else
105 key = exp; 105 key = exp;
106 } 106 }
107 } 107 }
108 108
109 MediaQuery::MediaQuery(const MediaQuery& o) 109 MediaQuery::MediaQuery(const MediaQuery& o)
110 : m_restrictor(o.m_restrictor), 110 : m_restrictor(o.m_restrictor),
111 m_mediaType(o.m_mediaType), 111 m_mediaType(o.m_mediaType),
112 m_serializationCache(o.m_serializationCache) { 112 m_serializationCache(o.m_serializationCache) {
113 m_expressions.reserveInitialCapacity(o.m_expressions.size()); 113 m_expressions.reserveInitialCapacity(o.m_expressions.size());
(...skipping 14 matching lines...) Expand all
128 const_cast<MediaQuery*>(this)->m_serializationCache = serialize(); 128 const_cast<MediaQuery*>(this)->m_serializationCache = serialize();
129 129
130 return m_serializationCache; 130 return m_serializationCache;
131 } 131 }
132 132
133 DEFINE_TRACE(MediaQuery) { 133 DEFINE_TRACE(MediaQuery) {
134 visitor->trace(m_expressions); 134 visitor->trace(m_expressions);
135 } 135 }
136 136
137 } // namespace blink 137 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/css/MediaList.cpp ('k') | third_party/WebKit/Source/core/css/StylePropertySet.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698