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

Unified Diff: base/containers/linked_list.h

Issue 240873003: Create WebSocketTransportClientSocketPool (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Rebase. Created 6 years, 6 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 | « no previous file | base/containers/linked_list_unittest.cc » ('j') | net/socket/transport_client_socket_pool.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/containers/linked_list.h
diff --git a/base/containers/linked_list.h b/base/containers/linked_list.h
index 25bbe762cb759b4eba6c67b00ec0206c3e6bec4f..41461ff365e66fdbd568e2dcd3a96b7d212378ae 100644
--- a/base/containers/linked_list.h
+++ b/base/containers/linked_list.h
@@ -5,6 +5,8 @@
#ifndef BASE_CONTAINERS_LINKED_LIST_H_
#define BASE_CONTAINERS_LINKED_LIST_H_
+#include "base/macros.h"
+
// Simple LinkedList type. (See the Q&A section to understand how this
// differs from std::list).
//
@@ -82,7 +84,7 @@ namespace base {
template <typename T>
class LinkNode {
public:
- LinkNode() : previous_(0), next_(0) {}
+ LinkNode() : previous_(NULL), next_(NULL) {}
LinkNode(LinkNode<T>* previous, LinkNode<T>* next)
: previous_(previous), next_(next) {}
@@ -106,6 +108,10 @@ class LinkNode {
void RemoveFromList() {
this->previous_->next_ = this->next_;
this->next_->previous_ = this->previous_;
+ // next() and previous() return non-NULL if and only this node is not in any
+ // list.
+ this->next_ = NULL;
+ this->previous_ = NULL;
}
LinkNode<T>* previous() const {
@@ -128,6 +134,8 @@ class LinkNode {
private:
LinkNode<T>* previous_;
LinkNode<T>* next_;
+
+ DISALLOW_COPY_AND_ASSIGN(LinkNode);
};
template <typename T>
@@ -155,8 +163,12 @@ class LinkedList {
return &root_;
}
+ bool empty() const { return head() == end(); }
+
private:
LinkNode<T> root_;
+
+ DISALLOW_COPY_AND_ASSIGN(LinkedList);
};
} // namespace base
« no previous file with comments | « no previous file | base/containers/linked_list_unittest.cc » ('j') | net/socket/transport_client_socket_pool.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698