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

Side by Side Diff: third_party/WebKit/Source/wtf/HashSet.h

Issue 1652953002: Make copyToVector() robust against conservative GCs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove unnecessary 'template' use Created 4 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
« no previous file with comments | « third_party/WebKit/Source/wtf/HashCountedSet.h ('k') | third_party/WebKit/Source/wtf/Vector.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2005, 2006, 2007, 2008, 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2005, 2006, 2007, 2008, 2011 Apple Inc. All rights reserved.
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 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 inline typename HashSet<T, U, V, W>::ValuePassOutType HashSet<T, U, V, W>::takeA ny() 268 inline typename HashSet<T, U, V, W>::ValuePassOutType HashSet<T, U, V, W>::takeA ny()
269 { 269 {
270 return take(begin()); 270 return take(begin());
271 } 271 }
272 272
273 template <typename C, typename W> 273 template <typename C, typename W>
274 inline void copyToVector(const C& collection, W& vector) 274 inline void copyToVector(const C& collection, W& vector)
275 { 275 {
276 typedef typename C::const_iterator iterator; 276 typedef typename C::const_iterator iterator;
277 277
278 vector.resize(collection.size()); 278 {
279 // Disallow GC across resize allocation, see crbug.com/568173
280 typename W::GCForbiddenScope scope;
281 vector.resize(collection.size());
282 }
279 283
280 iterator it = collection.begin(); 284 iterator it = collection.begin();
281 iterator end = collection.end(); 285 iterator end = collection.end();
282 for (unsigned i = 0; it != end; ++it, ++i) 286 for (unsigned i = 0; it != end; ++it, ++i)
283 vector[i] = *it; 287 vector[i] = *it;
284 } 288 }
285 289
286 #if !ENABLE(OILPAN) 290 #if !ENABLE(OILPAN)
287 template <typename T, typename U, typename V> 291 template <typename T, typename U, typename V>
288 struct NeedsTracing<HashSet<T, U, V>> { 292 struct NeedsTracing<HashSet<T, U, V>> {
289 static const bool value = false; 293 static const bool value = false;
290 }; 294 };
291 #endif 295 #endif
292 296
293 } // namespace WTF 297 } // namespace WTF
294 298
295 using WTF::HashSet; 299 using WTF::HashSet;
296 300
297 #endif // WTF_HashSet_h 301 #endif // WTF_HashSet_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/wtf/HashCountedSet.h ('k') | third_party/WebKit/Source/wtf/Vector.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698