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

Unified Diff: cc/output/bsp_tree.cc

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/output/bsp_tree.h ('k') | cc/output/bsp_tree_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/output/bsp_tree.cc
diff --git a/cc/output/bsp_tree.cc b/cc/output/bsp_tree.cc
index 4eb87cb95d28fa65f003302a7535887da7747be9..a32c3f49b69a3ebc0e5ba1086f86d6fe775f4c81 100644
--- a/cc/output/bsp_tree.cc
+++ b/cc/output/bsp_tree.cc
@@ -7,7 +7,7 @@
#include <vector>
#include "base/memory/scoped_ptr.h"
-#include "cc/base/scoped_ptr_deque.h"
+#include "cc/base/container_util.h"
#include "cc/base/scoped_ptr_vector.h"
#include "cc/output/bsp_compare_result.h"
#include "cc/quads/draw_polygon.h"
@@ -20,11 +20,11 @@ BspNode::BspNode(scoped_ptr<DrawPolygon> data) : node_data(data.Pass()) {
BspNode::~BspNode() {
}
-BspTree::BspTree(ScopedPtrDeque<DrawPolygon>* list) {
+BspTree::BspTree(std::deque<scoped_ptr<DrawPolygon>>* list) {
if (list->size() == 0)
return;
- root_ = make_scoped_ptr(new BspNode(list->take_front()));
+ root_ = make_scoped_ptr(new BspNode(PopFront(list)));
BuildTree(root_.get(), list);
}
@@ -35,14 +35,14 @@ BspTree::BspTree(ScopedPtrDeque<DrawPolygon>* list) {
// can always simply just take from the front of the deque for our node's
// data.
void BspTree::BuildTree(BspNode* node,
- ScopedPtrDeque<DrawPolygon>* polygon_list) {
- ScopedPtrDeque<DrawPolygon> front_list;
- ScopedPtrDeque<DrawPolygon> back_list;
+ std::deque<scoped_ptr<DrawPolygon>>* polygon_list) {
+ std::deque<scoped_ptr<DrawPolygon>> front_list;
+ std::deque<scoped_ptr<DrawPolygon>> back_list;
// We take in a list of polygons at this level of the tree, and have to
// find a splitting plane, then classify polygons as either in front of
// or behind that splitting plane.
- while (polygon_list->size() > 0) {
+ while (!polygon_list->empty()) {
// Is this particular polygon in front of or behind our splitting polygon.
BspCompareResult comparer_result =
GetNodePositionRelative(*polygon_list->front(), *(node->node_data));
@@ -52,10 +52,10 @@ void BspTree::BuildTree(BspNode* node,
// or front of the list.
switch (comparer_result) {
case BSP_FRONT:
- front_list.push_back(polygon_list->take_front().Pass());
+ front_list.push_back(PopFront(polygon_list));
break;
case BSP_BACK:
- back_list.push_back(polygon_list->take_front().Pass());
+ back_list.push_back(PopFront(polygon_list));
break;
case BSP_SPLIT:
{
@@ -63,7 +63,7 @@ void BspTree::BuildTree(BspNode* node,
scoped_ptr<DrawPolygon> new_front;
scoped_ptr<DrawPolygon> new_back;
// Time to split this geometry, *it needs to be split by node_data.
- polygon = polygon_list->take_front();
+ polygon = PopFront(polygon_list);
bool split_result =
polygon->Split(*(node->node_data), &new_front, &new_back);
DCHECK(split_result);
@@ -75,10 +75,10 @@ void BspTree::BuildTree(BspNode* node,
break;
}
case BSP_COPLANAR_FRONT:
- node->coplanars_front.push_back(polygon_list->take_front());
+ node->coplanars_front.push_back(PopFront(polygon_list));
break;
case BSP_COPLANAR_BACK:
- node->coplanars_back.push_back(polygon_list->take_front());
+ node->coplanars_back.push_back(PopFront(polygon_list));
break;
default:
NOTREACHED();
@@ -88,14 +88,13 @@ void BspTree::BuildTree(BspNode* node,
// Build the back subtree using the front of the back_list as our splitter.
if (back_list.size() > 0) {
- node->back_child = make_scoped_ptr(new BspNode(back_list.take_front()));
+ node->back_child = make_scoped_ptr(new BspNode(PopFront(&back_list)));
BuildTree(node->back_child.get(), &back_list);
}
// Build the front subtree using the front of the front_list as our splitter.
if (front_list.size() > 0) {
- node->front_child =
- scoped_ptr<BspNode>(new BspNode(front_list.take_front()));
+ node->front_child = make_scoped_ptr(new BspNode(PopFront(&front_list)));
BuildTree(node->front_child.get(), &front_list);
}
}
« no previous file with comments | « cc/output/bsp_tree.h ('k') | cc/output/bsp_tree_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698