Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 626970
Collapse All | Expand All

(-)a/third_party/WebKit/Source/platform/wtf/LinkedHashSet.h (-40 / +40 lines)
Lines 647-652 Link Here
647
  friend class LinkedHashSet;
647
  friend class LinkedHashSet;
648
};
648
};
649
649
650
inline void SwapAnchor(LinkedHashSetNodeBase& a, LinkedHashSetNodeBase& b) {
651
  DCHECK(a.prev_);
652
  DCHECK(a.next_);
653
  DCHECK(b.prev_);
654
  DCHECK(b.next_);
655
  swap(a.prev_, b.prev_);
656
  swap(a.next_, b.next_);
657
  if (b.next_ == &a) {
658
    DCHECK_EQ(b.prev_, &a);
659
    b.next_ = &b;
660
    b.prev_ = &b;
661
  } else {
662
    b.next_->prev_ = &b;
663
    b.prev_->next_ = &b;
664
  }
665
  if (a.next_ == &b) {
666
    DCHECK_EQ(a.prev_, &b);
667
    a.next_ = &a;
668
    a.prev_ = &a;
669
  } else {
670
    a.next_->prev_ = &a;
671
    a.prev_->next_ = &a;
672
  }
673
}
674
675
inline void swap(LinkedHashSetNodeBase& a, LinkedHashSetNodeBase& b) {
676
  DCHECK_NE(a.next_, &a);
677
  DCHECK_NE(b.next_, &b);
678
  swap(a.prev_, b.prev_);
679
  swap(a.next_, b.next_);
680
  if (b.next_) {
681
    b.next_->prev_ = &b;
682
    b.prev_->next_ = &b;
683
  }
684
  if (a.next_) {
685
    a.next_->prev_ = &a;
686
    a.prev_->next_ = &a;
687
  }
688
}
689
650
template <typename T, typename U, typename V, typename Allocator>
690
template <typename T, typename U, typename V, typename Allocator>
651
inline LinkedHashSet<T, U, V, Allocator>::LinkedHashSet() {
691
inline LinkedHashSet<T, U, V, Allocator>::LinkedHashSet() {
652
  static_assert(
692
  static_assert(
Lines 877-922 Link Here
877
  erase(find(value));
917
  erase(find(value));
878
}
918
}
879
919
880
inline void SwapAnchor(LinkedHashSetNodeBase& a, LinkedHashSetNodeBase& b) {
881
  DCHECK(a.prev_);
882
  DCHECK(a.next_);
883
  DCHECK(b.prev_);
884
  DCHECK(b.next_);
885
  swap(a.prev_, b.prev_);
886
  swap(a.next_, b.next_);
887
  if (b.next_ == &a) {
888
    DCHECK_EQ(b.prev_, &a);
889
    b.next_ = &b;
890
    b.prev_ = &b;
891
  } else {
892
    b.next_->prev_ = &b;
893
    b.prev_->next_ = &b;
894
  }
895
  if (a.next_ == &b) {
896
    DCHECK_EQ(a.prev_, &b);
897
    a.next_ = &a;
898
    a.prev_ = &a;
899
  } else {
900
    a.next_->prev_ = &a;
901
    a.prev_->next_ = &a;
902
  }
903
}
904
905
inline void swap(LinkedHashSetNodeBase& a, LinkedHashSetNodeBase& b) {
906
  DCHECK_NE(a.next_, &a);
907
  DCHECK_NE(b.next_, &b);
908
  swap(a.prev_, b.prev_);
909
  swap(a.next_, b.next_);
910
  if (b.next_) {
911
    b.next_->prev_ = &b;
912
    b.prev_->next_ = &b;
913
  }
914
  if (a.next_) {
915
    a.next_->prev_ = &a;
916
    a.prev_->next_ = &a;
917
  }
918
}
919
920
template <typename T, typename Allocator>
920
template <typename T, typename Allocator>
921
inline void swap(LinkedHashSetNode<T, Allocator>& a,
921
inline void swap(LinkedHashSetNode<T, Allocator>& a,
922
                 LinkedHashSetNode<T, Allocator>& b) {
922
                 LinkedHashSetNode<T, Allocator>& b) {

Return to bug 626970