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/debug/trace_event.h" | 8 #include "base/debug/trace_event.h" |
9 #include "cc/debug/benchmark_instrumentation.h" | 9 #include "cc/debug/benchmark_instrumentation.h" |
10 #include "cc/output/context_provider.h" | 10 #include "cc/output/context_provider.h" |
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
321 // Impl-side painting only. | 321 // Impl-side painting only. |
322 NOTREACHED(); | 322 NOTREACHED(); |
323 } | 323 } |
324 | 324 |
325 void SingleThreadProxy::SetNeedsCommitOnImplThread() { | 325 void SingleThreadProxy::SetNeedsCommitOnImplThread() { |
326 client_->ScheduleComposite(); | 326 client_->ScheduleComposite(); |
327 } | 327 } |
328 | 328 |
329 void SingleThreadProxy::PostAnimationEventsToMainThreadOnImplThread( | 329 void SingleThreadProxy::PostAnimationEventsToMainThreadOnImplThread( |
330 scoped_ptr<AnimationEventsVector> events, | 330 scoped_ptr<AnimationEventsVector> events, |
331 base::Time wall_clock_time) { | 331 base::TimeTicks clock_time) { |
332 TRACE_EVENT0( | 332 TRACE_EVENT0( |
333 "cc", "SingleThreadProxy::PostAnimationEventsToMainThreadOnImplThread"); | 333 "cc", "SingleThreadProxy::PostAnimationEventsToMainThreadOnImplThread"); |
334 DCHECK(Proxy::IsImplThread()); | 334 DCHECK(Proxy::IsImplThread()); |
335 DebugScopedSetMainThread main(this); | 335 DebugScopedSetMainThread main(this); |
336 layer_tree_host_->SetAnimationEvents(events.Pass(), wall_clock_time); | 336 layer_tree_host_->SetAnimationEvents(events.Pass(), clock_time); |
337 } | 337 } |
338 | 338 |
339 bool SingleThreadProxy::ReduceContentsTextureMemoryOnImplThread( | 339 bool SingleThreadProxy::ReduceContentsTextureMemoryOnImplThread( |
340 size_t limit_bytes, | 340 size_t limit_bytes, |
341 int priority_cutoff) { | 341 int priority_cutoff) { |
342 DCHECK(IsImplThread()); | 342 DCHECK(IsImplThread()); |
343 PrioritizedResourceManager* contents_texture_manager = | 343 PrioritizedResourceManager* contents_texture_manager = |
344 layer_tree_host_->contents_texture_manager(); | 344 layer_tree_host_->contents_texture_manager(); |
345 | 345 |
346 ResourceProvider* resource_provider = | 346 ResourceProvider* resource_provider = |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
525 // We guard PrepareToDraw() with CanDraw() because it always returns a valid | 525 // We guard PrepareToDraw() with CanDraw() because it always returns a valid |
526 // frame, so can only be used when such a frame is possible. Since | 526 // frame, so can only be used when such a frame is possible. Since |
527 // DrawLayers() depends on the result of PrepareToDraw(), it is guarded on | 527 // DrawLayers() depends on the result of PrepareToDraw(), it is guarded on |
528 // CanDraw() as well. | 528 // CanDraw() as well. |
529 if (!ShouldComposite() || (for_readback && !can_do_readback)) { | 529 if (!ShouldComposite() || (for_readback && !can_do_readback)) { |
530 UpdateBackgroundAnimateTicking(); | 530 UpdateBackgroundAnimateTicking(); |
531 return false; | 531 return false; |
532 } | 532 } |
533 | 533 |
534 layer_tree_host_impl_->Animate( | 534 layer_tree_host_impl_->Animate( |
535 layer_tree_host_impl_->CurrentFrameTimeTicks(), | 535 layer_tree_host_impl_->CurrentFrameTimeTicks()); |
536 layer_tree_host_impl_->CurrentFrameTime()); | |
537 UpdateBackgroundAnimateTicking(); | 536 UpdateBackgroundAnimateTicking(); |
538 | 537 |
539 if (!layer_tree_host_impl_->IsContextLost()) { | 538 if (!layer_tree_host_impl_->IsContextLost()) { |
540 layer_tree_host_impl_->PrepareToDraw(frame, device_viewport_damage_rect); | 539 layer_tree_host_impl_->PrepareToDraw(frame, device_viewport_damage_rect); |
541 layer_tree_host_impl_->DrawLayers(frame, frame_begin_time); | 540 layer_tree_host_impl_->DrawLayers(frame, frame_begin_time); |
542 layer_tree_host_impl_->DidDrawAllLayers(*frame); | 541 layer_tree_host_impl_->DidDrawAllLayers(*frame); |
543 } | 542 } |
544 lost_output_surface = layer_tree_host_impl_->IsContextLost(); | 543 lost_output_surface = layer_tree_host_impl_->IsContextLost(); |
545 | 544 |
546 bool start_ready_animations = true; | 545 bool start_ready_animations = true; |
(...skipping 17 matching lines...) Expand all Loading... |
564 void SingleThreadProxy::DidSwapFrame() { | 563 void SingleThreadProxy::DidSwapFrame() { |
565 if (next_frame_is_newly_committed_frame_) { | 564 if (next_frame_is_newly_committed_frame_) { |
566 next_frame_is_newly_committed_frame_ = false; | 565 next_frame_is_newly_committed_frame_ = false; |
567 layer_tree_host_->DidCommitAndDrawFrame(); | 566 layer_tree_host_->DidCommitAndDrawFrame(); |
568 } | 567 } |
569 } | 568 } |
570 | 569 |
571 bool SingleThreadProxy::CommitPendingForTesting() { return false; } | 570 bool SingleThreadProxy::CommitPendingForTesting() { return false; } |
572 | 571 |
573 } // namespace cc | 572 } // namespace cc |
OLD | NEW |