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

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

Issue 870183004: Revert of cc: Control defer_commits logic by Scheduler (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 5 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « cc/trees/layer_tree_host_unittest.cc ('k') | cc/trees/single_thread_proxy.h » ('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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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 "cc/trees/layer_tree_host.h" 5 #include "cc/trees/layer_tree_host.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "cc/layers/content_layer.h" 8 #include "cc/layers/content_layer.h"
9 #include "cc/layers/delegated_frame_provider.h" 9 #include "cc/layers/delegated_frame_provider.h"
10 #include "cc/layers/delegated_frame_resource_collection.h" 10 #include "cc/layers/delegated_frame_resource_collection.h"
(...skipping 1758 matching lines...) Expand 10 before | Expand all | Expand 10 after
1769 deferred_ = false; 1769 deferred_ = false;
1770 PostSetNeedsCommitToMainThread(); 1770 PostSetNeedsCommitToMainThread();
1771 } 1771 }
1772 1772
1773 void ScheduledActionWillSendBeginMainFrame() override { 1773 void ScheduledActionWillSendBeginMainFrame() override {
1774 if (deferred_) 1774 if (deferred_)
1775 return; 1775 return;
1776 deferred_ = true; 1776 deferred_ = true;
1777 1777
1778 // Defer commits before the BeginFrame arrives, causing it to be delayed. 1778 // Defer commits before the BeginFrame arrives, causing it to be delayed.
1779 PostSetDeferCommitsToMainThread(true); 1779 MainThreadTaskRunner()->PostTask(
1780 FROM_HERE,
1781 base::Bind(&LayerTreeHostContextTestLoseAfterSendingBeginMainFrame::
1782 DeferCommitsOnMainThread,
1783 base::Unretained(this),
1784 true));
1780 // Meanwhile, lose the context while we are in defer commits. 1785 // Meanwhile, lose the context while we are in defer commits.
1781 ImplThreadTaskRunner()->PostTask( 1786 ImplThreadTaskRunner()->PostTask(
1782 FROM_HERE, 1787 FROM_HERE,
1783 base::Bind(&LayerTreeHostContextTestLoseAfterSendingBeginMainFrame:: 1788 base::Bind(&LayerTreeHostContextTestLoseAfterSendingBeginMainFrame::
1784 LoseContextOnImplThread, 1789 LoseContextOnImplThread,
1785 base::Unretained(this))); 1790 base::Unretained(this)));
1786 } 1791 }
1787 1792
1788 void LoseContextOnImplThread() { 1793 void LoseContextOnImplThread() {
1789 LoseContext(); 1794 LoseContext();
1790 1795
1791 // After losing the context, stop deferring commits. 1796 // After losing the context, stop deferring commits.
1792 PostSetDeferCommitsToMainThread(false); 1797 MainThreadTaskRunner()->PostTask(
1798 FROM_HERE,
1799 base::Bind(&LayerTreeHostContextTestLoseAfterSendingBeginMainFrame::
1800 DeferCommitsOnMainThread,
1801 base::Unretained(this),
1802 false));
1803 }
1804
1805 void DeferCommitsOnMainThread(bool defer_commits) {
1806 layer_tree_host()->SetDeferCommits(defer_commits);
1793 } 1807 }
1794 1808
1795 void WillBeginMainFrame() override { 1809 void WillBeginMainFrame() override {
1796 // Don't begin a frame with a lost surface. 1810 // Don't begin a frame with a lost surface.
1797 EXPECT_FALSE(layer_tree_host()->output_surface_lost()); 1811 EXPECT_FALSE(layer_tree_host()->output_surface_lost());
1798 } 1812 }
1799 1813
1800 void DidCommitAndDrawFrame() override { EndTest(); } 1814 void DidCommitAndDrawFrame() override { EndTest(); }
1801 1815
1802 void AfterTest() override {} 1816 void AfterTest() override {}
1803 1817
1804 bool deferred_; 1818 bool deferred_;
1805 }; 1819 };
1806 1820
1807 SINGLE_AND_MULTI_THREAD_TEST_F( 1821 SINGLE_AND_MULTI_THREAD_TEST_F(
1808 LayerTreeHostContextTestLoseAfterSendingBeginMainFrame); 1822 LayerTreeHostContextTestLoseAfterSendingBeginMainFrame);
1809 1823
1810 } // namespace 1824 } // namespace
1811 } // namespace cc 1825 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_unittest.cc ('k') | cc/trees/single_thread_proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698