| OLD | NEW |
| 1 /* | 1 /* |
| 2 * This file is part of Adblock Plus <https://adblockplus.org/>, | 2 * This file is part of Adblock Plus <https://adblockplus.org/>, |
| 3 * Copyright (C) 2006-present eyeo GmbH | 3 * Copyright (C) 2006-present eyeo GmbH |
| 4 * | 4 * |
| 5 * Adblock Plus is free software: you can redistribute it and/or modify | 5 * Adblock Plus is free software: you can redistribute it and/or modify |
| 6 * it under the terms of the GNU General Public License version 3 as | 6 * it under the terms of the GNU General Public License version 3 as |
| 7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
| 8 * | 8 * |
| 9 * Adblock Plus is distributed in the hope that it will be useful, | 9 * Adblock Plus 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 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 void allocate() | 200 void allocate() |
| 201 { | 201 { |
| 202 mBuckets.reset(new entry_type[mBucketCount]); | 202 mBuckets.reset(new entry_type[mBucketCount]); |
| 203 // Working around https://github.com/waywardmonkeys/emscripten-trace-colle
ctor/issues/2 here | 203 // Working around https://github.com/waywardmonkeys/emscripten-trace-colle
ctor/issues/2 here |
| 204 annotate_address(reinterpret_cast<size_type*>(mBuckets.get()) - 1, "Hash t
able buffer"); | 204 annotate_address(reinterpret_cast<size_type*>(mBuckets.get()) - 1, "Hash t
able buffer"); |
| 205 } | 205 } |
| 206 | 206 |
| 207 public: | 207 public: |
| 208 explicit HashContainer(size_type expectedEntries = 0) | 208 explicit HashContainer(size_type expectedEntries = 0) |
| 209 : mEntryCount(0) | 209 : mEntryCount(0) |
| 210 #if defined(DEBUG) |
| 211 , mInsertCounter(0) |
| 212 #endif |
| 210 { | 213 { |
| 211 expectedEntries = ceil(expectedEntries / LOAD_FACTOR); | 214 expectedEntries = ceil(expectedEntries / LOAD_FACTOR); |
| 212 mBucketCount = MIN_BUCKETS; | 215 mBucketCount = MIN_BUCKETS; |
| 213 while (mBucketCount < expectedEntries) | 216 while (mBucketCount < expectedEntries) |
| 214 mBucketCount <<= 1; | 217 mBucketCount <<= 1; |
| 215 | 218 |
| 216 allocate(); | 219 allocate(); |
| 217 } | 220 } |
| 218 | 221 |
| 219 void clear() | 222 void clear() |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 339 return super::find(key); | 342 return super::find(key); |
| 340 } | 343 } |
| 341 | 344 |
| 342 reference find(key_type_cref key) | 345 reference find(key_type_cref key) |
| 343 { | 346 { |
| 344 return reference(this, key, super::find_bucket(key)); | 347 return reference(this, key, super::find_bucket(key)); |
| 345 } | 348 } |
| 346 }; | 349 }; |
| 347 | 350 |
| 348 ABP_NS_END | 351 ABP_NS_END |
| OLD | NEW |