summaryrefslogtreecommitdiffstats
path: root/cc/output
diff options
context:
space:
mode:
authorvmpstr <vmpstr@chromium.org>2015-11-13 17:37:11 -0800
committerCommit bot <commit-bot@chromium.org>2015-11-14 01:38:00 +0000
commit36d6abffa95c4ea211d0028c3be07adffef7d80e (patch)
tree6344ac72fa05092ecc2d6bc807eade093e5421ea /cc/output
parent78bf53f95967c29512e0ea503072ec60ead5444c (diff)
downloadchromium_src-36d6abffa95c4ea211d0028c3be07adffef7d80e.zip
chromium_src-36d6abffa95c4ea211d0028c3be07adffef7d80e.tar.gz
chromium_src-36d6abffa95c4ea211d0028c3be07adffef7d80e.tar.bz2
cc: Remove ScopedPtrDeque.
This patch removes ScopedPtrDeque and replaces it with a deque of scoped_ptrs. Note that this also adds a helper container_util file that contains TakeBack and TakeFront helpers. R=danakj CQ_INCLUDE_TRYBOTS=tryserver.blink:linux_blink_rel Review URL: https://codereview.chromium.org/1441613002 Cr-Commit-Position: refs/heads/master@{#359724}
Diffstat (limited to 'cc/output')
-rw-r--r--cc/output/bsp_tree.cc29
-rw-r--r--cc/output/bsp_tree.h6
-rw-r--r--cc/output/bsp_tree_unittest.cc21
-rw-r--r--cc/output/direct_renderer.cc11
-rw-r--r--cc/output/direct_renderer.h3
-rw-r--r--cc/output/gl_renderer.cc5
-rw-r--r--cc/output/gl_renderer.h7
7 files changed, 42 insertions, 40 deletions
diff --git a/cc/output/bsp_tree.cc b/cc/output/bsp_tree.cc
index 4eb87cb..a32c3f4 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);
}
}
diff --git a/cc/output/bsp_tree.h b/cc/output/bsp_tree.h
index 29c8605..0a0b948 100644
--- a/cc/output/bsp_tree.h
+++ b/cc/output/bsp_tree.h
@@ -5,10 +5,10 @@
#ifndef CC_OUTPUT_BSP_TREE_H_
#define CC_OUTPUT_BSP_TREE_H_
+#include <deque>
#include <vector>
#include "base/memory/scoped_ptr.h"
-#include "cc/base/scoped_ptr_deque.h"
#include "cc/base/scoped_ptr_vector.h"
#include "cc/output/bsp_compare_result.h"
#include "cc/quads/draw_polygon.h"
@@ -31,7 +31,7 @@ struct BspNode {
class CC_EXPORT BspTree {
public:
- explicit BspTree(ScopedPtrDeque<DrawPolygon>* list);
+ explicit BspTree(std::deque<scoped_ptr<DrawPolygon>>* list);
scoped_ptr<BspNode>& root() { return root_; }
template <typename ActionHandlerType>
@@ -47,7 +47,7 @@ class CC_EXPORT BspTree {
scoped_ptr<BspNode> root_;
void FromList(ScopedPtrVector<DrawPolygon>* list);
- void BuildTree(BspNode* node, ScopedPtrDeque<DrawPolygon>* data);
+ void BuildTree(BspNode* node, std::deque<scoped_ptr<DrawPolygon>>* data);
template <typename ActionHandlerType>
void WalkInOrderAction(ActionHandlerType* action_handler,
diff --git a/cc/output/bsp_tree_unittest.cc b/cc/output/bsp_tree_unittest.cc
index 100bc91..18e65a5 100644
--- a/cc/output/bsp_tree_unittest.cc
+++ b/cc/output/bsp_tree_unittest.cc
@@ -2,9 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include <deque>
+
#include "base/macros.h"
#include "base/memory/scoped_ptr.h"
-#include "cc/base/scoped_ptr_deque.h"
#include "cc/base/scoped_ptr_vector.h"
#include "cc/output/bsp_tree.h"
#include "cc/output/bsp_walk_action.h"
@@ -30,7 +31,7 @@ namespace {
class BspTreeTest {
public:
- static void RunTest(ScopedPtrDeque<DrawPolygon>* test_polygons,
+ static void RunTest(std::deque<scoped_ptr<DrawPolygon>>* test_polygons,
const std::vector<int>& compare_list) {
BspTree bsp_tree(test_polygons);
@@ -113,7 +114,7 @@ TEST(BspTreeTest, NoSplit) {
scoped_ptr<DrawPolygon> polygon_c(
CREATE_DRAW_POLYGON(vertices_c, gfx::Vector3dF(0.0f, 0.0f, 1.0f), 2));
- ScopedPtrDeque<DrawPolygon> polygon_list;
+ std::deque<scoped_ptr<DrawPolygon>> polygon_list;
polygon_list.push_back(polygon_a.Pass());
polygon_list.push_back(polygon_b.Pass());
polygon_list.push_back(polygon_c.Pass());
@@ -141,7 +142,7 @@ TEST(BspTreeTest, BasicSplit) {
scoped_ptr<DrawPolygon> polygon_b(
CREATE_DRAW_POLYGON(vertices_b, gfx::Vector3dF(-1.0f, 0.0f, 0.0f), 1));
- ScopedPtrDeque<DrawPolygon> polygon_list;
+ std::deque<scoped_ptr<DrawPolygon>> polygon_list;
polygon_list.push_back(polygon_a.Pass());
polygon_list.push_back(polygon_b.Pass());
@@ -170,7 +171,7 @@ TEST(BspTreeTest, QuadOffset) {
scoped_ptr<DrawPolygon> polygon_b(
CREATE_DRAW_POLYGON(vertices_b, gfx::Vector3dF(-1.0f, 0.0f, 0.0f), 1));
- ScopedPtrDeque<DrawPolygon> polygon_list;
+ std::deque<scoped_ptr<DrawPolygon>> polygon_list;
polygon_list.push_back(polygon_a.Pass());
polygon_list.push_back(polygon_b.Pass());
@@ -199,7 +200,7 @@ TEST(BspTreeTest, QuadOffsetSplit) {
scoped_ptr<DrawPolygon> polygon_b(
CREATE_DRAW_POLYGON(vertices_b, gfx::Vector3dF(-1.0f, 0.0f, 0.0f), 1));
- ScopedPtrDeque<DrawPolygon> polygon_list;
+ std::deque<scoped_ptr<DrawPolygon>> polygon_list;
polygon_list.push_back(polygon_b.Pass());
polygon_list.push_back(polygon_a.Pass());
@@ -235,7 +236,7 @@ TEST(BspTreeTest, ThreeWaySplit) {
scoped_ptr<DrawPolygon> polygon_c(
CREATE_DRAW_POLYGON(vertices_c, gfx::Vector3dF(0.0f, 1.0f, 0.0f), 2));
- ScopedPtrDeque<DrawPolygon> polygon_list;
+ std::deque<scoped_ptr<DrawPolygon>> polygon_list;
polygon_list.push_back(polygon_a.Pass());
polygon_list.push_back(polygon_b.Pass());
polygon_list.push_back(polygon_c.Pass());
@@ -276,7 +277,7 @@ TEST(BspTreeTest, Coplanar) {
scoped_ptr<DrawPolygon> polygon_f = polygon_c->CreateCopy();
{
- ScopedPtrDeque<DrawPolygon> polygon_list;
+ std::deque<scoped_ptr<DrawPolygon>> polygon_list;
polygon_list.push_back(polygon_a.Pass());
polygon_list.push_back(polygon_b.Pass());
polygon_list.push_back(polygon_c.Pass());
@@ -288,7 +289,7 @@ TEST(BspTreeTest, Coplanar) {
// Now check a different order and ensure we get that back as well
{
- ScopedPtrDeque<DrawPolygon> polygon_list;
+ std::deque<scoped_ptr<DrawPolygon>> polygon_list;
polygon_list.push_back(polygon_f.Pass());
polygon_list.push_back(polygon_d.Pass());
polygon_list.push_back(polygon_e.Pass());
@@ -333,7 +334,7 @@ TEST(BspTreeTest, CoplanarSplit) {
scoped_ptr<DrawPolygon> polygon_d(
CREATE_DRAW_POLYGON(vertices_d, gfx::Vector3dF(-1.0f, 0.0f, 0.0f), 3));
- ScopedPtrDeque<DrawPolygon> polygon_list;
+ std::deque<scoped_ptr<DrawPolygon>> polygon_list;
polygon_list.push_back(polygon_a.Pass());
polygon_list.push_back(polygon_b.Pass());
polygon_list.push_back(polygon_c.Pass());
diff --git a/cc/output/direct_renderer.cc b/cc/output/direct_renderer.cc
index 43e19c3..16dcd5a 100644
--- a/cc/output/direct_renderer.cc
+++ b/cc/output/direct_renderer.cc
@@ -404,10 +404,11 @@ void DirectRenderer::DoDrawPolygon(const DrawPolygon& poly,
}
}
-void DirectRenderer::FlushPolygons(ScopedPtrDeque<DrawPolygon>* poly_list,
- DrawingFrame* frame,
- const gfx::Rect& render_pass_scissor,
- bool use_render_pass_scissor) {
+void DirectRenderer::FlushPolygons(
+ std::deque<scoped_ptr<DrawPolygon>>* poly_list,
+ DrawingFrame* frame,
+ const gfx::Rect& render_pass_scissor,
+ bool use_render_pass_scissor) {
if (poly_list->empty()) {
return;
}
@@ -473,7 +474,7 @@ void DirectRenderer::DrawRenderPass(DrawingFrame* frame,
MoveFromDrawToWindowSpace(frame, render_pass_scissor_in_draw_space));
const QuadList& quad_list = render_pass->quad_list;
- ScopedPtrDeque<DrawPolygon> poly_list;
+ std::deque<scoped_ptr<DrawPolygon>> poly_list;
int next_polygon_id = 0;
int last_sorting_context_id = 0;
diff --git a/cc/output/direct_renderer.h b/cc/output/direct_renderer.h
index 87e64d6..be72632 100644
--- a/cc/output/direct_renderer.h
+++ b/cc/output/direct_renderer.h
@@ -9,7 +9,6 @@
#include "base/callback.h"
#include "base/containers/scoped_ptr_hash_map.h"
#include "cc/base/cc_export.h"
-#include "cc/base/scoped_ptr_deque.h"
#include "cc/output/overlay_processor.h"
#include "cc/output/renderer.h"
#include "cc/raster/task_graph_runner.h"
@@ -104,7 +103,7 @@ class CC_EXPORT DirectRenderer : public Renderer {
static gfx::Size RenderPassTextureSize(const RenderPass* render_pass);
- void FlushPolygons(ScopedPtrDeque<DrawPolygon>* poly_list,
+ void FlushPolygons(std::deque<scoped_ptr<DrawPolygon>>* poly_list,
DrawingFrame* frame,
const gfx::Rect& render_pass_scissor,
bool use_render_pass_scissor);
diff --git a/cc/output/gl_renderer.cc b/cc/output/gl_renderer.cc
index 22fea9e..22e2cb8 100644
--- a/cc/output/gl_renderer.cc
+++ b/cc/output/gl_renderer.cc
@@ -17,6 +17,7 @@
#include "base/strings/stringprintf.h"
#include "build/build_config.h"
#include "base/trace_event/trace_event.h"
+#include "cc/base/container_util.h"
#include "cc/base/math_util.h"
#include "cc/output/compositor_frame.h"
#include "cc/output/compositor_frame_metadata.h"
@@ -474,12 +475,12 @@ void GLRenderer::BeginDrawingFrame(DrawingFrame* frame) {
if (pending_sync_queries_.front()->IsPending())
break;
- available_sync_queries_.push_back(pending_sync_queries_.take_front());
+ available_sync_queries_.push_back(PopFront(&pending_sync_queries_));
}
current_sync_query_ = available_sync_queries_.empty()
? make_scoped_ptr(new SyncQuery(gl_))
- : available_sync_queries_.take_front();
+ : PopFront(&available_sync_queries_);
read_lock_fence = current_sync_query_->Begin();
} else {
diff --git a/cc/output/gl_renderer.h b/cc/output/gl_renderer.h
index a090324..0aa4e8f 100644
--- a/cc/output/gl_renderer.h
+++ b/cc/output/gl_renderer.h
@@ -5,9 +5,10 @@
#ifndef CC_OUTPUT_GL_RENDERER_H_
#define CC_OUTPUT_GL_RENDERER_H_
+#include <deque>
+
#include "base/cancelable_callback.h"
#include "cc/base/cc_export.h"
-#include "cc/base/scoped_ptr_deque.h"
#include "cc/base/scoped_ptr_vector.h"
#include "cc/output/direct_renderer.h"
#include "cc/output/gl_renderer_draw_cache.h"
@@ -504,8 +505,8 @@ class CC_EXPORT GLRenderer : public DirectRenderer {
scoped_ptr<ResourceProvider::ScopedWriteLockGL> current_framebuffer_lock_;
class SyncQuery;
- ScopedPtrDeque<SyncQuery> pending_sync_queries_;
- ScopedPtrDeque<SyncQuery> available_sync_queries_;
+ std::deque<scoped_ptr<SyncQuery>> pending_sync_queries_;
+ std::deque<scoped_ptr<SyncQuery>> available_sync_queries_;
scoped_ptr<SyncQuery> current_sync_query_;
bool use_sync_query_;
bool use_blend_equation_advanced_;