| Index: third_party/WebKit/Source/wtf/FlatSet.h
 | 
| diff --git a/third_party/WebKit/Source/wtf/FlatSet.h b/third_party/WebKit/Source/wtf/FlatSet.h
 | 
| new file mode 100644
 | 
| index 0000000000000000000000000000000000000000..a6a6bc7f59f222eba533fd600696233475161bdd
 | 
| --- /dev/null
 | 
| +++ b/third_party/WebKit/Source/wtf/FlatSet.h
 | 
| @@ -0,0 +1,68 @@
 | 
| +// Copyright 2016 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 WTF_FlatSet_h
 | 
| +#define WTF_FlatSet_h
 | 
| +
 | 
| +#include "base/macros.h"
 | 
| +#include "wtf/FlatTable.h"
 | 
| +
 | 
| +namespace WTF {
 | 
| +
 | 
| +template <typename Key>
 | 
| +struct FlatSetDelegate {
 | 
| +  using key_type = Key;
 | 
| +  using value_type = Key;
 | 
| +
 | 
| +  static inline const Key& ToKey(const value_type& v) { return v; }
 | 
| +};
 | 
| +
 | 
| +// A FlatSet is an STL-like associative container backed by a ring buffer.
 | 
| +// Generally you should use WTF::HashSet unless you need an associative
 | 
| +// container. FlatSet is usually faster than std::set for small sets (<=128)
 | 
| +// (sometimes considerably so) and is always faster for immutable sets.
 | 
| +template <typename Key>
 | 
| +class FlatSet : public FlatTable<FlatSetDelegate<Key>> {
 | 
| + public:
 | 
| +  FlatSet() {}
 | 
| +
 | 
| +  using BaseClass = FlatTable<FlatSetDelegate<Key>>;
 | 
| +  using key_type = typename BaseClass::key_type;
 | 
| +  using value_type = typename BaseClass::value_type;
 | 
| +  using iterator = typename BaseClass::iterator;
 | 
| +  using const_iterator = typename BaseClass::const_iterator;
 | 
| +  using reverse_iterator = typename BaseClass::reverse_iterator;
 | 
| +  using const_reverse_iterator = typename BaseClass::const_reverse_iterator;
 | 
| +
 | 
| +  using BaseClass::empty;
 | 
| +  using BaseClass::clear;
 | 
| +  using BaseClass::insert;
 | 
| +  using BaseClass::insertUnique;
 | 
| +  using BaseClass::size;
 | 
| +
 | 
| +  iterator begin() { return BaseClass::begin(); }
 | 
| +  iterator end() { return BaseClass::end(); }
 | 
| +  const_iterator begin() const { return BaseClass::begin(); }
 | 
| +  const_iterator end() const { return BaseClass::end(); }
 | 
| +  reverse_iterator rbegin() { return BaseClass::rbegin(); }
 | 
| +  const_reverse_iterator rbegin() const { return BaseClass::rbegin(); }
 | 
| +
 | 
| +  // Erases an entry corresponding to |key|, if any, from the map.
 | 
| +  // Invalidates any iterators. O(log n + n / 2)
 | 
| +  size_t erase(const Key& key) { return BaseClass::erase(key); }
 | 
| +
 | 
| +  // Erases |it| from the map, invalidating any iterators. O(n / 2)
 | 
| +  void erase(const iterator& it) { return BaseClass::erase(it); }
 | 
| +  void erase(const reverse_iterator& it) { return BaseClass::erase(it); }
 | 
| +
 | 
| +  // O(log n)
 | 
| +  iterator find(const Key& key) { return BaseClass::find(key); }
 | 
| +
 | 
| +  // O(log n)
 | 
| +  const_iterator find(const Key& key) const { return BaseClass::find(key); }
 | 
| +};
 | 
| +
 | 
| +}  // namespace WTF
 | 
| +
 | 
| +#endif  // WTF_FlatSet_h
 | 
| 
 |