summaryrefslogtreecommitdiffstats
path: root/cc/surfaces
diff options
context:
space:
mode:
authorvmpstr <vmpstr@chromium.org>2015-11-18 02:41:28 -0800
committerCommit bot <commit-bot@chromium.org>2015-11-18 10:42:27 +0000
commita370ef52788ea0f6c410b05ec40a74ee9bf3a647 (patch)
tree3a17b8c71c12f28b9aab3c6d82b30afda9b7a060 /cc/surfaces
parent93a4c577dd608bc72ac31ea396201590a23b46c5 (diff)
downloadchromium_src-a370ef52788ea0f6c410b05ec40a74ee9bf3a647.zip
chromium_src-a370ef52788ea0f6c410b05ec40a74ee9bf3a647.tar.gz
chromium_src-a370ef52788ea0f6c410b05ec40a74ee9bf3a647.tar.bz2
cc: Remove ScopedPtrVector and cc::remove_if.
This patch removes ScopedPtrVector and cc::remove_if. It depends on https://codereview.chromium.org/1441613002 for TakeBack. R=danakj CQ_INCLUDE_TRYBOTS=tryserver.blink:linux_blink_rel Review URL: https://codereview.chromium.org/1437413002 Cr-Commit-Position: refs/heads/master@{#360318}
Diffstat (limited to 'cc/surfaces')
-rw-r--r--cc/surfaces/display.cc2
-rw-r--r--cc/surfaces/surface.cc6
-rw-r--r--cc/surfaces/surface.h1
-rw-r--r--cc/surfaces/surface_aggregator.cc4
-rw-r--r--cc/surfaces/surface_aggregator_unittest.cc61
-rw-r--r--cc/surfaces/surface_hittest.cc6
-rw-r--r--cc/surfaces/surface_hittest_unittest.cc4
7 files changed, 43 insertions, 41 deletions
diff --git a/cc/surfaces/display.cc b/cc/surfaces/display.cc
index 31335ae..ef9802c3 100644
--- a/cc/surfaces/display.cc
+++ b/cc/surfaces/display.cc
@@ -212,7 +212,7 @@ bool Display::DrawAndSwap() {
stored_latency_info_.end());
stored_latency_info_.clear();
bool have_copy_requests = false;
- for (const auto* pass : frame_data->render_pass_list) {
+ for (const auto& pass : frame_data->render_pass_list) {
have_copy_requests |= !pass->copy_requests.empty();
}
diff --git a/cc/surfaces/surface.cc b/cc/surfaces/surface.cc
index 32f41f1..351b679 100644
--- a/cc/surfaces/surface.cc
+++ b/cc/surfaces/surface.cc
@@ -6,6 +6,7 @@
#include <algorithm>
+#include "cc/base/container_util.h"
#include "cc/output/compositor_frame.h"
#include "cc/output/copy_output_request.h"
#include "cc/surfaces/surface_factory.h"
@@ -116,8 +117,9 @@ void Surface::TakeCopyOutputRequests(
current_frame_->delegated_frame_data->render_pass_list) {
while (!render_pass->copy_requests.empty()) {
scoped_ptr<CopyOutputRequest> request =
- render_pass->copy_requests.take_back();
- render_pass->copy_requests.pop_back();
+ PopBack(&render_pass->copy_requests);
+ // TODO(vmpstr): |copy_requests| should store scoped_ptrs.
+ // crbug.com/557388.
copy_requests->insert(
std::make_pair(render_pass->id, request.release()));
}
diff --git a/cc/surfaces/surface.h b/cc/surfaces/surface.h
index 18ca744..cbfa42e 100644
--- a/cc/surfaces/surface.h
+++ b/cc/surfaces/surface.h
@@ -14,7 +14,6 @@
#include "base/macros.h"
#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
-#include "cc/base/scoped_ptr_vector.h"
#include "cc/output/copy_output_request.h"
#include "cc/quads/render_pass_id.h"
#include "cc/surfaces/surface_factory.h"
diff --git a/cc/surfaces/surface_aggregator.cc b/cc/surfaces/surface_aggregator.cc
index a0108b7..43c57bc 100644
--- a/cc/surfaces/surface_aggregator.cc
+++ b/cc/surfaces/surface_aggregator.cc
@@ -29,7 +29,7 @@ namespace {
void MoveMatchingRequests(
RenderPassId id,
std::multimap<RenderPassId, CopyOutputRequest*>* copy_requests,
- ScopedPtrVector<CopyOutputRequest>* output_requests) {
+ std::vector<scoped_ptr<CopyOutputRequest>>* output_requests) {
auto request_range = copy_requests->equal_range(id);
for (auto it = request_range.first; it != request_range.second; ++it) {
DCHECK(it->second);
@@ -576,7 +576,7 @@ gfx::Rect SurfaceAggregator::PrewalkTree(SurfaceId surface_id) {
gfx::Rect damage_rect;
if (!frame_data->render_pass_list.empty()) {
- RenderPass* last_pass = frame_data->render_pass_list.back();
+ RenderPass* last_pass = frame_data->render_pass_list.back().get();
damage_rect =
DamageRectForSurface(surface, *last_pass, last_pass->output_rect);
}
diff --git a/cc/surfaces/surface_aggregator_unittest.cc b/cc/surfaces/surface_aggregator_unittest.cc
index 7696b74..848912e 100644
--- a/cc/surfaces/surface_aggregator_unittest.cc
+++ b/cc/surfaces/surface_aggregator_unittest.cc
@@ -139,7 +139,7 @@ class SurfaceAggregatorValidSurfaceTest : public SurfaceAggregatorTest {
// Ensure no duplicate pass ids output.
std::set<RenderPassId> used_passes;
- for (auto* pass : frame_data->render_pass_list) {
+ for (const auto& pass : frame_data->render_pass_list) {
EXPECT_TRUE(used_passes.insert(pass->id).second);
}
@@ -365,7 +365,7 @@ TEST_F(SurfaceAggregatorValidSurfaceTest, CopyRequest) {
ASSERT_EQ(2u, frame_data->render_pass_list.size());
ASSERT_EQ(1u, frame_data->render_pass_list[0]->copy_requests.size());
DCHECK_EQ(copy_request_ptr,
- frame_data->render_pass_list[0]->copy_requests[0]);
+ frame_data->render_pass_list[0]->copy_requests[0].get());
SurfaceId surface_ids[] = {root_surface_id_, embedded_surface_id};
EXPECT_EQ(arraysize(surface_ids),
@@ -451,10 +451,10 @@ TEST_F(SurfaceAggregatorValidSurfaceTest, RootCopyRequest) {
ASSERT_EQ(2u, frame_data->render_pass_list.size());
ASSERT_EQ(1u, frame_data->render_pass_list[0]->copy_requests.size());
DCHECK_EQ(copy_request_ptr,
- frame_data->render_pass_list[0]->copy_requests[0]);
+ frame_data->render_pass_list[0]->copy_requests[0].get());
ASSERT_EQ(1u, frame_data->render_pass_list[1]->copy_requests.size());
DCHECK_EQ(copy_request2_ptr,
- frame_data->render_pass_list[1]->copy_requests[0]);
+ frame_data->render_pass_list[1]->copy_requests[0].get());
SurfaceId surface_ids[] = {root_surface_id_, embedded_surface_id};
EXPECT_EQ(arraysize(surface_ids),
@@ -542,7 +542,7 @@ TEST_F(SurfaceAggregatorValidSurfaceTest, MultiPassSurfaceReference) {
SCOPED_TRACE("First pass");
// The first pass will just be the first pass from the root surfaces quad
// with no render pass quads to remap.
- TestPassMatchesExpectations(root_passes[0], aggregated_pass_list[0]);
+ TestPassMatchesExpectations(root_passes[0], aggregated_pass_list[0].get());
}
{
@@ -552,7 +552,8 @@ TEST_F(SurfaceAggregatorValidSurfaceTest, MultiPassSurfaceReference) {
// quad embedded into the root surface's second pass.
// First, there's the first embedded pass which doesn't reference anything
// else.
- TestPassMatchesExpectations(embedded_passes[0], aggregated_pass_list[1]);
+ TestPassMatchesExpectations(embedded_passes[0],
+ aggregated_pass_list[1].get());
}
{
@@ -1021,13 +1022,13 @@ TEST_F(SurfaceAggregatorValidSurfaceTest, AggregateMultiplePassWithTransform) {
AddPasses(&child_pass_list, gfx::Rect(SurfaceSize()), child_passes,
arraysize(child_passes));
- RenderPass* child_nonroot_pass = child_pass_list.at(0u);
+ RenderPass* child_nonroot_pass = child_pass_list[0].get();
child_nonroot_pass->transform_to_root_target.Translate(8, 0);
SharedQuadState* child_nonroot_pass_sqs =
child_nonroot_pass->shared_quad_state_list.front();
child_nonroot_pass_sqs->quad_to_target_transform.Translate(5, 0);
- RenderPass* child_root_pass = child_pass_list.at(1u);
+ RenderPass* child_root_pass = child_pass_list[1].get();
SharedQuadState* child_root_pass_sqs =
child_root_pass->shared_quad_state_list.front();
child_root_pass_sqs->quad_to_target_transform.Translate(8, 0);
@@ -1060,7 +1061,7 @@ TEST_F(SurfaceAggregatorValidSurfaceTest, AggregateMultiplePassWithTransform) {
AddPasses(&middle_pass_list, gfx::Rect(SurfaceSize()), middle_passes,
arraysize(middle_passes));
- RenderPass* middle_root_pass = middle_pass_list.at(0u);
+ RenderPass* middle_root_pass = middle_pass_list[0].get();
middle_root_pass->quad_list.ElementAt(0)->visible_rect =
gfx::Rect(0, 1, 100, 7);
SharedQuadState* middle_root_pass_sqs =
@@ -1092,13 +1093,13 @@ TEST_F(SurfaceAggregatorValidSurfaceTest, AggregateMultiplePassWithTransform) {
root_passes,
arraysize(root_passes));
- root_pass_list.at(0)
+ root_pass_list[0]
->shared_quad_state_list.front()
->quad_to_target_transform.Translate(0, 7);
- root_pass_list.at(0)
+ root_pass_list[0]
->shared_quad_state_list.ElementAt(1)
->quad_to_target_transform.Translate(0, 10);
- root_pass_list.at(0)->quad_list.ElementAt(1)->visible_rect =
+ root_pass_list[0]->quad_list.ElementAt(1)->visible_rect =
gfx::Rect(0, 0, 8, 100);
root_pass_list[0]->transform_to_root_target.Translate(10, 5);
@@ -1213,7 +1214,7 @@ TEST_F(SurfaceAggregatorValidSurfaceTest, AggregateDamageRect) {
child_passes,
arraysize(child_passes));
- RenderPass* child_root_pass = child_pass_list.at(0u);
+ RenderPass* child_root_pass = child_pass_list[0].get();
SharedQuadState* child_root_pass_sqs =
child_root_pass->shared_quad_state_list.front();
child_root_pass_sqs->quad_to_target_transform.Translate(8, 0);
@@ -1274,11 +1275,11 @@ TEST_F(SurfaceAggregatorValidSurfaceTest, AggregateDamageRect) {
root_passes,
arraysize(root_passes));
- root_pass_list.at(0)
+ root_pass_list[0]
->shared_quad_state_list.front()
->quad_to_target_transform.Translate(0, 10);
- root_pass_list.at(0)->damage_rect = gfx::Rect(5, 5, 10, 10);
- root_pass_list.at(1)->damage_rect = gfx::Rect(5, 5, 100, 100);
+ root_pass_list[0]->damage_rect = gfx::Rect(5, 5, 10, 10);
+ root_pass_list[1]->damage_rect = gfx::Rect(5, 5, 100, 100);
scoped_ptr<DelegatedFrameData> root_frame_data(new DelegatedFrameData);
root_pass_list.swap(root_frame_data->render_pass_list);
@@ -1319,7 +1320,7 @@ TEST_F(SurfaceAggregatorValidSurfaceTest, AggregateDamageRect) {
child_passes,
arraysize(child_passes));
- RenderPass* child_root_pass = child_pass_list.at(0u);
+ RenderPass* child_root_pass = child_pass_list[0].get();
SharedQuadState* child_root_pass_sqs =
child_root_pass->shared_quad_state_list.front();
child_root_pass_sqs->quad_to_target_transform.Translate(8, 0);
@@ -1368,10 +1369,10 @@ TEST_F(SurfaceAggregatorValidSurfaceTest, AggregateDamageRect) {
root_passes,
arraysize(root_passes));
- root_pass_list.at(0)
+ root_pass_list[0]
->shared_quad_state_list.front()
->quad_to_target_transform.Translate(0, 10);
- root_pass_list.at(0)->damage_rect = gfx::Rect(0, 0, 1, 1);
+ root_pass_list[0]->damage_rect = gfx::Rect(0, 0, 1, 1);
scoped_ptr<DelegatedFrameData> root_frame_data(new DelegatedFrameData);
root_pass_list.swap(root_frame_data->render_pass_list);
@@ -1390,10 +1391,10 @@ TEST_F(SurfaceAggregatorValidSurfaceTest, AggregateDamageRect) {
root_passes,
arraysize(root_passes));
- root_pass_list.at(0)
+ root_pass_list[0]
->shared_quad_state_list.front()
->quad_to_target_transform.Translate(0, 10);
- root_pass_list.at(0)->damage_rect = gfx::Rect(1, 1, 1, 1);
+ root_pass_list[0]->damage_rect = gfx::Rect(1, 1, 1, 1);
scoped_ptr<DelegatedFrameData> root_frame_data(new DelegatedFrameData);
root_pass_list.swap(root_frame_data->render_pass_list);
@@ -1516,14 +1517,14 @@ TEST_F(SurfaceAggregatorPartialSwapTest, IgnoreOutside) {
AddPasses(&child_pass_list, gfx::Rect(SurfaceSize()), child_passes,
arraysize(child_passes));
- child_pass_list.at(0u)->quad_list.ElementAt(0)->visible_rect =
+ child_pass_list[0]->quad_list.ElementAt(0)->visible_rect =
gfx::Rect(1, 1, 2, 2);
SharedQuadState* child_sqs =
- child_pass_list.at(0u)->shared_quad_state_list.ElementAt(0u);
+ child_pass_list[0]->shared_quad_state_list.ElementAt(0u);
child_sqs->quad_to_target_transform.Translate(1, 1);
child_sqs->quad_to_target_transform.Scale(2, 2);
- child_pass_list.at(1u)->quad_list.ElementAt(0)->visible_rect =
+ child_pass_list[1]->quad_list.ElementAt(0)->visible_rect =
gfx::Rect(0, 0, 2, 2);
SubmitPassListAsFrame(child_surface_id, &child_pass_list);
@@ -1538,7 +1539,7 @@ TEST_F(SurfaceAggregatorPartialSwapTest, IgnoreOutside) {
AddPasses(&root_pass_list, gfx::Rect(SurfaceSize()), root_passes,
arraysize(root_passes));
- RenderPass* root_pass = root_pass_list.at(0u);
+ RenderPass* root_pass = root_pass_list[0].get();
root_pass->shared_quad_state_list.front()
->quad_to_target_transform.Translate(10, 10);
root_pass->damage_rect = gfx::Rect(0, 0, 1, 1);
@@ -1579,7 +1580,7 @@ TEST_F(SurfaceAggregatorPartialSwapTest, IgnoreOutside) {
AddPasses(&root_pass_list, gfx::Rect(SurfaceSize()), root_passes,
arraysize(root_passes));
- RenderPass* root_pass = root_pass_list.at(0u);
+ RenderPass* root_pass = root_pass_list[0].get();
root_pass->shared_quad_state_list.front()
->quad_to_target_transform.Translate(10, 10);
root_pass->damage_rect = gfx::Rect(10, 10, 2, 2);
@@ -1629,17 +1630,17 @@ TEST_F(SurfaceAggregatorPartialSwapTest, IgnoreOutside) {
AddPasses(&child_pass_list, gfx::Rect(SurfaceSize()), child_passes,
arraysize(child_passes));
- child_pass_list.at(0u)->quad_list.ElementAt(0)->visible_rect =
+ child_pass_list[0]->quad_list.ElementAt(0)->visible_rect =
gfx::Rect(1, 1, 2, 2);
SharedQuadState* child_sqs =
- child_pass_list.at(0u)->shared_quad_state_list.ElementAt(0u);
+ child_pass_list[0]->shared_quad_state_list.ElementAt(0u);
child_sqs->quad_to_target_transform.Translate(1, 1);
child_sqs->quad_to_target_transform.Scale(2, 2);
- child_pass_list.at(1u)->quad_list.ElementAt(0)->visible_rect =
+ child_pass_list[1]->quad_list.ElementAt(0)->visible_rect =
gfx::Rect(0, 0, 2, 2);
- RenderPass* child_root_pass = child_pass_list.at(1u);
+ RenderPass* child_root_pass = child_pass_list[1].get();
child_root_pass->copy_requests.push_back(
CopyOutputRequest::CreateEmptyRequest());
diff --git a/cc/surfaces/surface_hittest.cc b/cc/surfaces/surface_hittest.cc
index 752a708..b7414de 100644
--- a/cc/surfaces/surface_hittest.cc
+++ b/cc/surfaces/surface_hittest.cc
@@ -231,11 +231,11 @@ const RenderPass* SurfaceHittest::GetRenderPassForSurfaceById(
return nullptr;
if (!render_pass_id.IsValid())
- return frame_data->render_pass_list.back();
+ return frame_data->render_pass_list.back().get();
- for (const auto* render_pass : frame_data->render_pass_list) {
+ for (const auto& render_pass : frame_data->render_pass_list) {
if (render_pass->id == render_pass_id)
- return render_pass;
+ return render_pass.get();
}
return nullptr;
diff --git a/cc/surfaces/surface_hittest_unittest.cc b/cc/surfaces/surface_hittest_unittest.cc
index 9bb7128..fde62f3 100644
--- a/cc/surfaces/surface_hittest_unittest.cc
+++ b/cc/surfaces/surface_hittest_unittest.cc
@@ -389,7 +389,7 @@ TEST(SurfaceHittestTest, Hittest_RenderPassDrawQuad) {
RenderPass* root_pass = nullptr;
scoped_ptr<CompositorFrame> root_frame =
CreateCompositorFrameWithRenderPassList(&render_pass_list);
- root_pass = root_frame->delegated_frame_data->render_pass_list.back();
+ root_pass = root_frame->delegated_frame_data->render_pass_list.back().get();
// Create a RenderPassDrawQuad.
gfx::Rect render_pass_quad_rect(100, 100);
@@ -401,7 +401,7 @@ TEST(SurfaceHittestTest, Hittest_RenderPassDrawQuad) {
// Add a solid quad in the child render pass.
RenderPass* child_render_pass =
- root_frame->delegated_frame_data->render_pass_list.front();
+ root_frame->delegated_frame_data->render_pass_list.front().get();
gfx::Rect child_solid_quad_rect(100, 100);
CreateSolidColorDrawQuad(child_render_pass,
gfx::Transform(),