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

Unified Diff: cc/base/list_container.h

Issue 1163803003: cc: Implement RemoveLast for DisplayItemList. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: danakj comments Created 5 years, 7 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 | cc/base/list_container.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/base/list_container.h
diff --git a/cc/base/list_container.h b/cc/base/list_container.h
index 2ed69c263796548a04399633ab105f3aeddf31e2..0c3772b82fdb9acbf27e731f42679025835f29ac 100644
--- a/cc/base/list_container.h
+++ b/cc/base/list_container.h
@@ -5,6 +5,7 @@
#ifndef CC_BASE_LIST_CONTAINER_H_
#define CC_BASE_LIST_CONTAINER_H_
+#include "base/logging.h"
#include "base/macros.h"
#include "base/memory/scoped_ptr.h"
#include "cc/base/cc_export.h"
@@ -141,8 +142,8 @@ class CC_EXPORT ListContainerBase {
size_t index_;
};
- // Unlike the ListContainer method, this one does not invoke element
- // destructors.
+ // Unlike the ListContainer methods, these do not invoke element destructors.
+ void RemoveLast();
void EraseAndInvalidateAllPointers(Iterator position);
ConstReverseIterator crbegin() const;
@@ -209,6 +210,14 @@ class ListContainer : public ListContainerBase {
class ReverseIterator;
class ConstReverseIterator;
+ // Removes the last element of the list and makes its space available for
+ // allocation.
+ void RemoveLast() {
+ DCHECK(!empty());
+ back()->~BaseElementType();
+ ListContainerBase::RemoveLast();
+ }
+
// When called, all raw pointers that have been handed out are no longer
// valid. Use with caution.
// This function does not deallocate memory.
« no previous file with comments | « no previous file | cc/base/list_container.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698