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

Side by Side Diff: third_party/WebKit/Source/platform/testing/ArenaTestHelpers.h

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 * Copyright (C) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 Google 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 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 45
46 void* allocate(size_t size) override { 46 void* allocate(size_t size) override {
47 void* result = PODArena::FastMallocAllocator::allocate(size); 47 void* result = PODArena::FastMallocAllocator::allocate(size);
48 m_allocatedRegions.push_back(result); 48 m_allocatedRegions.push_back(result);
49 return result; 49 return result;
50 } 50 }
51 51
52 void free(void* ptr) override { 52 void free(void* ptr) override {
53 size_t slot = m_allocatedRegions.find(ptr); 53 size_t slot = m_allocatedRegions.find(ptr);
54 ASSERT_NE(slot, kNotFound); 54 ASSERT_NE(slot, kNotFound);
55 m_allocatedRegions.remove(slot); 55 m_allocatedRegions.erase(slot);
56 PODArena::FastMallocAllocator::free(ptr); 56 PODArena::FastMallocAllocator::free(ptr);
57 } 57 }
58 58
59 bool isEmpty() const { return !numRegions(); } 59 bool isEmpty() const { return !numRegions(); }
60 60
61 int numRegions() const { return m_allocatedRegions.size(); } 61 int numRegions() const { return m_allocatedRegions.size(); }
62 62
63 private: 63 private:
64 TrackedAllocator() {} 64 TrackedAllocator() {}
65 Vector<void*> m_allocatedRegions; 65 Vector<void*> m_allocatedRegions;
66 }; 66 };
67 67
68 } // namespace ArenaTestHelpers 68 } // namespace ArenaTestHelpers
69 } // namespace blink 69 } // namespace blink
70 70
71 #endif // ArenaTestHelpers_h 71 #endif // ArenaTestHelpers_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698