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

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

Issue 1801853002: Transfer LayerImpl ownership to LayerTreeImpl (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: more asan. Created 4 years, 9 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
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 "cc/layers/layer_iterator.h" 7 #include "cc/layers/layer_iterator.h"
8 #include "cc/output/copy_output_request.h" 8 #include "cc/output/copy_output_request.h"
9 #include "cc/output/copy_output_result.h" 9 #include "cc/output/copy_output_result.h"
10 #include "cc/test/fake_content_layer_client.h" 10 #include "cc/test/fake_content_layer_client.h"
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after
471 void CopyOutputCallback(scoped_ptr<CopyOutputResult> result) { 471 void CopyOutputCallback(scoped_ptr<CopyOutputResult> result) {
472 EXPECT_TRUE(layer_tree_host()->task_runner_provider()->IsMainThread()); 472 EXPECT_TRUE(layer_tree_host()->task_runner_provider()->IsMainThread());
473 EXPECT_EQ(copy_layer_->bounds().ToString(), result->size().ToString()); 473 EXPECT_EQ(copy_layer_->bounds().ToString(), result->size().ToString());
474 EndTest(); 474 EndTest();
475 } 475 }
476 476
477 void DrawLayersOnThread(LayerTreeHostImpl* host_impl) override { 477 void DrawLayersOnThread(LayerTreeHostImpl* host_impl) override {
478 Renderer* renderer = host_impl->renderer(); 478 Renderer* renderer = host_impl->renderer();
479 479
480 LayerImpl* root = host_impl->active_tree()->root_layer(); 480 LayerImpl* root = host_impl->active_tree()->root_layer();
481 LayerImpl* grand_parent = root->children()[0].get(); 481 LayerImpl* grand_parent = root->children()[0];
482 LayerImpl* parent = grand_parent->children()[0].get(); 482 LayerImpl* parent = grand_parent->children()[0];
483 LayerImpl* copy_layer = parent->children()[0].get(); 483 LayerImpl* copy_layer = parent->children()[0];
484 484
485 // |parent| owns a surface, but it was hidden and not part of the copy 485 // |parent| owns a surface, but it was hidden and not part of the copy
486 // request so it should not allocate any resource. 486 // request so it should not allocate any resource.
487 EXPECT_FALSE(renderer->HasAllocatedResourcesForTesting( 487 EXPECT_FALSE(renderer->HasAllocatedResourcesForTesting(
488 parent->render_surface()->GetRenderPassId())); 488 parent->render_surface()->GetRenderPassId()));
489 489
490 // |copy_layer| should have been rendered to a texture since it was needed 490 // |copy_layer| should have been rendered to a texture since it was needed
491 // for a copy request. 491 // for a copy request.
492 if (did_draw_) { 492 if (did_draw_) {
493 // TODO(crbug.com/564832): Ignore the extra frame that occurs due to copy 493 // TODO(crbug.com/564832): Ignore the extra frame that occurs due to copy
(...skipping 690 matching lines...) Expand 10 before | Expand all | Expand 10 after
1184 &LayerTreeHostCopyRequestTestMultipleDrawsHiddenCopyRequest:: 1184 &LayerTreeHostCopyRequestTestMultipleDrawsHiddenCopyRequest::
1185 CopyOutputCallback, 1185 CopyOutputCallback,
1186 base::Unretained(this)))); 1186 base::Unretained(this))));
1187 } 1187 }
1188 } 1188 }
1189 1189
1190 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, 1190 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl,
1191 LayerTreeHostImpl::FrameData* frame_data, 1191 LayerTreeHostImpl::FrameData* frame_data,
1192 DrawResult draw_result) override { 1192 DrawResult draw_result) override {
1193 LayerImpl* root = host_impl->active_tree()->root_layer(); 1193 LayerImpl* root = host_impl->active_tree()->root_layer();
1194 LayerImpl* child = root->children()[0].get(); 1194 LayerImpl* child = root->children()[0];
1195 1195
1196 bool saw_root = false; 1196 bool saw_root = false;
1197 bool saw_child = false; 1197 bool saw_child = false;
1198 for (LayerIterator it = 1198 for (LayerIterator it =
1199 LayerIterator::Begin(frame_data->render_surface_layer_list); 1199 LayerIterator::Begin(frame_data->render_surface_layer_list);
1200 it != LayerIterator::End(frame_data->render_surface_layer_list); 1200 it != LayerIterator::End(frame_data->render_surface_layer_list);
1201 ++it) { 1201 ++it) {
1202 if (it.represents_itself()) { 1202 if (it.represents_itself()) {
1203 if (*it == root) 1203 if (*it == root)
1204 saw_root = true; 1204 saw_root = true;
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
1263 int num_draws_; 1263 int num_draws_;
1264 bool copy_happened_; 1264 bool copy_happened_;
1265 bool draw_happened_; 1265 bool draw_happened_;
1266 }; 1266 };
1267 1267
1268 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F( 1268 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F(
1269 LayerTreeHostCopyRequestTestMultipleDrawsHiddenCopyRequest); 1269 LayerTreeHostCopyRequestTestMultipleDrawsHiddenCopyRequest);
1270 1270
1271 } // namespace 1271 } // namespace
1272 } // namespace cc 1272 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_unittest_context.cc ('k') | cc/trees/layer_tree_host_unittest_damage.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698