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

Unified Diff: cc/base/list_container_helper.cc

Issue 1437413002: cc: Remove ScopedPtrVector and cc::remove_if. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: just the vector 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
Index: cc/base/list_container_helper.cc
diff --git a/cc/base/list_container_helper.cc b/cc/base/list_container_helper.cc
index 65be43adb3888183392f7930b1c69e67a0f7a9dd..06845283e6ca0edec7712947427e189cca9324da 100644
--- a/cc/base/list_container_helper.cc
+++ b/cc/base/list_container_helper.cc
@@ -7,8 +7,6 @@
#include <algorithm>
#include <vector>
-#include "cc/base/scoped_ptr_vector.h"
-
namespace {
const size_t kDefaultNumElementTypesToReserve = 32;
} // namespace
@@ -103,19 +101,19 @@ class ListContainerHelper::CharAllocator {
: element_size_(element_size),
size_(0),
last_list_index_(0),
- last_list_(NULL) {
+ last_list_(nullptr) {
AllocateNewList(kDefaultNumElementTypesToReserve);
- last_list_ = storage_[last_list_index_];
+ last_list_ = storage_[last_list_index_].get();
}
CharAllocator(size_t element_size, size_t element_count)
: element_size_(element_size),
size_(0),
last_list_index_(0),
- last_list_(NULL) {
+ last_list_(nullptr) {
AllocateNewList(element_count > 0 ? element_count
: kDefaultNumElementTypesToReserve);
- last_list_ = storage_[last_list_index_];
+ last_list_ = storage_[last_list_index_].get();
}
~CharAllocator() {}
@@ -128,7 +126,7 @@ class ListContainerHelper::CharAllocator {
AllocateNewList(last_list_->capacity * 2);
++last_list_index_;
- last_list_ = storage_[last_list_index_];
+ last_list_ = storage_[last_list_index_].get();
}
++size_;
@@ -152,7 +150,7 @@ class ListContainerHelper::CharAllocator {
DCHECK(!storage_.empty());
storage_.erase(storage_.begin() + 1, storage_.end());
last_list_index_ = 0;
- last_list_ = storage_[0];
+ last_list_ = storage_[0].get();
last_list_->size = 0;
size_ = 0;
}
@@ -162,7 +160,7 @@ class ListContainerHelper::CharAllocator {
last_list_->RemoveLast();
if (last_list_->IsEmpty() && last_list_index_ > 0) {
--last_list_index_;
- last_list_ = storage_[last_list_index_];
+ last_list_ = storage_[last_list_index_].get();
// If there are now two empty inner lists, free one of them.
if (last_list_index_ + 2 < storage_.size())
@@ -175,7 +173,7 @@ class ListContainerHelper::CharAllocator {
DCHECK_EQ(this, position->ptr_to_container);
// Update |position| to point to the element after the erased element.
- InnerList* list = storage_[position->vector_index];
+ InnerList* list = storage_[position->vector_index].get();
char* item_iterator = position->item_iterator;
if (item_iterator == list->LastElement())
position->Increment();
@@ -208,7 +206,7 @@ class ListContainerHelper::CharAllocator {
InnerList* InnerListById(size_t id) const {
DCHECK_LT(id, storage_.size());
- return storage_[id];
+ return storage_[id].get();
}
size_t FirstInnerListId() const {
@@ -245,7 +243,7 @@ class ListContainerHelper::CharAllocator {
storage_.push_back(new_list.Pass());
}
- ScopedPtrVector<InnerList> storage_;
+ std::vector<scoped_ptr<InnerList>> storage_;
const size_t element_size_;
// The number of elements in the list.

Powered by Google App Engine
This is Rietveld 408576698