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

Side by Side Diff: content/common/cc_messages_unittest.cc

Issue 448303002: Use custom ListContainer to allocate DrawQuads (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@perftest
Patch Set: change header files to try fix compile error Created 6 years, 2 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "content/common/cc_messages.h" 5 #include "content/common/cc_messages.h"
6 6
7 #include <string.h> 7 #include <string.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 10
(...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after
470 yuvvideo_in->shared_quad_state); 470 yuvvideo_in->shared_quad_state);
471 471
472 // Make sure the in and cmp RenderPasses match. 472 // Make sure the in and cmp RenderPasses match.
473 Compare(pass_cmp.get(), pass_in.get()); 473 Compare(pass_cmp.get(), pass_in.get());
474 ASSERT_EQ(3u, pass_in->shared_quad_state_list.size()); 474 ASSERT_EQ(3u, pass_in->shared_quad_state_list.size());
475 ASSERT_EQ(10u, pass_in->quad_list.size()); 475 ASSERT_EQ(10u, pass_in->quad_list.size());
476 for (size_t i = 0; i < 3; ++i) { 476 for (size_t i = 0; i < 3; ++i) {
477 Compare(pass_cmp->shared_quad_state_list[i], 477 Compare(pass_cmp->shared_quad_state_list[i],
478 pass_in->shared_quad_state_list[i]); 478 pass_in->shared_quad_state_list[i]);
479 } 479 }
480 for (size_t i = 0; i < pass_in->quad_list.size(); ++i) 480 for (cc::QuadList::Iterator in_iter = pass_in->quad_list.begin(),
481 Compare(pass_cmp->quad_list[i], pass_in->quad_list[i]); 481 cmp_iter = pass_cmp->quad_list.begin();
482 in_iter != pass_in->quad_list.end();
483 ++in_iter, ++cmp_iter)
484 Compare(&*cmp_iter, &*in_iter);
485
482 for (size_t i = 1; i < pass_in->quad_list.size(); ++i) { 486 for (size_t i = 1; i < pass_in->quad_list.size(); ++i) {
483 bool same_shared_quad_state_cmp = 487 bool same_shared_quad_state_cmp =
484 pass_cmp->quad_list[i]->shared_quad_state == 488 pass_cmp->quad_list.ElementAt(i)->shared_quad_state ==
485 pass_cmp->quad_list[i - 1]->shared_quad_state; 489 pass_cmp->quad_list.ElementAt(i - 1)->shared_quad_state;
486 bool same_shared_quad_state_in = 490 bool same_shared_quad_state_in =
487 pass_in->quad_list[i]->shared_quad_state == 491 pass_in->quad_list.ElementAt(i)->shared_quad_state ==
488 pass_in->quad_list[i - 1]->shared_quad_state; 492 pass_in->quad_list.ElementAt(i - 1)->shared_quad_state;
489 EXPECT_EQ(same_shared_quad_state_cmp, same_shared_quad_state_in); 493 EXPECT_EQ(same_shared_quad_state_cmp, same_shared_quad_state_in);
490 } 494 }
491 495
492 DelegatedFrameData frame_in; 496 DelegatedFrameData frame_in;
493 frame_in.render_pass_list.push_back(pass_in.Pass()); 497 frame_in.render_pass_list.push_back(pass_in.Pass());
494 498
495 IPC::ParamTraits<DelegatedFrameData>::Write(&msg, frame_in); 499 IPC::ParamTraits<DelegatedFrameData>::Write(&msg, frame_in);
496 500
497 DelegatedFrameData frame_out; 501 DelegatedFrameData frame_out;
498 PickleIterator iter(msg); 502 PickleIterator iter(msg);
499 EXPECT_TRUE(IPC::ParamTraits<DelegatedFrameData>::Read(&msg, 503 EXPECT_TRUE(IPC::ParamTraits<DelegatedFrameData>::Read(&msg,
500 &iter, &frame_out)); 504 &iter, &frame_out));
501 505
502 // Make sure the out and cmp RenderPasses match. 506 // Make sure the out and cmp RenderPasses match.
503 scoped_ptr<RenderPass> pass_out = frame_out.render_pass_list.take( 507 scoped_ptr<RenderPass> pass_out = frame_out.render_pass_list.take(
504 frame_out.render_pass_list.begin()); 508 frame_out.render_pass_list.begin());
505 Compare(pass_cmp.get(), pass_out.get()); 509 Compare(pass_cmp.get(), pass_out.get());
506 ASSERT_EQ(3u, pass_out->shared_quad_state_list.size()); 510 ASSERT_EQ(3u, pass_out->shared_quad_state_list.size());
507 ASSERT_EQ(10u, pass_out->quad_list.size()); 511 ASSERT_EQ(10u, pass_out->quad_list.size());
508 for (size_t i = 0; i < 3; ++i) { 512 for (size_t i = 0; i < 3; ++i) {
509 Compare(pass_cmp->shared_quad_state_list[i], 513 Compare(pass_cmp->shared_quad_state_list[i],
510 pass_out->shared_quad_state_list[i]); 514 pass_out->shared_quad_state_list[i]);
511 } 515 }
512 for (size_t i = 0; i < pass_out->quad_list.size(); ++i) 516 for (cc::QuadList::Iterator out_iter = pass_out->quad_list.begin(),
513 Compare(pass_cmp->quad_list[i], pass_out->quad_list[i]); 517 cmp_iter = pass_cmp->quad_list.begin();
518 out_iter != pass_out->quad_list.end();
519 ++out_iter, ++cmp_iter)
520 Compare(&*cmp_iter, &*out_iter);
521
514 for (size_t i = 1; i < pass_out->quad_list.size(); ++i) { 522 for (size_t i = 1; i < pass_out->quad_list.size(); ++i) {
515 bool same_shared_quad_state_cmp = 523 bool same_shared_quad_state_cmp =
516 pass_cmp->quad_list[i]->shared_quad_state == 524 pass_cmp->quad_list.ElementAt(i)->shared_quad_state ==
517 pass_cmp->quad_list[i - 1]->shared_quad_state; 525 pass_cmp->quad_list.ElementAt(i - 1)->shared_quad_state;
518 bool same_shared_quad_state_out = 526 bool same_shared_quad_state_out =
519 pass_out->quad_list[i]->shared_quad_state == 527 pass_out->quad_list.ElementAt(i)->shared_quad_state ==
520 pass_out->quad_list[i - 1]->shared_quad_state; 528 pass_out->quad_list.ElementAt(i - 1)->shared_quad_state;
521 EXPECT_EQ(same_shared_quad_state_cmp, same_shared_quad_state_out); 529 EXPECT_EQ(same_shared_quad_state_cmp, same_shared_quad_state_out);
522 } 530 }
523 } 531 }
524 532
525 TEST_F(CCMessagesTest, UnusedSharedQuadStates) { 533 TEST_F(CCMessagesTest, UnusedSharedQuadStates) {
526 scoped_ptr<RenderPass> pass_in = RenderPass::Create(); 534 scoped_ptr<RenderPass> pass_in = RenderPass::Create();
527 pass_in->SetAll(RenderPassId(1, 1), 535 pass_in->SetAll(RenderPassId(1, 1),
528 gfx::Rect(100, 100), 536 gfx::Rect(100, 100),
529 gfx::Rect(), 537 gfx::Rect(),
530 gfx::Transform(), 538 gfx::Transform(),
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
748 SoftwareFrameData frame_out; 756 SoftwareFrameData frame_out;
749 PickleIterator iter(msg); 757 PickleIterator iter(msg);
750 EXPECT_EQ( 758 EXPECT_EQ(
751 expect_read, 759 expect_read,
752 IPC::ParamTraits<SoftwareFrameData>::Read(&msg, &iter, &frame_out)); 760 IPC::ParamTraits<SoftwareFrameData>::Read(&msg, &iter, &frame_out));
753 } 761 }
754 } 762 }
755 763
756 } // namespace 764 } // namespace
757 } // namespace content 765 } // namespace content
OLDNEW
« no previous file with comments | « content/common/cc_messages.cc ('k') | mojo/services/public/cpp/surfaces/lib/surfaces_type_converters.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698