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

Side by Side Diff: cc/trees/layer_tree_host_unittest_copyrequest.cc

Issue 2751783002: cc: Replace LayerIterator with iterator that walks layer list and effect tree (Closed)
Patch Set: Rebase Created 3 years, 8 months 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 unified diff | Download patch
« no previous file with comments | « cc/trees/layer_tree_host_impl.cc ('k') | cc/trees/layer_tree_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <stddef.h> 5 #include <stddef.h>
6 6
7 #include "base/location.h" 7 #include "base/location.h"
8 #include "base/memory/ptr_util.h" 8 #include "base/memory/ptr_util.h"
9 #include "base/single_thread_task_runner.h" 9 #include "base/single_thread_task_runner.h"
10 #include "base/threading/thread_task_runner_handle.h" 10 #include "base/threading/thread_task_runner_handle.h"
11 #include "cc/layers/layer_iterator.h" 11 #include "cc/layers/effect_tree_layer_list_iterator.h"
12 #include "cc/output/copy_output_request.h" 12 #include "cc/output/copy_output_request.h"
13 #include "cc/output/copy_output_result.h" 13 #include "cc/output/copy_output_result.h"
14 #include "cc/output/direct_renderer.h" 14 #include "cc/output/direct_renderer.h"
15 #include "cc/surfaces/display.h" 15 #include "cc/surfaces/display.h"
16 #include "cc/test/fake_content_layer_client.h" 16 #include "cc/test/fake_content_layer_client.h"
17 #include "cc/test/fake_output_surface.h" 17 #include "cc/test/fake_output_surface.h"
18 #include "cc/test/fake_picture_layer.h" 18 #include "cc/test/fake_picture_layer.h"
19 #include "cc/test/layer_tree_test.h" 19 #include "cc/test/layer_tree_test.h"
20 #include "cc/test/test_compositor_frame_sink.h" 20 #include "cc/test/test_compositor_frame_sink.h"
21 #include "cc/trees/layer_tree_impl.h" 21 #include "cc/trees/layer_tree_impl.h"
(...skipping 1198 matching lines...) Expand 10 before | Expand all | Expand 10 after
1220 } 1220 }
1221 1221
1222 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, 1222 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl,
1223 LayerTreeHostImpl::FrameData* frame_data, 1223 LayerTreeHostImpl::FrameData* frame_data,
1224 DrawResult draw_result) override { 1224 DrawResult draw_result) override {
1225 LayerImpl* root = host_impl->active_tree()->root_layer_for_testing(); 1225 LayerImpl* root = host_impl->active_tree()->root_layer_for_testing();
1226 LayerImpl* child = host_impl->active_tree()->LayerById(child_->id()); 1226 LayerImpl* child = host_impl->active_tree()->LayerById(child_->id());
1227 1227
1228 bool saw_root = false; 1228 bool saw_root = false;
1229 bool saw_child = false; 1229 bool saw_child = false;
1230 for (LayerIterator it = 1230 for (EffectTreeLayerListIterator it(host_impl->active_tree());
1231 LayerIterator::Begin(frame_data->render_surface_layer_list); 1231 it.state() != EffectTreeLayerListIterator::State::END; ++it) {
1232 it != LayerIterator::End(frame_data->render_surface_layer_list); 1232 if (it.state() == EffectTreeLayerListIterator::State::LAYER) {
1233 ++it) { 1233 if (it.current_layer() == root)
1234 if (it.represents_itself()) {
1235 if (*it == root)
1236 saw_root = true; 1234 saw_root = true;
1237 else if (*it == child) 1235 else if (it.current_layer() == child)
1238 saw_child = true; 1236 saw_child = true;
1239 else 1237 else
1240 NOTREACHED(); 1238 NOTREACHED();
1241 } 1239 }
1242 } 1240 }
1243 1241
1244 ++num_draws_; 1242 ++num_draws_;
1245 // The first draw has no copy request. The 2nd draw has a copy request, the 1243 // The first draw has no copy request. The 2nd draw has a copy request, the
1246 // 3rd should not again. 1244 // 3rd should not again.
1247 switch (num_draws_) { 1245 switch (num_draws_) {
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
1307 int num_draws_; 1305 int num_draws_;
1308 bool copy_happened_; 1306 bool copy_happened_;
1309 bool draw_happened_; 1307 bool draw_happened_;
1310 }; 1308 };
1311 1309
1312 SINGLE_AND_MULTI_THREAD_TEST_F( 1310 SINGLE_AND_MULTI_THREAD_TEST_F(
1313 LayerTreeHostCopyRequestTestMultipleDrawsHiddenCopyRequest); 1311 LayerTreeHostCopyRequestTestMultipleDrawsHiddenCopyRequest);
1314 1312
1315 } // namespace 1313 } // namespace
1316 } // namespace cc 1314 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_impl.cc ('k') | cc/trees/layer_tree_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698