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

Side by Side Diff: third_party/WebKit/Source/platform/graphics/skia/SkSizeHash.h

Issue 1497683002: Make platform/graphics to use USING_FAST_MALLOC. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 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 * 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 16 matching lines...) Expand all
27 #define SkSizeHash_h 27 #define SkSizeHash_h
28 28
29 #include "SkScalar.h" 29 #include "SkScalar.h"
30 #include "SkSize.h" 30 #include "SkSize.h"
31 31
32 #include "wtf/HashMap.h" 32 #include "wtf/HashMap.h"
33 33
34 namespace WTF { 34 namespace WTF {
35 35
36 template<> struct IntHash<SkSize> { 36 template<> struct IntHash<SkSize> {
37 STATIC_ONLY(IntHash);
37 static unsigned hash(const SkSize& key) { return pairIntHash(key.width(), ke y.height()); } 38 static unsigned hash(const SkSize& key) { return pairIntHash(key.width(), ke y.height()); }
38 static bool equal(const SkSize& a, const SkSize& b) { return a == b; } 39 static bool equal(const SkSize& a, const SkSize& b) { return a == b; }
39 static const bool safeToCompareToEmptyOrDeleted = true; 40 static const bool safeToCompareToEmptyOrDeleted = true;
40 }; 41 };
41 42
42 template<> struct DefaultHash<SkSize> { 43 template<> struct DefaultHash<SkSize> {
44 STATIC_ONLY(DefaultHash);
43 typedef IntHash<SkSize> Hash; 45 typedef IntHash<SkSize> Hash;
44 }; 46 };
45 47
46 template<> struct HashTraits<SkSize> : GenericHashTraits<SkSize> { 48 template<> struct HashTraits<SkSize> : GenericHashTraits<SkSize> {
49 STATIC_ONLY(HashTraits);
47 static const bool emptyValueIsZero = true; 50 static const bool emptyValueIsZero = true;
48 static SkSize emptyValue() { return SkSize::Make(0, 0); } 51 static SkSize emptyValue() { return SkSize::Make(0, 0); }
49 static void constructDeletedValue(SkSize& slot, bool) 52 static void constructDeletedValue(SkSize& slot, bool)
50 { 53 {
51 slot = SkSize::Make(-1, -1); 54 slot = SkSize::Make(-1, -1);
52 } 55 }
53 static bool isDeletedValue(const SkSize& value) 56 static bool isDeletedValue(const SkSize& value)
54 { 57 {
55 return value.width() == -1 && value.height() == -1; 58 return value.width() == -1 && value.height() == -1;
56 } 59 }
57 }; 60 };
58 61
59 template<> struct IntHash<SkISize> { 62 template<> struct IntHash<SkISize> {
63 STATIC_ONLY(IntHash);
60 static unsigned hash(const SkISize& key) { return pairIntHash(key.width(), k ey.height()); } 64 static unsigned hash(const SkISize& key) { return pairIntHash(key.width(), k ey.height()); }
61 static bool equal(const SkISize& a, const SkISize& b) { return a == b; } 65 static bool equal(const SkISize& a, const SkISize& b) { return a == b; }
62 static const bool safeToCompareToEmptyOrDeleted = true; 66 static const bool safeToCompareToEmptyOrDeleted = true;
63 }; 67 };
64 68
65 template<> struct DefaultHash<SkISize> { 69 template<> struct DefaultHash<SkISize> {
70 STATIC_ONLY(DefaultHash);
66 typedef IntHash<SkISize> Hash; 71 typedef IntHash<SkISize> Hash;
67 }; 72 };
68 73
69 template<> struct HashTraits<SkISize> : GenericHashTraits<SkISize> { 74 template<> struct HashTraits<SkISize> : GenericHashTraits<SkISize> {
75 STATIC_ONLY(HashTraits);
70 static const bool emptyValueIsZero = true; 76 static const bool emptyValueIsZero = true;
71 static SkISize emptyValue() { return SkISize::Make(0, 0); } 77 static SkISize emptyValue() { return SkISize::Make(0, 0); }
72 static void constructDeletedValue(SkISize& slot, bool) 78 static void constructDeletedValue(SkISize& slot, bool)
73 { 79 {
74 slot = SkISize::Make(-1, -1); 80 slot = SkISize::Make(-1, -1);
75 } 81 }
76 static bool isDeletedValue(const SkISize& value) 82 static bool isDeletedValue(const SkISize& value)
77 { 83 {
78 return value.width() == -1 && value.height() == -1; 84 return value.width() == -1 && value.height() == -1;
79 } 85 }
80 }; 86 };
81 87
82 } // namespace WTF 88 } // namespace WTF
83 89
84 #endif // SkSizeHash_h 90 #endif // SkSizeHash_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698