Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(231)

Unified Diff: third_party/WebKit/Source/wtf/DoublyLinkedList.h

Issue 2769603002: Move files in wtf/ to platform/wtf/ (Part 8). (Closed)
Patch Set: Rebase. Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/wtf/Deque.h ('k') | third_party/WebKit/Source/wtf/FilePrintStream.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/wtf/DoublyLinkedList.h
diff --git a/third_party/WebKit/Source/wtf/DoublyLinkedList.h b/third_party/WebKit/Source/wtf/DoublyLinkedList.h
index 16e0d41125f0ebb8e89593b47f37f4e433d64d88..39fd5ad31b8f1051b7257a738051d02914ef99a9 100644
--- a/third_party/WebKit/Source/wtf/DoublyLinkedList.h
+++ b/third_party/WebKit/Source/wtf/DoublyLinkedList.h
@@ -1,197 +1,9 @@
-/*
- * Copyright (C) 2011 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
+// Copyright 2017 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 DoublyLinkedList_h
-#define DoublyLinkedList_h
+#include "platform/wtf/DoublyLinkedList.h"
-#include "wtf/Allocator.h"
-
-namespace WTF {
-
-// This class allows nodes to share code without dictating data member layout.
-template <typename T>
-class DoublyLinkedListNode {
- public:
- DoublyLinkedListNode();
-
- void setPrev(T*);
- void setNext(T*);
-
- T* prev() const;
- T* next() const;
-};
-
-template <typename T>
-inline DoublyLinkedListNode<T>::DoublyLinkedListNode() {
- setPrev(0);
- setNext(0);
-}
-
-template <typename T>
-inline void DoublyLinkedListNode<T>::setPrev(T* prev) {
- static_cast<T*>(this)->m_prev = prev;
-}
-
-template <typename T>
-inline void DoublyLinkedListNode<T>::setNext(T* next) {
- static_cast<T*>(this)->m_next = next;
-}
-
-template <typename T>
-inline T* DoublyLinkedListNode<T>::prev() const {
- return static_cast<const T*>(this)->m_prev;
-}
-
-template <typename T>
-inline T* DoublyLinkedListNode<T>::next() const {
- return static_cast<const T*>(this)->m_next;
-}
-
-template <typename T>
-class DoublyLinkedList {
- USING_FAST_MALLOC(DoublyLinkedList);
-
- public:
- DoublyLinkedList();
-
- bool isEmpty() const;
- size_t size() const; // This is O(n).
- void clear();
-
- T* head() const;
- T* removeHead();
-
- T* tail() const;
-
- void push(T*);
- void append(T*);
- void remove(T*);
-
- private:
- T* m_head;
- T* m_tail;
-};
-
-template <typename T>
-inline DoublyLinkedList<T>::DoublyLinkedList() : m_head(0), m_tail(0) {}
-
-template <typename T>
-inline bool DoublyLinkedList<T>::isEmpty() const {
- return !m_head;
-}
-
-template <typename T>
-inline size_t DoublyLinkedList<T>::size() const {
- size_t size = 0;
- for (T* node = m_head; node; node = node->next())
- ++size;
- return size;
-}
-
-template <typename T>
-inline void DoublyLinkedList<T>::clear() {
- m_head = 0;
- m_tail = 0;
-}
-
-template <typename T>
-inline T* DoublyLinkedList<T>::head() const {
- return m_head;
-}
-
-template <typename T>
-inline T* DoublyLinkedList<T>::tail() const {
- return m_tail;
-}
-
-template <typename T>
-inline void DoublyLinkedList<T>::push(T* node) {
- if (!m_head) {
- DCHECK(!m_tail);
- m_head = node;
- m_tail = node;
- node->setPrev(0);
- node->setNext(0);
- return;
- }
-
- DCHECK(m_tail);
- m_head->setPrev(node);
- node->setNext(m_head);
- node->setPrev(0);
- m_head = node;
-}
-
-template <typename T>
-inline void DoublyLinkedList<T>::append(T* node) {
- if (!m_tail) {
- DCHECK(!m_head);
- m_head = node;
- m_tail = node;
- node->setPrev(0);
- node->setNext(0);
- return;
- }
-
- DCHECK(m_head);
- m_tail->setNext(node);
- node->setPrev(m_tail);
- node->setNext(0);
- m_tail = node;
-}
-
-template <typename T>
-inline void DoublyLinkedList<T>::remove(T* node) {
- if (node->prev()) {
- DCHECK_NE(node, m_head);
- node->prev()->setNext(node->next());
- } else {
- DCHECK_EQ(node, m_head);
- m_head = node->next();
- }
-
- if (node->next()) {
- DCHECK_NE(node, m_tail);
- node->next()->setPrev(node->prev());
- } else {
- DCHECK_EQ(node, m_tail);
- m_tail = node->prev();
- }
-}
-
-template <typename T>
-inline T* DoublyLinkedList<T>::removeHead() {
- T* node = head();
- if (node)
- remove(node);
- return node;
-}
-
-} // namespace WTF
-
-using WTF::DoublyLinkedListNode;
-using WTF::DoublyLinkedList;
-
-#endif
+// The contents of this header was moved to platform/wtf as part of
+// WTF migration project. See the following post for details:
+// https://groups.google.com/a/chromium.org/d/msg/blink-dev/tLdAZCTlcAA/bYXVT8gYCAAJ
« no previous file with comments | « third_party/WebKit/Source/wtf/Deque.h ('k') | third_party/WebKit/Source/wtf/FilePrintStream.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698