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

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

Issue 199523002: cc: Throttle swaps in Scheduler instead of OutputSurface (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: dana's comments Created 6 years, 8 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 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/trees/thread_proxy.h" 5 #include "cc/trees/thread_proxy.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 9
10 #include "base/auto_reset.h" 10 #include "base/auto_reset.h"
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after
426 TRACE_EVENT0("cc", "ThreadProxy::CheckOutputSurfaceStatusOnImplThread"); 426 TRACE_EVENT0("cc", "ThreadProxy::CheckOutputSurfaceStatusOnImplThread");
427 DCHECK(IsImplThread()); 427 DCHECK(IsImplThread());
428 if (!impl().layer_tree_host_impl->IsContextLost()) 428 if (!impl().layer_tree_host_impl->IsContextLost())
429 return; 429 return;
430 if (ContextProvider* offscreen_contexts = 430 if (ContextProvider* offscreen_contexts =
431 impl().layer_tree_host_impl->offscreen_context_provider()) 431 impl().layer_tree_host_impl->offscreen_context_provider())
432 offscreen_contexts->VerifyContexts(); 432 offscreen_contexts->VerifyContexts();
433 impl().scheduler->DidLoseOutputSurface(); 433 impl().scheduler->DidLoseOutputSurface();
434 } 434 }
435 435
436 void ThreadProxy::OnSwapBuffersCompleteOnImplThread() { 436 void ThreadProxy::SetMaxSwapsPendingOnImplThread(int max) {
437 TRACE_EVENT0("cc", "ThreadProxy::OnSwapBuffersCompleteOnImplThread"); 437 impl().scheduler->SetMaxSwapsPending(max);
438 }
439
440 void ThreadProxy::DidSwapBuffersOnImplThread() {
441 impl().scheduler->DidSwapBuffers();
442 }
443
444 void ThreadProxy::DidSwapBuffersCompleteOnImplThread() {
445 TRACE_EVENT0("cc", "ThreadProxy::DidSwapBuffersCompleteOnImplThread");
438 DCHECK(IsImplThread()); 446 DCHECK(IsImplThread());
447 impl().scheduler->DidSwapBuffersComplete();
439 Proxy::MainThreadTaskRunner()->PostTask( 448 Proxy::MainThreadTaskRunner()->PostTask(
440 FROM_HERE, 449 FROM_HERE,
441 base::Bind(&ThreadProxy::DidCompleteSwapBuffers, main_thread_weak_ptr_)); 450 base::Bind(&ThreadProxy::DidCompleteSwapBuffers, main_thread_weak_ptr_));
442 } 451 }
443 452
444 void ThreadProxy::SetNeedsBeginFrame(bool enable) { 453 void ThreadProxy::SetNeedsBeginFrame(bool enable) {
445 TRACE_EVENT1("cc", "ThreadProxy::SetNeedsBeginFrame", "enable", enable); 454 TRACE_EVENT1("cc", "ThreadProxy::SetNeedsBeginFrame", "enable", enable);
446 impl().layer_tree_host_impl->SetNeedsBeginFrame(enable); 455 impl().layer_tree_host_impl->SetNeedsBeginFrame(enable);
447 UpdateBackgroundAnimateTicking(); 456 UpdateBackgroundAnimateTicking();
448 } 457 }
(...skipping 784 matching lines...) Expand 10 before | Expand all | Expand 10 after
1233 result.did_readback = true; 1242 result.did_readback = true;
1234 } else { 1243 } else {
1235 result.draw_result = DrawSwapReadbackResult::DRAW_ABORTED_CONTEXT_LOST; 1244 result.draw_result = DrawSwapReadbackResult::DRAW_ABORTED_CONTEXT_LOST;
1236 } 1245 }
1237 } 1246 }
1238 impl().readback_request->success = result.did_readback; 1247 impl().readback_request->success = result.did_readback;
1239 impl().readback_request->completion.Signal(); 1248 impl().readback_request->completion.Signal();
1240 impl().readback_request = NULL; 1249 impl().readback_request = NULL;
1241 } else if (draw_frame) { 1250 } else if (draw_frame) {
1242 DCHECK(swap_requested); 1251 DCHECK(swap_requested);
1243 result.did_swap = impl().layer_tree_host_impl->SwapBuffers(frame); 1252 result.did_request_swap = impl().layer_tree_host_impl->SwapBuffers(frame);
1244 1253
1245 // We don't know if we have incomplete tiles if we didn't actually swap. 1254 // We don't know if we have incomplete tiles if we didn't actually swap.
1246 if (result.did_swap) { 1255 if (result.did_request_swap) {
1247 DCHECK(!frame.has_no_damage); 1256 DCHECK(!frame.has_no_damage);
1248 SetSwapUsedIncompleteTileOnImplThread(frame.contains_incomplete_tile); 1257 SetSwapUsedIncompleteTileOnImplThread(frame.contains_incomplete_tile);
1249 } 1258 }
1250 } 1259 }
1251 1260
1252 // Tell the main thread that the the newly-commited frame was drawn. 1261 // Tell the main thread that the the newly-commited frame was drawn.
1253 if (impl().next_frame_is_newly_committed_frame) { 1262 if (impl().next_frame_is_newly_committed_frame) {
1254 impl().next_frame_is_newly_committed_frame = false; 1263 impl().next_frame_is_newly_committed_frame = false;
1255 Proxy::MainThreadTaskRunner()->PostTask( 1264 Proxy::MainThreadTaskRunner()->PostTask(
1256 FROM_HERE, 1265 FROM_HERE,
(...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after
1690 1699
1691 impl().timing_history.DidActivatePendingTree(); 1700 impl().timing_history.DidActivatePendingTree();
1692 } 1701 }
1693 1702
1694 void ThreadProxy::DidManageTiles() { 1703 void ThreadProxy::DidManageTiles() {
1695 DCHECK(IsImplThread()); 1704 DCHECK(IsImplThread());
1696 impl().scheduler->DidManageTiles(); 1705 impl().scheduler->DidManageTiles();
1697 } 1706 }
1698 1707
1699 } // namespace cc 1708 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698