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

Side by Side Diff: third_party/WebKit/Source/core/xml/XPathPredicate.cpp

Issue 2657443005: Migrate WTF::HashSet::add() to ::insert() [part 1 of N] (Closed)
Patch Set: Created 3 years, 10 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 2005 Frerich Raabe <raabe@kde.org> 2 * Copyright 2005 Frerich Raabe <raabe@kde.org>
3 * Copyright (C) 2006 Apple Computer, Inc. 3 * Copyright (C) 2006 Apple Computer, Inc.
4 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> 4 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org>
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 9 *
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 233
234 Value Union::evaluate(EvaluationContext& context) const { 234 Value Union::evaluate(EvaluationContext& context) const {
235 Value lhsResult = subExpr(0)->evaluate(context); 235 Value lhsResult = subExpr(0)->evaluate(context);
236 Value rhs = subExpr(1)->evaluate(context); 236 Value rhs = subExpr(1)->evaluate(context);
237 237
238 NodeSet& resultSet = lhsResult.modifiableNodeSet(context); 238 NodeSet& resultSet = lhsResult.modifiableNodeSet(context);
239 const NodeSet& rhsNodes = rhs.toNodeSet(&context); 239 const NodeSet& rhsNodes = rhs.toNodeSet(&context);
240 240
241 HeapHashSet<Member<Node>> nodes; 241 HeapHashSet<Member<Node>> nodes;
242 for (const auto& node : resultSet) 242 for (const auto& node : resultSet)
243 nodes.add(node); 243 nodes.insert(node);
244 244
245 for (const auto& node : rhsNodes) { 245 for (const auto& node : rhsNodes) {
246 if (nodes.add(node).isNewEntry) 246 if (nodes.insert(node).isNewEntry)
247 resultSet.append(node); 247 resultSet.append(node);
248 } 248 }
249 249
250 // It is also possible to use merge sort to avoid making the result 250 // It is also possible to use merge sort to avoid making the result
251 // unsorted; but this would waste the time in cases when order is not 251 // unsorted; but this would waste the time in cases when order is not
252 // important. 252 // important.
253 resultSet.markSorted(false); 253 resultSet.markSorted(false);
254 return lhsResult; 254 return lhsResult;
255 } 255 }
256 256
(...skipping 14 matching lines...) Expand all
271 new Number(result.toNumber())) 271 new Number(result.toNumber()))
272 .evaluate(context) 272 .evaluate(context)
273 .toBoolean(); 273 .toBoolean();
274 274
275 return result.toBoolean(); 275 return result.toBoolean();
276 } 276 }
277 277
278 } // namespace XPath 278 } // namespace XPath
279 279
280 } // namespace blink 280 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/xml/XPathPath.cpp ('k') | third_party/WebKit/Source/modules/accessibility/AXARIAGrid.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698