| 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..19dcb15fafa33384f2efe4a0f3768b46662e224c 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,34 @@ 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(); }
|
| + // TODO(wkorman): Should we optimize below to keep a single static
|
| + // pre-constructed CompositorElementId() rather than constructing each
|
| + // function call?
|
| + static void constructDeletedValue(CompositorElementId& slot, bool) {
|
| + slot = CompositorElementId();
|
| + }
|
| + static bool isDeletedValue(CompositorElementId value) {
|
| + return value == CompositorElementId();
|
| + }
|
| +};
|
| +
|
| } // namespace blink
|
|
|
| #endif // CompositorElementId_h
|
|
|