| 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..c45db953fb764c5bae78b94aee45df7be8ee35dd 100644
|
| --- a/third_party/WebKit/Source/platform/graphics/CompositorElementId.h
|
| +++ b/third_party/WebKit/Source/platform/graphics/CompositorElementId.h
|
| @@ -7,6 +7,9 @@
|
|
|
| #include "cc/trees/element_id.h"
|
| #include "platform/PlatformExport.h"
|
| +#include "wtf/HashFunctions.h"
|
| +#include "wtf/HashSet.h"
|
| +#include "wtf/HashTraits.h"
|
|
|
| namespace blink {
|
|
|
| @@ -17,6 +20,35 @@ 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);
|
| + }
|
| +};
|
| +
|
| +using CompositorElementIdSet = HashSet<CompositorElementId,
|
| + CompositorElementIdHash,
|
| + CompositorElementIdHashTraits>;
|
| +
|
| } // namespace blink
|
|
|
| #endif // CompositorElementId_h
|
|
|