Remove SchedulerUniqueStack
This code is unreferenced.
BUG=553459
Review-Url: https://codereview.chromium.org/2068803002
Cr-Commit-Position: refs/heads/master@{#399774}
CrOS-Libchrome-Original-Commit: 393d42a00dc3b5c09989e233ce679bd918204148
diff --git a/base/task_scheduler/scheduler_unique_stack.h b/base/task_scheduler/scheduler_unique_stack.h
deleted file mode 100644
index 4f9ce14..0000000
--- a/base/task_scheduler/scheduler_unique_stack.h
+++ /dev/null
@@ -1,91 +0,0 @@
-// 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 BASE_TASK_SCHEDULER_SCHEDULER_UNIQUE_STACK_H_
-#define BASE_TASK_SCHEDULER_SCHEDULER_UNIQUE_STACK_H_
-
-#include <stddef.h>
-
-#include <algorithm>
-#include <vector>
-
-#include "base/logging.h"
-#include "base/macros.h"
-
-namespace base {
-namespace internal {
-
-// A stack that supports removal of arbitrary values and doesn't allow multiple
-// insertions of the same value. This class is NOT thread-safe.
-template <typename T>
-class SchedulerUniqueStack {
- public:
- SchedulerUniqueStack();
- ~SchedulerUniqueStack();
-
- // Inserts |val| at the top of the stack. |val| must not already be on the
- // stack.
- void Push(const T& val);
-
- // Removes the top value from the stack and returns it. Cannot be called on an
- // empty stack.
- T Pop();
-
- // Removes |val| from the stack.
- void Remove(const T& val);
-
- // Returns the number of values on the stack.
- size_t Size() const;
-
- // Returns true if the stack is empty.
- bool Empty() const;
-
- private:
- std::vector<T> stack_;
-
- DISALLOW_COPY_AND_ASSIGN(SchedulerUniqueStack);
-};
-
-template <typename T>
-SchedulerUniqueStack<T>::SchedulerUniqueStack() = default;
-
-template <typename T>
-SchedulerUniqueStack<T>::~SchedulerUniqueStack() = default;
-
-template <typename T>
-void SchedulerUniqueStack<T>::Push(const T& val) {
- DCHECK(std::find(stack_.begin(), stack_.end(), val) == stack_.end())
- << "Value already on stack";
- stack_.push_back(val);
-}
-
-template <typename T>
-T SchedulerUniqueStack<T>::Pop() {
- DCHECK(!stack_.empty());
- const T val = stack_.back();
- stack_.pop_back();
- return val;
-}
-
-template <typename T>
-void SchedulerUniqueStack<T>::Remove(const T& val) {
- auto it = std::find(stack_.begin(), stack_.end(), val);
- if (it != stack_.end())
- stack_.erase(it);
-}
-
-template <typename T>
-size_t SchedulerUniqueStack<T>::Size() const {
- return stack_.size();
-}
-
-template <typename T>
-bool SchedulerUniqueStack<T>::Empty() const {
- return stack_.empty();
-}
-
-} // namespace internal
-} // namespace base
-
-#endif // BASE_TASK_SCHEDULER_SCHEDULER_UNIQUE_STACK_H_
diff --git a/base/task_scheduler/scheduler_unique_stack_unittest.cc b/base/task_scheduler/scheduler_unique_stack_unittest.cc
deleted file mode 100644
index 8ef72dd..0000000
--- a/base/task_scheduler/scheduler_unique_stack_unittest.cc
+++ /dev/null
@@ -1,110 +0,0 @@
-// 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.
-
-#include "base/task_scheduler/scheduler_unique_stack.h"
-
-#include "base/task_scheduler/test_utils.h"
-#include "testing/gtest/include/gtest/gtest.h"
-
-namespace base {
-namespace internal {
-
-// Verify that Push() and Pop() add/remove values in FIFO order.
-TEST(TaskSchedulerUniqueStackTest, PushPop) {
- SchedulerUniqueStack<int> stack;
- EXPECT_TRUE(stack.Empty());
- EXPECT_EQ(0U, stack.Size());
-
- stack.Push(1);
- EXPECT_FALSE(stack.Empty());
- EXPECT_EQ(1U, stack.Size());
-
- stack.Push(2);
- EXPECT_FALSE(stack.Empty());
- EXPECT_EQ(2U, stack.Size());
-
- stack.Push(3);
- EXPECT_FALSE(stack.Empty());
- EXPECT_EQ(3U, stack.Size());
-
- EXPECT_EQ(3, stack.Pop());
- EXPECT_FALSE(stack.Empty());
- EXPECT_EQ(2U, stack.Size());
-
- stack.Push(3);
- EXPECT_FALSE(stack.Empty());
- EXPECT_EQ(3U, stack.Size());
-
- EXPECT_EQ(3, stack.Pop());
- EXPECT_FALSE(stack.Empty());
- EXPECT_EQ(2U, stack.Size());
-
- EXPECT_EQ(2, stack.Pop());
- EXPECT_FALSE(stack.Empty());
- EXPECT_EQ(1U, stack.Size());
-
- EXPECT_EQ(1, stack.Pop());
- EXPECT_TRUE(stack.Empty());
- EXPECT_EQ(0U, stack.Size());
-}
-
-// Verify that a value can be removed by Remove().
-TEST(TaskSchedulerUniqueStackTest, Remove) {
- SchedulerUniqueStack<int> stack;
- EXPECT_TRUE(stack.Empty());
- EXPECT_EQ(0U, stack.Size());
-
- stack.Push(1);
- EXPECT_FALSE(stack.Empty());
- EXPECT_EQ(1U, stack.Size());
-
- stack.Push(2);
- EXPECT_FALSE(stack.Empty());
- EXPECT_EQ(2U, stack.Size());
-
- stack.Push(3);
- EXPECT_FALSE(stack.Empty());
- EXPECT_EQ(3U, stack.Size());
-
- stack.Remove(2);
- EXPECT_FALSE(stack.Empty());
- EXPECT_EQ(2U, stack.Size());
-
- EXPECT_EQ(3, stack.Pop());
- EXPECT_FALSE(stack.Empty());
- EXPECT_EQ(1U, stack.Size());
-
- EXPECT_EQ(1, stack.Pop());
- EXPECT_TRUE(stack.Empty());
- EXPECT_EQ(0U, stack.Size());
-}
-
-// Verify that a value can be pushed again after it has been removed.
-TEST(TaskSchedulerUniqueStackTest, PushAfterRemove) {
- SchedulerUniqueStack<int> stack;
- EXPECT_EQ(0U, stack.Size());
- EXPECT_TRUE(stack.Empty());
-
- stack.Push(5);
- EXPECT_EQ(1U, stack.Size());
- EXPECT_FALSE(stack.Empty());
-
- stack.Remove(5);
- EXPECT_EQ(0U, stack.Size());
- EXPECT_TRUE(stack.Empty());
-
- stack.Push(5);
- EXPECT_EQ(1U, stack.Size());
- EXPECT_FALSE(stack.Empty());
-}
-
-// Verify that Push() DCHECKs when a value is inserted twice.
-TEST(TaskSchedulerUniqueStackTest, PushTwice) {
- SchedulerUniqueStack<int> stack;
- stack.Push(5);
- EXPECT_DCHECK_DEATH({ stack.Push(5); }, "");
-}
-
-} // namespace internal
-} // namespace base