OLD | NEW |
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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 | 57 |
58 // The Arena's default allocator, which uses fastMalloc and | 58 // The Arena's default allocator, which uses fastMalloc and |
59 // fastFree to allocate chunks of storage. | 59 // fastFree to allocate chunks of storage. |
60 class FastMallocAllocator : public Allocator { | 60 class FastMallocAllocator : public Allocator { |
61 public: | 61 public: |
62 static PassRefPtr<FastMallocAllocator> create() | 62 static PassRefPtr<FastMallocAllocator> create() |
63 { | 63 { |
64 return adoptRef(new FastMallocAllocator); | 64 return adoptRef(new FastMallocAllocator); |
65 } | 65 } |
66 | 66 |
67 virtual void* allocate(size_t size) { return fastMalloc(size); } | 67 virtual void* allocate(size_t size) OVERRIDE { return fastMalloc(size);
} |
68 virtual void free(void* ptr) { fastFree(ptr); } | 68 virtual void free(void* ptr) OVERRIDE { fastFree(ptr); } |
69 | 69 |
70 protected: | 70 protected: |
71 FastMallocAllocator() { } | 71 FastMallocAllocator() { } |
72 }; | 72 }; |
73 | 73 |
74 // Creates a new PODArena configured with a FastMallocAllocator. | 74 // Creates a new PODArena configured with a FastMallocAllocator. |
75 static PassRefPtr<PODArena> create() | 75 static PassRefPtr<PODArena> create() |
76 { | 76 { |
77 return adoptRef(new PODArena); | 77 return adoptRef(new PODArena); |
78 } | 78 } |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 | 191 |
192 RefPtr<Allocator> m_allocator; | 192 RefPtr<Allocator> m_allocator; |
193 Chunk* m_current; | 193 Chunk* m_current; |
194 size_t m_currentChunkSize; | 194 size_t m_currentChunkSize; |
195 Vector<OwnPtr<Chunk> > m_chunks; | 195 Vector<OwnPtr<Chunk> > m_chunks; |
196 }; | 196 }; |
197 | 197 |
198 } // namespace WebCore | 198 } // namespace WebCore |
199 | 199 |
200 #endif // PODArena_h | 200 #endif // PODArena_h |
OLD | NEW |