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

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

Issue 218633010: cc: Handle retroactive BeginFrames in the Scheduler. (Closed) Base URL: http://git.chromium.org/chromium/src.git@compositorVsyncDisable
Patch Set: rebase on pending patches 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 425 matching lines...) Expand 10 before | Expand all | Expand 10 after
436 } 436 }
437 437
438 void ThreadProxy::OnSwapBuffersCompleteOnImplThread() { 438 void ThreadProxy::OnSwapBuffersCompleteOnImplThread() {
439 TRACE_EVENT0("cc", "ThreadProxy::OnSwapBuffersCompleteOnImplThread"); 439 TRACE_EVENT0("cc", "ThreadProxy::OnSwapBuffersCompleteOnImplThread");
440 DCHECK(IsImplThread()); 440 DCHECK(IsImplThread());
441 Proxy::MainThreadTaskRunner()->PostTask( 441 Proxy::MainThreadTaskRunner()->PostTask(
442 FROM_HERE, 442 FROM_HERE,
443 base::Bind(&ThreadProxy::DidCompleteSwapBuffers, main_thread_weak_ptr_)); 443 base::Bind(&ThreadProxy::DidCompleteSwapBuffers, main_thread_weak_ptr_));
444 } 444 }
445 445
446 void ThreadProxy::SetNeedsBeginImplFrame(bool enable) { 446 void ThreadProxy::SetNeedsBeginFrame(bool enable) {
447 TRACE_EVENT1("cc", "ThreadProxy::SetNeedsBeginImplFrame", "enable", enable); 447 TRACE_EVENT1("cc", "ThreadProxy::SetNeedsBeginFrame", "enable", enable);
448 DCHECK(IsImplThread()); 448 DCHECK(IsImplThread());
449 impl().layer_tree_host_impl->SetNeedsBeginImplFrame(enable); 449 impl().layer_tree_host_impl->SetNeedsBeginFrame(enable);
450 UpdateBackgroundAnimateTicking(); 450 UpdateBackgroundAnimateTicking();
451 } 451 }
452 452
453 void ThreadProxy::BeginImplFrame(const BeginFrameArgs& args) { 453 void ThreadProxy::BeginFrame(const BeginFrameArgs& args) {
454 TRACE_EVENT0("cc", "ThreadProxy::BeginImplFrame");
455 DCHECK(IsImplThread()); 454 DCHECK(IsImplThread());
455 impl().scheduler->BeginFrame(args);
456 }
456 457
457 // Sample the frame time now. This time will be used for updating animations 458 void ThreadProxy::WillBeginImplFrame(const BeginFrameArgs& args) {
458 // when we draw. 459 impl().layer_tree_host_impl->WillBeginImplFrame(args);
459 impl().layer_tree_host_impl->UpdateCurrentFrameTime();
460
461 impl().scheduler->BeginImplFrame(args);
462 } 460 }
463 461
464 void ThreadProxy::OnCanDrawStateChanged(bool can_draw) { 462 void ThreadProxy::OnCanDrawStateChanged(bool can_draw) {
465 TRACE_EVENT1( 463 TRACE_EVENT1(
466 "cc", "ThreadProxy::OnCanDrawStateChanged", "can_draw", can_draw); 464 "cc", "ThreadProxy::OnCanDrawStateChanged", "can_draw", can_draw);
467 DCHECK(IsImplThread()); 465 DCHECK(IsImplThread());
468 impl().scheduler->SetCanDraw(can_draw); 466 impl().scheduler->SetCanDraw(can_draw);
469 UpdateBackgroundAnimateTicking(); 467 UpdateBackgroundAnimateTicking();
470 } 468 }
471 469
(...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after
960 BlockingTaskRunner::CapturePostTasks blocked; 958 BlockingTaskRunner::CapturePostTasks blocked;
961 959
962 CompletionEvent completion; 960 CompletionEvent completion;
963 Proxy::ImplThreadTaskRunner()->PostTask( 961 Proxy::ImplThreadTaskRunner()->PostTask(
964 FROM_HERE, 962 FROM_HERE,
965 base::Bind(&ThreadProxy::StartCommitOnImplThread, 963 base::Bind(&ThreadProxy::StartCommitOnImplThread,
966 impl_thread_weak_ptr_, 964 impl_thread_weak_ptr_,
967 &completion, 965 &completion,
968 queue.release(), 966 queue.release(),
969 offscreen_context_provider)); 967 offscreen_context_provider));
968
970 completion.Wait(); 969 completion.Wait();
971 970
972 RenderingStatsInstrumentation* stats_instrumentation = 971 RenderingStatsInstrumentation* stats_instrumentation =
973 layer_tree_host()->rendering_stats_instrumentation(); 972 layer_tree_host()->rendering_stats_instrumentation();
974 BenchmarkInstrumentation::IssueMainThreadRenderingStatsEvent( 973 BenchmarkInstrumentation::IssueMainThreadRenderingStatsEvent(
975 stats_instrumentation->main_thread_rendering_stats()); 974 stats_instrumentation->main_thread_rendering_stats());
976 stats_instrumentation->AccumulateAndClearMainThreadStats(); 975 stats_instrumentation->AccumulateAndClearMainThreadStats();
977 } 976 }
978 977
979 layer_tree_host()->CommitComplete(); 978 layer_tree_host()->CommitComplete();
(...skipping 542 matching lines...) Expand 10 before | Expand all | Expand 10 after
1522 impl().layer_tree_host_impl->resource_provider()->Finish(); 1521 impl().layer_tree_host_impl->resource_provider()->Finish();
1523 completion->Signal(); 1522 completion->Signal();
1524 } 1523 }
1525 1524
1526 void ThreadProxy::LayerTreeHostClosedOnImplThread(CompletionEvent* completion) { 1525 void ThreadProxy::LayerTreeHostClosedOnImplThread(CompletionEvent* completion) {
1527 TRACE_EVENT0("cc", "ThreadProxy::LayerTreeHostClosedOnImplThread"); 1526 TRACE_EVENT0("cc", "ThreadProxy::LayerTreeHostClosedOnImplThread");
1528 DCHECK(IsImplThread()); 1527 DCHECK(IsImplThread());
1529 layer_tree_host()->DeleteContentsTexturesOnImplThread( 1528 layer_tree_host()->DeleteContentsTexturesOnImplThread(
1530 impl().layer_tree_host_impl->resource_provider()); 1529 impl().layer_tree_host_impl->resource_provider());
1531 impl().current_resource_update_controller.reset(); 1530 impl().current_resource_update_controller.reset();
1532 impl().layer_tree_host_impl->SetNeedsBeginImplFrame(false); 1531 impl().layer_tree_host_impl->SetNeedsBeginFrame(false);
1533 impl().scheduler.reset(); 1532 impl().scheduler.reset();
1534 impl().layer_tree_host_impl.reset(); 1533 impl().layer_tree_host_impl.reset();
1535 impl().weak_factory.InvalidateWeakPtrs(); 1534 impl().weak_factory.InvalidateWeakPtrs();
1536 impl().contents_texture_manager = NULL; 1535 impl().contents_texture_manager = NULL;
1537 completion->Signal(); 1536 completion->Signal();
1538 } 1537 }
1539 1538
1540 size_t ThreadProxy::MaxPartialTextureUpdates() const { 1539 size_t ThreadProxy::MaxPartialTextureUpdates() const {
1541 return ResourceUpdateController::MaxPartialTextureUpdates(); 1540 return ResourceUpdateController::MaxPartialTextureUpdates();
1542 } 1541 }
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
1727 1726
1728 impl().timing_history.DidActivatePendingTree(); 1727 impl().timing_history.DidActivatePendingTree();
1729 } 1728 }
1730 1729
1731 void ThreadProxy::DidManageTiles() { 1730 void ThreadProxy::DidManageTiles() {
1732 DCHECK(IsImplThread()); 1731 DCHECK(IsImplThread());
1733 impl().scheduler->DidManageTiles(); 1732 impl().scheduler->DidManageTiles();
1734 } 1733 }
1735 1734
1736 } // namespace cc 1735 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698