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

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: 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
458 void ThreadProxy::OnBeginImplFrame(const BeginFrameArgs& args) {
457 // Sample the frame time now. This time will be used for updating animations 459 // Sample the frame time now. This time will be used for updating animations
458 // when we draw. 460 // when we draw.
459 impl().layer_tree_host_impl->UpdateCurrentFrameTime(); 461 impl().layer_tree_host_impl->UpdateCurrentFrameTime();
460
461 impl().scheduler->BeginImplFrame(args);
462 } 462 }
463 463
464 void ThreadProxy::OnCanDrawStateChanged(bool can_draw) { 464 void ThreadProxy::OnCanDrawStateChanged(bool can_draw) {
465 TRACE_EVENT1( 465 TRACE_EVENT1(
466 "cc", "ThreadProxy::OnCanDrawStateChanged", "can_draw", can_draw); 466 "cc", "ThreadProxy::OnCanDrawStateChanged", "can_draw", can_draw);
467 DCHECK(IsImplThread()); 467 DCHECK(IsImplThread());
468 impl().scheduler->SetCanDraw(can_draw); 468 impl().scheduler->SetCanDraw(can_draw);
469 UpdateBackgroundAnimateTicking(); 469 UpdateBackgroundAnimateTicking();
470 } 470 }
471 471
(...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after
960 BlockingTaskRunner::CapturePostTasks blocked; 960 BlockingTaskRunner::CapturePostTasks blocked;
961 961
962 CompletionEvent completion; 962 CompletionEvent completion;
963 Proxy::ImplThreadTaskRunner()->PostTask( 963 Proxy::ImplThreadTaskRunner()->PostTask(
964 FROM_HERE, 964 FROM_HERE,
965 base::Bind(&ThreadProxy::StartCommitOnImplThread, 965 base::Bind(&ThreadProxy::StartCommitOnImplThread,
966 impl_thread_weak_ptr_, 966 impl_thread_weak_ptr_,
967 &completion, 967 &completion,
968 queue.release(), 968 queue.release(),
969 offscreen_context_provider)); 969 offscreen_context_provider));
970
970 completion.Wait(); 971 completion.Wait();
971 972
972 RenderingStatsInstrumentation* stats_instrumentation = 973 RenderingStatsInstrumentation* stats_instrumentation =
973 layer_tree_host()->rendering_stats_instrumentation(); 974 layer_tree_host()->rendering_stats_instrumentation();
974 BenchmarkInstrumentation::IssueMainThreadRenderingStatsEvent( 975 BenchmarkInstrumentation::IssueMainThreadRenderingStatsEvent(
975 stats_instrumentation->main_thread_rendering_stats()); 976 stats_instrumentation->main_thread_rendering_stats());
976 stats_instrumentation->AccumulateAndClearMainThreadStats(); 977 stats_instrumentation->AccumulateAndClearMainThreadStats();
977 } 978 }
978 979
979 layer_tree_host()->CommitComplete(); 980 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(); 1523 impl().layer_tree_host_impl->resource_provider()->Finish();
1523 completion->Signal(); 1524 completion->Signal();
1524 } 1525 }
1525 1526
1526 void ThreadProxy::LayerTreeHostClosedOnImplThread(CompletionEvent* completion) { 1527 void ThreadProxy::LayerTreeHostClosedOnImplThread(CompletionEvent* completion) {
1527 TRACE_EVENT0("cc", "ThreadProxy::LayerTreeHostClosedOnImplThread"); 1528 TRACE_EVENT0("cc", "ThreadProxy::LayerTreeHostClosedOnImplThread");
1528 DCHECK(IsImplThread()); 1529 DCHECK(IsImplThread());
1529 layer_tree_host()->DeleteContentsTexturesOnImplThread( 1530 layer_tree_host()->DeleteContentsTexturesOnImplThread(
1530 impl().layer_tree_host_impl->resource_provider()); 1531 impl().layer_tree_host_impl->resource_provider());
1531 impl().current_resource_update_controller.reset(); 1532 impl().current_resource_update_controller.reset();
1532 impl().layer_tree_host_impl->SetNeedsBeginImplFrame(false); 1533 impl().layer_tree_host_impl->SetNeedsBeginFrame(false);
1533 impl().scheduler.reset(); 1534 impl().scheduler.reset();
1534 impl().layer_tree_host_impl.reset(); 1535 impl().layer_tree_host_impl.reset();
1535 impl().weak_factory.InvalidateWeakPtrs(); 1536 impl().weak_factory.InvalidateWeakPtrs();
1536 impl().contents_texture_manager = NULL; 1537 impl().contents_texture_manager = NULL;
1537 completion->Signal(); 1538 completion->Signal();
1538 } 1539 }
1539 1540
1540 size_t ThreadProxy::MaxPartialTextureUpdates() const { 1541 size_t ThreadProxy::MaxPartialTextureUpdates() const {
1541 return ResourceUpdateController::MaxPartialTextureUpdates(); 1542 return ResourceUpdateController::MaxPartialTextureUpdates();
1542 } 1543 }
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
1726 1727
1727 impl().timing_history.DidActivatePendingTree(); 1728 impl().timing_history.DidActivatePendingTree();
1728 } 1729 }
1729 1730
1730 void ThreadProxy::DidManageTiles() { 1731 void ThreadProxy::DidManageTiles() {
1731 DCHECK(IsImplThread()); 1732 DCHECK(IsImplThread());
1732 impl().scheduler->DidManageTiles(); 1733 impl().scheduler->DidManageTiles();
1733 } 1734 }
1734 1735
1735 } // namespace cc 1736 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698