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 void SingleThreadProxy::SetBeginFrameSource(BeginFrameSource* source) { | 418 void SingleThreadProxy::SetBeginFrameSource(BeginFrameSource* source) { |
419 if (scheduler_on_impl_thread_) | 419 if (scheduler_on_impl_thread_) |
420 scheduler_on_impl_thread_->SetBeginFrameSource(source); | 420 scheduler_on_impl_thread_->SetBeginFrameSource(source); |
421 } | 421 } |
422 | 422 |
423 void SingleThreadProxy::DidReceiveCompositorFrameAckOnImplThread() { | 423 void SingleThreadProxy::DidReceiveCompositorFrameAckOnImplThread() { |
424 TRACE_EVENT0("cc,benchmark", | 424 TRACE_EVENT0("cc,benchmark", |
425 "SingleThreadProxy::DidReceiveCompositorFrameAckOnImplThread"); | 425 "SingleThreadProxy::DidReceiveCompositorFrameAckOnImplThread"); |
426 if (scheduler_on_impl_thread_) | 426 if (scheduler_on_impl_thread_) |
427 scheduler_on_impl_thread_->DidReceiveCompositorFrameAck(); | 427 scheduler_on_impl_thread_->DidReceiveCompositorFrameAck(); |
428 layer_tree_host_->DidReceiveCompositorFrameAck(); | 428 // We do a PostTask here because freeing resources in some cases (such as in |
| 429 // TextureLayer) is PostTasked and we want to make sure ack is received after |
| 430 // resources are returned. |
| 431 task_runner_provider_->MainThreadTaskRunner()->PostTask( |
| 432 FROM_HERE, base::Bind(&SingleThreadProxy::DidReceiveCompositorFrameAck, |
| 433 weak_factory_.GetWeakPtr())); |
429 } | 434 } |
430 | 435 |
431 void SingleThreadProxy::OnDrawForCompositorFrameSink( | 436 void SingleThreadProxy::OnDrawForCompositorFrameSink( |
432 bool resourceless_software_draw) { | 437 bool resourceless_software_draw) { |
433 NOTREACHED() << "Implemented by ThreadProxy for synchronous compositor."; | 438 NOTREACHED() << "Implemented by ThreadProxy for synchronous compositor."; |
434 } | 439 } |
435 | 440 |
436 void SingleThreadProxy::NeedsImplSideInvalidation() { | 441 void SingleThreadProxy::NeedsImplSideInvalidation() { |
437 DCHECK(scheduler_on_impl_thread_); | 442 DCHECK(scheduler_on_impl_thread_); |
438 scheduler_on_impl_thread_->SetNeedsImplSideInvalidation(); | 443 scheduler_on_impl_thread_->SetNeedsImplSideInvalidation(); |
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
787 | 792 |
788 void SingleThreadProxy::DidFinishImplFrame() { | 793 void SingleThreadProxy::DidFinishImplFrame() { |
789 layer_tree_host_impl_->DidFinishImplFrame(); | 794 layer_tree_host_impl_->DidFinishImplFrame(); |
790 #if DCHECK_IS_ON() | 795 #if DCHECK_IS_ON() |
791 DCHECK(inside_impl_frame_) | 796 DCHECK(inside_impl_frame_) |
792 << "DidFinishImplFrame called while not inside an impl frame!"; | 797 << "DidFinishImplFrame called while not inside an impl frame!"; |
793 inside_impl_frame_ = false; | 798 inside_impl_frame_ = false; |
794 #endif | 799 #endif |
795 } | 800 } |
796 | 801 |
| 802 void SingleThreadProxy::DidReceiveCompositorFrameAck() { |
| 803 layer_tree_host_->DidReceiveCompositorFrameAck(); |
| 804 } |
| 805 |
797 } // namespace cc | 806 } // namespace cc |
OLD | NEW |