OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012, 2013 Apple Inc. All Rights Reserved. | 2 * Copyright (C) 2012, 2013 Apple 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 13 matching lines...) Expand all Loading... |
24 * | 24 * |
25 */ | 25 */ |
26 | 26 |
27 #include "config.h" | 27 #include "config.h" |
28 #include "core/dom/ElementDataCache.h" | 28 #include "core/dom/ElementDataCache.h" |
29 | 29 |
30 #include "core/dom/ElementData.h" | 30 #include "core/dom/ElementData.h" |
31 | 31 |
32 namespace WebCore { | 32 namespace WebCore { |
33 | 33 |
| 34 DEFINE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(ElementDataCache) |
| 35 |
34 inline unsigned attributeHash(const Vector<Attribute>& attributes) | 36 inline unsigned attributeHash(const Vector<Attribute>& attributes) |
35 { | 37 { |
36 return StringHasher::hashMemory(attributes.data(), attributes.size() * sizeo
f(Attribute)); | 38 return StringHasher::hashMemory(attributes.data(), attributes.size() * sizeo
f(Attribute)); |
37 } | 39 } |
38 | 40 |
39 inline bool hasSameAttributes(const Vector<Attribute>& attributes, ShareableElem
entData& elementData) | 41 inline bool hasSameAttributes(const Vector<Attribute>& attributes, ShareableElem
entData& elementData) |
40 { | 42 { |
41 if (attributes.size() != elementData.attributes().size()) | 43 if (attributes.size() != elementData.attributes().size()) |
42 return false; | 44 return false; |
43 return !memcmp(attributes.data(), elementData.m_attributeArray, attributes.s
ize() * sizeof(Attribute)); | 45 return !memcmp(attributes.data(), elementData.m_attributeArray, attributes.s
ize() * sizeof(Attribute)); |
(...skipping 12 matching lines...) Expand all Loading... |
56 if (!it->value) | 58 if (!it->value) |
57 it->value = ShareableElementData::createWithAttributes(attributes); | 59 it->value = ShareableElementData::createWithAttributes(attributes); |
58 | 60 |
59 return it->value.get(); | 61 return it->value.get(); |
60 } | 62 } |
61 | 63 |
62 ElementDataCache::ElementDataCache() | 64 ElementDataCache::ElementDataCache() |
63 { | 65 { |
64 } | 66 } |
65 | 67 |
66 ElementDataCache::~ElementDataCache() | 68 void ElementDataCache::trace(Visitor* visitor) |
67 { | 69 { |
| 70 visitor->trace(m_shareableElementDataCache); |
68 } | 71 } |
69 | 72 |
70 } | 73 } |
OLD | NEW |