| Index: third_party/WebKit/Source/platform/graphics/CompositorElementId.h
|
| diff --git a/third_party/WebKit/Source/platform/graphics/CompositorElementId.h b/third_party/WebKit/Source/platform/graphics/CompositorElementId.h
|
| index 230d3dfcd9ed7fe07fed154f83c38be88150c88f..6ff66937305e0421e5805e13c5d1fbc9edbdf033 100644
|
| --- a/third_party/WebKit/Source/platform/graphics/CompositorElementId.h
|
| +++ b/third_party/WebKit/Source/platform/graphics/CompositorElementId.h
|
| @@ -7,6 +7,8 @@
|
|
|
| #include "cc/trees/element_id.h"
|
| #include "platform/PlatformExport.h"
|
| +#include "wtf/HashFunctions.h"
|
| +#include "wtf/HashTraits.h"
|
|
|
| namespace blink {
|
|
|
| @@ -17,6 +19,31 @@ using CompositorElementId = cc::ElementId;
|
| CompositorElementId PLATFORM_EXPORT
|
| createCompositorElementId(int domNodeId, CompositorSubElementId);
|
|
|
| +// Note cc::ElementId has a hash function already implemented via
|
| +// ElementIdHash::operator(). However for consistency's sake we choose to use
|
| +// Blink's hash functions with Blink specific data structures.
|
| +struct CompositorElementIdHash {
|
| + static unsigned hash(const CompositorElementId& p) {
|
| + return WTF::hashInts(p.primaryId, p.secondaryId);
|
| + }
|
| + static bool equal(const CompositorElementId& a,
|
| + const CompositorElementId& b) {
|
| + return a.primaryId == b.primaryId && a.secondaryId == b.secondaryId;
|
| + }
|
| + static const bool safeToCompareToEmptyOrDeleted = true;
|
| +};
|
| +
|
| +struct CompositorElementIdHashTraits
|
| + : WTF::GenericHashTraits<CompositorElementId> {
|
| + static CompositorElementId emptyValue() { return CompositorElementId(); }
|
| + static void constructDeletedValue(CompositorElementId& slot, bool) {
|
| + slot = CompositorElementId(-1, -1);
|
| + }
|
| + static bool isDeletedValue(CompositorElementId value) {
|
| + return value == CompositorElementId(-1, -1);
|
| + }
|
| +};
|
| +
|
| } // namespace blink
|
|
|
| #endif // CompositorElementId_h
|
|
|