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

Side by Side Diff: include/private/SkTHash.h

Issue 1316123003: Style Change: SkNEW->new; SkDELETE->delete (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2015-08-26 (Wednesday) 15:59:00 EDT Created 5 years, 3 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 | « include/private/SkFunction.h ('k') | include/private/SkTemplates.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 2015 Google Inc. 2 * Copyright 2015 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #ifndef SkTHash_DEFINED 8 #ifndef SkTHash_DEFINED
9 #define SkTHash_DEFINED 9 #define SkTHash_DEFINED
10 10
(...skipping 11 matching lines...) Expand all
22 // If the key is large and stored inside T, you may want to make K a const&. 22 // If the key is large and stored inside T, you may want to make K a const&.
23 // Similarly, if T is large you might want it to be a pointer. 23 // Similarly, if T is large you might want it to be a pointer.
24 template <typename T, typename K, typename Traits = T> 24 template <typename T, typename K, typename Traits = T>
25 class SkTHashTable : SkNoncopyable { 25 class SkTHashTable : SkNoncopyable {
26 public: 26 public:
27 SkTHashTable() : fCount(0), fRemoved(0), fCapacity(0) {} 27 SkTHashTable() : fCount(0), fRemoved(0), fCapacity(0) {}
28 28
29 // Clear the table. 29 // Clear the table.
30 void reset() { 30 void reset() {
31 this->~SkTHashTable(); 31 this->~SkTHashTable();
32 SkNEW_PLACEMENT(this, SkTHashTable); 32 new (this) SkTHashTable;
33 } 33 }
34 34
35 // How many entries are in the table? 35 // How many entries are in the table?
36 int count() const { return fCount; } 36 int count() const { return fCount; }
37 37
38 // Approximately how many bytes of memory do we use beyond sizeof(*this)? 38 // Approximately how many bytes of memory do we use beyond sizeof(*this)?
39 size_t approxBytesUsed() const { return fCapacity * sizeof(Slot); } 39 size_t approxBytesUsed() const { return fCapacity * sizeof(Slot); }
40 40
41 // !!!!!!!!!!!!!!!!! CAUTION !!!!!!!!!!!!! !!!! 41 // !!!!!!!!!!!!!!!!! CAUTION !!!!!!!!!!!!! !!!!
42 // set(), find() and foreach() all allow mutable access to table entries. 42 // set(), find() and foreach() all allow mutable access to table entries.
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 292
293 private: 293 private:
294 struct Traits { 294 struct Traits {
295 static const T& GetKey(const T& item) { return item; } 295 static const T& GetKey(const T& item) { return item; }
296 static uint32_t Hash(const T& item) { return HashT(item); } 296 static uint32_t Hash(const T& item) { return HashT(item); }
297 }; 297 };
298 SkTHashTable<T, T, Traits> fTable; 298 SkTHashTable<T, T, Traits> fTable;
299 }; 299 };
300 300
301 #endif//SkTHash_DEFINED 301 #endif//SkTHash_DEFINED
OLDNEW
« no previous file with comments | « include/private/SkFunction.h ('k') | include/private/SkTemplates.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698