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

Side by Side Diff: cc/scheduler/scheduler_state_machine_unittest.cc

Issue 522903002: cc: Be less aggressive about scheduling for scroll handlers (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Renamed scheduler part. Created 6 years, 3 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/scheduler/scheduler_state_machine.cc ('k') | cc/scheduler/scheduler_unittest.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 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 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 "cc/scheduler/scheduler_state_machine.h" 5 #include "cc/scheduler/scheduler_state_machine.h"
6 6
7 #include "base/debug/trace_event.h" 7 #include "base/debug/trace_event.h"
8 #include "cc/scheduler/scheduler.h" 8 #include "cc/scheduler/scheduler.h"
9 #include "cc/test/begin_frame_args_test.h" 9 #include "cc/test/begin_frame_args_test.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 1729 matching lines...) Expand 10 before | Expand all | Expand 10 after
1740 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE); 1740 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE);
1741 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); 1741 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
1742 1742
1743 EXPECT_TRUE(state.ShouldTriggerBeginImplFrameDeadlineEarly()); 1743 EXPECT_TRUE(state.ShouldTriggerBeginImplFrameDeadlineEarly());
1744 state.OnBeginImplFrameDeadline(); 1744 state.OnBeginImplFrameDeadline();
1745 EXPECT_ACTION_UPDATE_STATE( 1745 EXPECT_ACTION_UPDATE_STATE(
1746 SchedulerStateMachine::ACTION_DRAW_AND_SWAP_IF_POSSIBLE); 1746 SchedulerStateMachine::ACTION_DRAW_AND_SWAP_IF_POSSIBLE);
1747 state.DidSwapBuffers(); 1747 state.DidSwapBuffers();
1748 } 1748 }
1749 1749
1750 TEST(SchedulerStateMachineTest, TestSmoothnessTakesPriority) { 1750 TEST(SchedulerStateMachineTest, TestImplLatencyTakesPriority) {
1751 SchedulerSettings settings; 1751 SchedulerSettings settings;
1752 settings.impl_side_painting = true; 1752 settings.impl_side_painting = true;
1753 StateMachine state(settings); 1753 StateMachine state(settings);
1754 state.SetCanStart(); 1754 state.SetCanStart();
1755 state.UpdateState(state.NextAction()); 1755 state.UpdateState(state.NextAction());
1756 state.CreateAndInitializeOutputSurfaceWithActivatedCommit(); 1756 state.CreateAndInitializeOutputSurfaceWithActivatedCommit();
1757 state.SetVisible(true); 1757 state.SetVisible(true);
1758 state.SetCanDraw(true); 1758 state.SetCanDraw(true);
1759 1759
1760 // This test ensures that impl-draws are prioritized over main thread updates 1760 // This test ensures that impl-draws are prioritized over main thread updates
1761 // in prefer smoothness mode. 1761 // in prefer impl latency mode.
1762 state.SetNeedsRedraw(true); 1762 state.SetNeedsRedraw(true);
1763 state.SetNeedsCommit(); 1763 state.SetNeedsCommit();
1764 state.OnBeginImplFrame(CreateBeginFrameArgsForTesting()); 1764 state.OnBeginImplFrame(CreateBeginFrameArgsForTesting());
1765 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE); 1765 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE);
1766 EXPECT_ACTION_UPDATE_STATE( 1766 EXPECT_ACTION_UPDATE_STATE(
1767 SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME); 1767 SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME);
1768 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); 1768 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
1769 1769
1770 // Verify the deadline is not triggered early until we enter 1770 // Verify the deadline is not triggered early until we enter
1771 // prefer smoothness mode. 1771 // prefer impl latency mode.
1772 EXPECT_FALSE(state.ShouldTriggerBeginImplFrameDeadlineEarly()); 1772 EXPECT_FALSE(state.ShouldTriggerBeginImplFrameDeadlineEarly());
1773 state.SetSmoothnessTakesPriority(true); 1773 state.SetImplLatencyTakesPriority(true);
1774 EXPECT_TRUE(state.ShouldTriggerBeginImplFrameDeadlineEarly()); 1774 EXPECT_TRUE(state.ShouldTriggerBeginImplFrameDeadlineEarly());
1775 1775
1776 // Trigger the deadline. 1776 // Trigger the deadline.
1777 state.OnBeginImplFrameDeadline(); 1777 state.OnBeginImplFrameDeadline();
1778 EXPECT_ACTION_UPDATE_STATE( 1778 EXPECT_ACTION_UPDATE_STATE(
1779 SchedulerStateMachine::ACTION_DRAW_AND_SWAP_IF_POSSIBLE); 1779 SchedulerStateMachine::ACTION_DRAW_AND_SWAP_IF_POSSIBLE);
1780 state.DidSwapBuffers(); 1780 state.DidSwapBuffers();
1781 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); 1781 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
1782 state.DidSwapBuffersComplete(); 1782 state.DidSwapBuffersComplete();
1783 1783
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
1902 state.SetNeedsAnimate(); 1902 state.SetNeedsAnimate();
1903 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); 1903 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
1904 1904
1905 state.OnBeginImplFrameDeadline(); 1905 state.OnBeginImplFrameDeadline();
1906 EXPECT_ACTION_UPDATE_STATE( 1906 EXPECT_ACTION_UPDATE_STATE(
1907 SchedulerStateMachine::ACTION_DRAW_AND_SWAP_IF_POSSIBLE); 1907 SchedulerStateMachine::ACTION_DRAW_AND_SWAP_IF_POSSIBLE);
1908 } 1908 }
1909 1909
1910 } // namespace 1910 } // namespace
1911 } // namespace cc 1911 } // namespace cc
OLDNEW
« no previous file with comments | « cc/scheduler/scheduler_state_machine.cc ('k') | cc/scheduler/scheduler_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698