Commit c1878c6c authored by weiliangc's avatar weiliangc Committed by Commit bot

ScopedPtrVector change back const_iterator typedef

Calling begin() const and end() const function in ScopedPtrVector has
compiler error with const_iterator. Change back from const T* to T*.

Also since cpplint complains has to change a reference to pointer.

Review URL: https://codereview.chromium.org/534743002

Cr-Commit-Position: refs/heads/master@{#293014}
parent f1beb000
......@@ -20,7 +20,7 @@ namespace cc {
template <typename T>
class ScopedPtrVector {
public:
typedef typename std::vector<const T*>::const_iterator const_iterator;
typedef typename std::vector<T*>::const_iterator const_iterator;
typedef typename std::vector<T*>::reverse_iterator reverse_iterator;
typedef typename std::vector<T*>::const_reverse_iterator
const_reverse_iterator;
......@@ -129,13 +129,11 @@ class ScopedPtrVector {
data_.insert(position, item.release());
}
void insert_and_take(iterator position,
ScopedPtrVector<T>& other) {
void insert_and_take(iterator position, ScopedPtrVector<T>* other) {
std::vector<T*> tmp_data;
for (ScopedPtrVector<T>::iterator it = other.begin();
it != other.end();
for (ScopedPtrVector<T>::iterator it = other->begin(); it != other->end();
++it) {
tmp_data.push_back(other.take(it).release());
tmp_data.push_back(other->take(it).release());
}
data_.insert(position, tmp_data.begin(), tmp_data.end());
}
......
......@@ -59,7 +59,7 @@ TEST(ScopedPtrVectorTest, InsertAndTake) {
++it;
EXPECT_EQ(6, (*it)->data());
v.insert_and_take(it, v2);
v.insert_and_take(it, &v2);
EXPECT_EQ(6u, v.size());
EXPECT_EQ(1, v[0]->data());
......
......@@ -206,7 +206,7 @@ void LayerImpl::PassCopyRequests(ScopedPtrVector<CopyOutputRequest>* requests) {
return;
bool was_empty = copy_requests_.empty();
copy_requests_.insert_and_take(copy_requests_.end(), *requests);
copy_requests_.insert_and_take(copy_requests_.end(), requests);
requests->clear();
if (was_empty && layer_tree_impl()->IsActiveTree())
......@@ -220,7 +220,7 @@ void LayerImpl::TakeCopyRequestsAndTransformToTarget(
DCHECK(layer_tree_impl()->IsActiveTree());
size_t first_inserted_request = requests->size();
requests->insert_and_take(requests->end(), copy_requests_);
requests->insert_and_take(requests->end(), &copy_requests_);
copy_requests_.clear();
for (size_t i = first_inserted_request; i < requests->size(); ++i) {
......
......@@ -962,7 +962,7 @@ void LayerTreeImpl::QueueSwapPromise(scoped_ptr<SwapPromise> swap_promise) {
void LayerTreeImpl::PassSwapPromises(
ScopedPtrVector<SwapPromise>* new_swap_promise) {
swap_promise_list_.insert_and_take(swap_promise_list_.end(),
*new_swap_promise);
new_swap_promise);
new_swap_promise->clear();
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment