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

Side by Side Diff: third_party/WebKit/Source/wtf/VectorTest.cpp

Issue 2654033007: Migrate WTF::HashSet::add() to ::insert() [part 2 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 (C) 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2011 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 277
278 vector = std::move(otherVector); 278 vector = std::move(otherVector);
279 EXPECT_EQ(count, vector.size()); 279 EXPECT_EQ(count, vector.size());
280 } 280 }
281 281
282 // WrappedInt class will fail if it was memmoved or memcpyed. 282 // WrappedInt class will fail if it was memmoved or memcpyed.
283 static HashSet<void*> constructedWrappedInts; 283 static HashSet<void*> constructedWrappedInts;
284 class WrappedInt { 284 class WrappedInt {
285 public: 285 public:
286 WrappedInt(int i = 0) : m_originalThisPtr(this), m_i(i) { 286 WrappedInt(int i = 0) : m_originalThisPtr(this), m_i(i) {
287 constructedWrappedInts.add(this); 287 constructedWrappedInts.insert(this);
288 } 288 }
289 289
290 WrappedInt(const WrappedInt& other) 290 WrappedInt(const WrappedInt& other)
291 : m_originalThisPtr(this), m_i(other.m_i) { 291 : m_originalThisPtr(this), m_i(other.m_i) {
292 constructedWrappedInts.add(this); 292 constructedWrappedInts.insert(this);
293 } 293 }
294 294
295 WrappedInt& operator=(const WrappedInt& other) { 295 WrappedInt& operator=(const WrappedInt& other) {
296 m_i = other.m_i; 296 m_i = other.m_i;
297 return *this; 297 return *this;
298 } 298 }
299 299
300 ~WrappedInt() { 300 ~WrappedInt() {
301 EXPECT_EQ(m_originalThisPtr, this); 301 EXPECT_EQ(m_originalThisPtr, this);
302 EXPECT_TRUE(constructedWrappedInts.contains(this)); 302 EXPECT_TRUE(constructedWrappedInts.contains(this));
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after
699 static_assert(VectorTraits<UChar>::canCopyWithMemcpy, 699 static_assert(VectorTraits<UChar>::canCopyWithMemcpy,
700 "UChar should be copied with memcpy."); 700 "UChar should be copied with memcpy.");
701 701
702 class UnknownType; 702 class UnknownType;
703 static_assert(VectorTraits<UnknownType*>::canCopyWithMemcpy, 703 static_assert(VectorTraits<UnknownType*>::canCopyWithMemcpy,
704 "Pointers should be copied with memcpy."); 704 "Pointers should be copied with memcpy.");
705 705
706 } // anonymous namespace 706 } // anonymous namespace
707 707
708 } // namespace WTF 708 } // namespace WTF
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/wtf/HashSetTest.cpp ('k') | third_party/WebKit/Source/wtf/text/AtomicStringTable.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698