| OLD | NEW |
| 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 "content/common/cc_messages.h" | 5 #include "content/common/cc_messages.h" |
| 6 | 6 |
| 7 #include "base/test/launcher/unit_test_launcher.h" | 7 #include "base/test/launcher/unit_test_launcher.h" |
| 8 #include "base/test/test_suite.h" | 8 #include "base/test/test_suite.h" |
| 9 #include "cc/output/compositor_frame.h" | 9 #include "cc/output/compositor_frame.h" |
| 10 #include "ipc/ipc_message.h" | 10 #include "ipc/ipc_message.h" |
| 11 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
| 12 #include "testing/perf/perf_test.h" | 12 #include "testing/perf/perf_test.h" |
| 13 | 13 |
| 14 using cc::CompositorFrame; | 14 using cc::CompositorFrame; |
| 15 using cc::DelegatedFrameData; | 15 using cc::DelegatedFrameData; |
| 16 using cc::DrawQuad; | 16 using cc::DrawQuad; |
| 17 using cc::PictureDrawQuad; | 17 using cc::PictureDrawQuad; |
| 18 using cc::RenderPass; | 18 using cc::RenderPass; |
| 19 using cc::SharedQuadState; | 19 using cc::SharedQuadState; |
| 20 | 20 |
| 21 namespace content { | 21 namespace content { |
| 22 namespace { | 22 namespace { |
| 23 | 23 |
| 24 static const int kTimeLimitMillis = 2000; | 24 static const int kTimeLimitMillis = 2000; |
| 25 static const int kNumWarmupRuns = 20; | 25 static const int kNumWarmupRuns = 20; |
| 26 static const int kTimeCheckInterval = 10; | 26 static const int kTimeCheckInterval = 10; |
| 27 | 27 |
| 28 class CCMessagesPerfTest : public testing::Test { | 28 class CCMessagesPerfTest : public testing::Test { |
| 29 protected: | 29 protected: |
| 30 static void RunTest(std::string test_name, const CompositorFrame& frame) { | 30 static void RunTest(const std::string& test_name, |
| 31 const CompositorFrame& frame) { |
| 31 for (int i = 0; i < kNumWarmupRuns; ++i) { | 32 for (int i = 0; i < kNumWarmupRuns; ++i) { |
| 32 IPC::Message msg(1, 2, IPC::Message::PRIORITY_NORMAL); | 33 IPC::Message msg(1, 2, IPC::Message::PRIORITY_NORMAL); |
| 33 IPC::ParamTraits<CompositorFrame>::Write(&msg, frame); | 34 IPC::ParamTraits<CompositorFrame>::Write(&msg, frame); |
| 34 } | 35 } |
| 35 | 36 |
| 36 base::TimeTicks start = base::TimeTicks::Now(); | 37 base::TimeTicks start = base::TimeTicks::Now(); |
| 37 base::TimeTicks end = | 38 base::TimeTicks end = |
| 38 start + base::TimeDelta::FromMilliseconds(kTimeLimitMillis); | 39 start + base::TimeDelta::FromMilliseconds(kTimeLimitMillis); |
| 39 base::TimeDelta min_time; | 40 base::TimeDelta min_time; |
| 40 int count = 0; | 41 int count = 0; |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 quad->shared_quad_state = render_pass->shared_quad_state_list.back(); | 144 quad->shared_quad_state = render_pass->shared_quad_state_list.back(); |
| 144 } | 145 } |
| 145 frame->delegated_frame_data->render_pass_list.push_back(render_pass.Pass()); | 146 frame->delegated_frame_data->render_pass_list.push_back(render_pass.Pass()); |
| 146 } | 147 } |
| 147 | 148 |
| 148 RunTest("DelegatedFrame_ManyRenderPasses_10000_100", *frame); | 149 RunTest("DelegatedFrame_ManyRenderPasses_10000_100", *frame); |
| 149 } | 150 } |
| 150 | 151 |
| 151 } // namespace | 152 } // namespace |
| 152 } // namespace content | 153 } // namespace content |
| OLD | NEW |