| OLD | NEW |
| 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/single_thread_proxy.h" | 5 #include "cc/trees/single_thread_proxy.h" |
| 6 | 6 |
| 7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
| 8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
| 9 #include "base/profiler/scoped_tracker.h" | 9 #include "base/profiler/scoped_tracker.h" |
| 10 #include "base/trace_event/trace_event.h" | 10 #include "base/trace_event/trace_event.h" |
| (...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 418 scheduler_on_impl_thread_->DidReceiveCompositorFrameAck(); | 418 scheduler_on_impl_thread_->DidReceiveCompositorFrameAck(); |
| 419 layer_tree_host_->DidReceiveCompositorFrameAck(); | 419 layer_tree_host_->DidReceiveCompositorFrameAck(); |
| 420 } | 420 } |
| 421 | 421 |
| 422 void SingleThreadProxy::OnDrawForCompositorFrameSink( | 422 void SingleThreadProxy::OnDrawForCompositorFrameSink( |
| 423 bool resourceless_software_draw) { | 423 bool resourceless_software_draw) { |
| 424 NOTREACHED() << "Implemented by ThreadProxy for synchronous compositor."; | 424 NOTREACHED() << "Implemented by ThreadProxy for synchronous compositor."; |
| 425 } | 425 } |
| 426 | 426 |
| 427 void SingleThreadProxy::NeedsImplSideInvalidation() { | 427 void SingleThreadProxy::NeedsImplSideInvalidation() { |
| 428 // TODO(khushalsagar): Plumb this to the scheduler when | 428 DCHECK(scheduler_on_impl_thread_); |
| 429 // https://codereview.chromium.org/2659123004/ lands. See crbug.com/686267. | 429 scheduler_on_impl_thread_->SetNeedsImplSideInvalidation(); |
| 430 NOTIMPLEMENTED(); | |
| 431 } | 430 } |
| 432 | 431 |
| 433 void SingleThreadProxy::CompositeImmediately(base::TimeTicks frame_begin_time) { | 432 void SingleThreadProxy::CompositeImmediately(base::TimeTicks frame_begin_time) { |
| 434 TRACE_EVENT0("cc,benchmark", "SingleThreadProxy::CompositeImmediately"); | 433 TRACE_EVENT0("cc,benchmark", "SingleThreadProxy::CompositeImmediately"); |
| 435 DCHECK(task_runner_provider_->IsMainThread()); | 434 DCHECK(task_runner_provider_->IsMainThread()); |
| 436 #if DCHECK_IS_ON() | 435 #if DCHECK_IS_ON() |
| 437 DCHECK(!inside_impl_frame_); | 436 DCHECK(!inside_impl_frame_); |
| 438 #endif | 437 #endif |
| 439 base::AutoReset<bool> inside_composite(&inside_synchronous_composite_, true); | 438 base::AutoReset<bool> inside_composite(&inside_synchronous_composite_, true); |
| 440 | 439 |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 597 // fall on the next. Doing it asynchronously instead matches the semantics of | 596 // fall on the next. Doing it asynchronously instead matches the semantics of |
| 598 // ThreadProxy::SetNeedsCommit where SetNeedsCommit will not cause a | 597 // ThreadProxy::SetNeedsCommit where SetNeedsCommit will not cause a |
| 599 // synchronous commit. | 598 // synchronous commit. |
| 600 DCHECK(inside_impl_frame_) | 599 DCHECK(inside_impl_frame_) |
| 601 << "BeginMainFrame should only be sent inside a BeginImplFrame"; | 600 << "BeginMainFrame should only be sent inside a BeginImplFrame"; |
| 602 #endif | 601 #endif |
| 603 | 602 |
| 604 task_runner_provider_->MainThreadTaskRunner()->PostTask( | 603 task_runner_provider_->MainThreadTaskRunner()->PostTask( |
| 605 FROM_HERE, base::Bind(&SingleThreadProxy::BeginMainFrame, | 604 FROM_HERE, base::Bind(&SingleThreadProxy::BeginMainFrame, |
| 606 weak_factory_.GetWeakPtr(), begin_frame_args)); | 605 weak_factory_.GetWeakPtr(), begin_frame_args)); |
| 606 layer_tree_host_impl_->DidSendBeginMainFrame(); |
| 607 } | 607 } |
| 608 | 608 |
| 609 void SingleThreadProxy::SendBeginMainFrameNotExpectedSoon() { | 609 void SingleThreadProxy::SendBeginMainFrameNotExpectedSoon() { |
| 610 layer_tree_host_->BeginMainFrameNotExpectedSoon(); | 610 layer_tree_host_->BeginMainFrameNotExpectedSoon(); |
| 611 } | 611 } |
| 612 | 612 |
| 613 void SingleThreadProxy::BeginMainFrame(const BeginFrameArgs& begin_frame_args) { | 613 void SingleThreadProxy::BeginMainFrame(const BeginFrameArgs& begin_frame_args) { |
| 614 if (scheduler_on_impl_thread_) { | 614 if (scheduler_on_impl_thread_) { |
| 615 scheduler_on_impl_thread_->NotifyBeginMainFrameStarted( | 615 scheduler_on_impl_thread_->NotifyBeginMainFrameStarted( |
| 616 base::TimeTicks::Now()); | 616 base::TimeTicks::Now()); |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 725 TRACE_EVENT0("cc", "SingleThreadProxy::ScheduledActionPrepareTiles"); | 725 TRACE_EVENT0("cc", "SingleThreadProxy::ScheduledActionPrepareTiles"); |
| 726 DebugScopedSetImplThread impl(task_runner_provider_); | 726 DebugScopedSetImplThread impl(task_runner_provider_); |
| 727 layer_tree_host_impl_->PrepareTiles(); | 727 layer_tree_host_impl_->PrepareTiles(); |
| 728 } | 728 } |
| 729 | 729 |
| 730 void SingleThreadProxy::ScheduledActionInvalidateCompositorFrameSink() { | 730 void SingleThreadProxy::ScheduledActionInvalidateCompositorFrameSink() { |
| 731 NOTREACHED(); | 731 NOTREACHED(); |
| 732 } | 732 } |
| 733 | 733 |
| 734 void SingleThreadProxy::ScheduledActionPerformImplSideInvalidation() { | 734 void SingleThreadProxy::ScheduledActionPerformImplSideInvalidation() { |
| 735 NOTIMPLEMENTED(); | 735 DCHECK(scheduler_on_impl_thread_); |
| 736 |
| 737 DebugScopedSetImplThread impl(task_runner_provider_); |
| 738 commit_blocking_task_runner_.reset(new BlockingTaskRunner::CapturePostTasks( |
| 739 task_runner_provider_->blocking_main_thread_task_runner())); |
| 740 layer_tree_host_impl_->InvalidateContentOnImplSide(); |
| 741 |
| 742 // Invalidations go directly to the active tree, so we synchronously call |
| 743 // NotifyReadyToActivate to update the scheduler and LTHI state correctly. |
| 744 // Since in single-threaded mode the scheduler will wait for a ready to draw |
| 745 // signal from LTHI, the draw will remain blocked till the invalidated tiles |
| 746 // are ready. |
| 747 NotifyReadyToActivate(); |
| 736 } | 748 } |
| 737 | 749 |
| 738 void SingleThreadProxy::UpdateBrowserControlsState( | 750 void SingleThreadProxy::UpdateBrowserControlsState( |
| 739 BrowserControlsState constraints, | 751 BrowserControlsState constraints, |
| 740 BrowserControlsState current, | 752 BrowserControlsState current, |
| 741 bool animate) { | 753 bool animate) { |
| 742 NOTREACHED() << "Browser Controls are used only in threaded mode"; | 754 NOTREACHED() << "Browser Controls are used only in threaded mode"; |
| 743 } | 755 } |
| 744 | 756 |
| 745 void SingleThreadProxy::DidFinishImplFrame() { | 757 void SingleThreadProxy::DidFinishImplFrame() { |
| 746 layer_tree_host_impl_->DidFinishImplFrame(); | 758 layer_tree_host_impl_->DidFinishImplFrame(); |
| 747 #if DCHECK_IS_ON() | 759 #if DCHECK_IS_ON() |
| 748 DCHECK(inside_impl_frame_) | 760 DCHECK(inside_impl_frame_) |
| 749 << "DidFinishImplFrame called while not inside an impl frame!"; | 761 << "DidFinishImplFrame called while not inside an impl frame!"; |
| 750 inside_impl_frame_ = false; | 762 inside_impl_frame_ = false; |
| 751 #endif | 763 #endif |
| 752 } | 764 } |
| 753 | 765 |
| 754 } // namespace cc | 766 } // namespace cc |
| OLD | NEW |