Chromium Code Reviews| Index: Source/bindings/core/v8/ScriptValueTraits.h |
| diff --git a/Source/bindings/core/v8/ScriptValueTraits.h b/Source/bindings/core/v8/ScriptValueTraits.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..19b7e1ef8886d9c8dfc3becdf0fd052b4cea3fe2 |
| --- /dev/null |
| +++ b/Source/bindings/core/v8/ScriptValueTraits.h |
| @@ -0,0 +1,26 @@ |
| +// Copyright 2014 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef ScriptValueTraits_h |
| +#define ScriptValueTraits_h |
| + |
| +#include "bindings/core/v8/ScriptValue.h" |
| +#include "wtf/HashTraits.h" |
| + |
| +namespace blink { |
| + |
| +struct ScriptValueHash { |
| + static unsigned hash(const ScriptValue& value) { return value.identityHash(); } |
| + static bool equal(const ScriptValue& a, const ScriptValue& b) { return a == b; } |
| + static const bool safeToCompareToEmptyOrDeleted = true; |
| +}; |
| + |
| +struct ScriptValueHashTraits : WTF::SimpleClassHashTraits<ScriptValue> { |
| + static const bool hasIsEmptyValueFunction = true; |
| + static bool isEmptyValue(const ScriptValue& value) { return value.isEmpty() && !value.isHashTableDeletedValue(); } |
|
yurys
2014/10/03 15:08:05
Why do we need !value.isHashTableDeletedValue(); ?
aandrey
2014/10/06 10:52:57
Acknowledged.
|
| +}; |
| + |
| +} // namespace blink |
| + |
| +#endif // !defined(ScriptValueTraits_h) |