OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
4 * (C) 2001 Dirk Mueller ( mueller@kde.org ) | 4 * (C) 2001 Dirk Mueller ( mueller@kde.org ) |
5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights | 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights |
6 * reserved. | 6 * reserved. |
7 * Copyright (C) 2006 Andrew Wellington (proton@wiretapped.net) | 7 * Copyright (C) 2006 Andrew Wellington (proton@wiretapped.net) |
8 * | 8 * |
9 * This library is free software; you can redistribute it and/or | 9 * This library is free software; you can redistribute it and/or |
10 * modify it under the terms of the GNU Library General Public | 10 * modify it under the terms of the GNU Library General Public |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 while (m_map.contains(m_index)) | 47 while (m_map.contains(m_index)) |
48 m_index++; | 48 m_index++; |
49 | 49 |
50 m_map.set(m_index, std::move(calcValue)); | 50 m_map.set(m_index, std::move(calcValue)); |
51 | 51 |
52 return m_index; | 52 return m_index; |
53 } | 53 } |
54 | 54 |
55 void remove(int index) { | 55 void remove(int index) { |
56 ASSERT(m_map.contains(index)); | 56 ASSERT(m_map.contains(index)); |
57 m_map.remove(index); | 57 m_map.erase(index); |
58 } | 58 } |
59 | 59 |
60 CalculationValue& get(int index) { | 60 CalculationValue& get(int index) { |
61 ASSERT(m_map.contains(index)); | 61 ASSERT(m_map.contains(index)); |
62 return *m_map.get(index); | 62 return *m_map.get(index); |
63 } | 63 } |
64 | 64 |
65 void decrementRef(int index) { | 65 void decrementRef(int index) { |
66 ASSERT(m_map.contains(index)); | 66 ASSERT(m_map.contains(index)); |
67 CalculationValue* value = m_map.get(index); | 67 CalculationValue* value = m_map.get(index); |
68 if (value->hasOneRef()) { | 68 if (value->hasOneRef()) { |
69 // Force the CalculationValue destructor early to avoid a potential | 69 // Force the CalculationValue destructor early to avoid a potential |
70 // recursive call inside HashMap remove(). | 70 // recursive call inside HashMap remove(). |
71 m_map.set(index, nullptr); | 71 m_map.set(index, nullptr); |
72 m_map.remove(index); | 72 m_map.erase(index); |
73 } else { | 73 } else { |
74 value->deref(); | 74 value->deref(); |
75 } | 75 } |
76 } | 76 } |
77 | 77 |
78 private: | 78 private: |
79 int m_index; | 79 int m_index; |
80 HashMap<int, RefPtr<CalculationValue>> m_map; | 80 HashMap<int, RefPtr<CalculationValue>> m_map; |
81 }; | 81 }; |
82 | 82 |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 } | 175 } |
176 | 176 |
177 struct SameSizeAsLength { | 177 struct SameSizeAsLength { |
178 int32_t value; | 178 int32_t value; |
179 int32_t metaData; | 179 int32_t metaData; |
180 }; | 180 }; |
181 static_assert(sizeof(Length) == sizeof(SameSizeAsLength), | 181 static_assert(sizeof(Length) == sizeof(SameSizeAsLength), |
182 "length should stay small"); | 182 "length should stay small"); |
183 | 183 |
184 } // namespace blink | 184 } // namespace blink |
OLD | NEW |