summaryrefslogtreecommitdiffstats
path: root/cc/surfaces
diff options
context:
space:
mode:
authorweiliangc <weiliangc@chromium.org>2014-10-29 13:30:12 -0700
committerCommit bot <commit-bot@chromium.org>2014-10-29 20:30:47 +0000
commit48805fce83d8bd3d28a2dc84477b50d483fc46b0 (patch)
treeaaeb4915f80f61bdabf96e239f870e2ff1ae9db6 /cc/surfaces
parente60561ddb24168c6682466b91567b6f9d54cae94 (diff)
downloadchromium_src-48805fce83d8bd3d28a2dc84477b50d483fc46b0.zip
chromium_src-48805fce83d8bd3d28a2dc84477b50d483fc46b0.tar.gz
chromium_src-48805fce83d8bd3d28a2dc84477b50d483fc46b0.tar.bz2
Make ListContainer Consistently Act as Container of Pointers
Usage of ListContainer is replacing scoped_ptr_vector. SharedQuadState is stored in DrawQuad as pointer form. ListContainer should act as container of pointers. This CL changes the return value from dereference iterator from reference to pointers. BUG=344962 Review URL: https://codereview.chromium.org/629343002 Cr-Commit-Position: refs/heads/master@{#301916}
Diffstat (limited to 'cc/surfaces')
-rw-r--r--cc/surfaces/surface.cc8
-rw-r--r--cc/surfaces/surface_aggregator.cc29
-rw-r--r--cc/surfaces/surface_aggregator_test_helpers.cc2
3 files changed, 21 insertions, 18 deletions
diff --git a/cc/surfaces/surface.cc b/cc/surfaces/surface.cc
index 07c5ae6..32e61c5 100644
--- a/cc/surfaces/surface.cc
+++ b/cc/surfaces/surface.cc
@@ -4,6 +4,8 @@
#include "cc/surfaces/surface.h"
+#include <algorithm>
+
#include "cc/output/compositor_frame.h"
#include "cc/output/copy_output_request.h"
#include "cc/surfaces/surface_factory.h"
@@ -71,7 +73,7 @@ void Surface::TakeCopyOutputRequests(
std::multimap<RenderPassId, CopyOutputRequest*>* copy_requests) {
DCHECK(copy_requests->empty());
if (current_frame_) {
- for (auto* render_pass :
+ for (const auto& render_pass :
current_frame_->delegated_frame_data->render_pass_list) {
while (!render_pass->copy_requests.empty()) {
scoped_ptr<CopyOutputRequest> request =
@@ -111,9 +113,9 @@ void Surface::RunDrawCallbacks() {
void Surface::ClearCopyRequests() {
if (current_frame_) {
- for (auto* render_pass :
+ for (const auto& render_pass :
current_frame_->delegated_frame_data->render_pass_list) {
- for (auto* copy_request : render_pass->copy_requests)
+ for (const auto& copy_request : render_pass->copy_requests)
copy_request->SendEmptyResult();
}
}
diff --git a/cc/surfaces/surface_aggregator.cc b/cc/surfaces/surface_aggregator.cc
index ae0fce0..44afaff 100644
--- a/cc/surfaces/surface_aggregator.cc
+++ b/cc/surfaces/surface_aggregator.cc
@@ -4,6 +4,8 @@
#include "cc/surfaces/surface_aggregator.h"
+#include <map>
+
#include "base/bind.h"
#include "base/containers/hash_tables.h"
#include "base/debug/trace_event.h"
@@ -139,9 +141,9 @@ bool SurfaceAggregator::TakeResources(Surface* surface,
&invalid_frame,
provider_->GetChildToParentMap(child_id),
&referenced_resources);
- for (auto* render_pass : *render_pass_list) {
- for (auto& quad : render_pass->quad_list)
- quad.IterateResources(remap);
+ for (const auto& render_pass : *render_pass_list) {
+ for (const auto& quad : render_pass->quad_list)
+ quad->IterateResources(remap);
}
if (!invalid_frame)
@@ -305,25 +307,24 @@ void SurfaceAggregator::CopyQuadsToPass(
SharedQuadStateList::ConstIterator sqs_iter =
source_shared_quad_state_list.begin();
for (const auto& quad : source_quad_list) {
- while (quad.shared_quad_state != &*sqs_iter) {
+ while (quad->shared_quad_state != *sqs_iter) {
++sqs_iter;
DCHECK(sqs_iter != source_shared_quad_state_list.end());
}
- DCHECK_EQ(quad.shared_quad_state, &*sqs_iter);
+ DCHECK_EQ(quad->shared_quad_state, *sqs_iter);
- if (quad.material == DrawQuad::SURFACE_CONTENT) {
- const SurfaceDrawQuad* surface_quad =
- SurfaceDrawQuad::MaterialCast(&quad);
+ if (quad->material == DrawQuad::SURFACE_CONTENT) {
+ const SurfaceDrawQuad* surface_quad = SurfaceDrawQuad::MaterialCast(quad);
HandleSurfaceQuad(surface_quad, dest_pass);
} else {
- if (quad.shared_quad_state != last_copied_source_shared_quad_state) {
+ if (quad->shared_quad_state != last_copied_source_shared_quad_state) {
CopySharedQuadState(
- quad.shared_quad_state, content_to_target_transform, dest_pass);
- last_copied_source_shared_quad_state = quad.shared_quad_state;
+ quad->shared_quad_state, content_to_target_transform, dest_pass);
+ last_copied_source_shared_quad_state = quad->shared_quad_state;
}
- if (quad.material == DrawQuad::RENDER_PASS) {
+ if (quad->material == DrawQuad::RENDER_PASS) {
const RenderPassDrawQuad* pass_quad =
- RenderPassDrawQuad::MaterialCast(&quad);
+ RenderPassDrawQuad::MaterialCast(quad);
RenderPassId original_pass_id = pass_quad->render_pass_id;
RenderPassId remapped_pass_id =
RemapPassId(original_pass_id, surface_id);
@@ -334,7 +335,7 @@ void SurfaceAggregator::CopyQuadsToPass(
remapped_pass_id);
} else {
dest_pass->CopyFromAndAppendDrawQuad(
- &quad, dest_pass->shared_quad_state_list.back());
+ quad, dest_pass->shared_quad_state_list.back());
}
}
}
diff --git a/cc/surfaces/surface_aggregator_test_helpers.cc b/cc/surfaces/surface_aggregator_test_helpers.cc
index a40b2c2..6b527c0 100644
--- a/cc/surfaces/surface_aggregator_test_helpers.cc
+++ b/cc/surfaces/surface_aggregator_test_helpers.cc
@@ -138,7 +138,7 @@ void TestPassMatchesExpectations(Pass expected_pass, const RenderPass* pass) {
for (auto iter = pass->quad_list.cbegin(); iter != pass->quad_list.cend();
++iter) {
SCOPED_TRACE(base::StringPrintf("Quad number %" PRIuS, iter.index()));
- TestQuadMatchesExpectations(expected_pass.quads[iter.index()], &*iter);
+ TestQuadMatchesExpectations(expected_pass.quads[iter.index()], *iter);
}
}