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

Unified Diff: cc/base/container_util.h

Issue 1441613002: cc: Remove ScopedPtrDeque. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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 | « cc/base/BUILD.gn ('k') | cc/base/scoped_ptr_deque.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/base/container_util.h
diff --git a/cc/base/container_util.h b/cc/base/container_util.h
new file mode 100644
index 0000000000000000000000000000000000000000..2f0da6c1b029082bae4db03bef4ff15fc3cc94d5
--- /dev/null
+++ b/cc/base/container_util.h
@@ -0,0 +1,34 @@
+// Copyright 2015 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 CC_BASE_CONTAINER_UTIL_H_
+#define CC_BASE_CONTAINER_UTIL_H_
+
+#include "base/memory/scoped_ptr.h"
+
+namespace cc {
+
+// Removes the front element from the container and returns it. Note that this
+// currently only works with types that implement Pass().
+// TODO(vmpstr): Use std::move instead of Pass when allowed.
+template <typename Container>
+typename Container::value_type PopFront(Container* container) {
+ typename Container::value_type element = container->front().Pass();
+ container->pop_front();
+ return element;
+}
+
+// Removes the back element from the container and returns it. Note that this
+// currently only works with types that implement Pass().
+// TODO(vmpstr): Use std::move instead of Pass when allowed.
+template <typename Container>
+typename Container::value_type PopBack(Container* container) {
+ typename Container::value_type element = container->back().Pass();
+ container->pop_back();
+ return element;
+}
+
+} // namespace cc
+
+#endif // CC_BASE_CONTAINER_UTIL_H_
« no previous file with comments | « cc/base/BUILD.gn ('k') | cc/base/scoped_ptr_deque.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698