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 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
352 | 352 |
353 bool SingleThreadProxy::IsInsideDraw() { return inside_draw_; } | 353 bool SingleThreadProxy::IsInsideDraw() { return inside_draw_; } |
354 | 354 |
355 void SingleThreadProxy::DidLoseOutputSurfaceOnImplThread() { | 355 void SingleThreadProxy::DidLoseOutputSurfaceOnImplThread() { |
356 // Cause a commit so we can notice the lost context. | 356 // Cause a commit so we can notice the lost context. |
357 SetNeedsCommitOnImplThread(); | 357 SetNeedsCommitOnImplThread(); |
358 } | 358 } |
359 | 359 |
360 // Called by the legacy scheduling path (e.g. where render_widget does the | 360 // Called by the legacy scheduling path (e.g. where render_widget does the |
361 // scheduling) | 361 // scheduling) |
362 void SingleThreadProxy::CompositeImmediately(base::TimeTicks frame_begin_time) { | 362 void SingleThreadProxy::CompositeImmediately(gfx::FrameTime frame_begin_time) { |
363 gfx::Rect device_viewport_damage_rect; | 363 gfx::Rect device_viewport_damage_rect; |
364 | 364 |
365 LayerTreeHostImpl::FrameData frame; | 365 LayerTreeHostImpl::FrameData frame; |
366 if (CommitAndComposite(frame_begin_time, | 366 if (CommitAndComposite(frame_begin_time, |
367 device_viewport_damage_rect, | 367 device_viewport_damage_rect, |
368 false, // for_readback | 368 false, // for_readback |
369 &frame)) { | 369 &frame)) { |
370 { | 370 { |
371 DebugScopedSetMainThreadBlocked main_thread_blocked(this); | 371 DebugScopedSetMainThreadBlocked main_thread_blocked(this); |
372 DebugScopedSetImplThread impl(this); | 372 DebugScopedSetImplThread impl(this); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
404 { | 404 { |
405 DebugScopedSetImplThread impl(this); | 405 DebugScopedSetImplThread impl(this); |
406 if (layer_tree_host_impl_->renderer()) { | 406 if (layer_tree_host_impl_->renderer()) { |
407 DCHECK(!layer_tree_host_->output_surface_lost()); | 407 DCHECK(!layer_tree_host_->output_surface_lost()); |
408 layer_tree_host_impl_->renderer()->DoNoOp(); | 408 layer_tree_host_impl_->renderer()->DoNoOp(); |
409 } | 409 } |
410 } | 410 } |
411 } | 411 } |
412 | 412 |
413 bool SingleThreadProxy::CommitAndComposite( | 413 bool SingleThreadProxy::CommitAndComposite( |
414 base::TimeTicks frame_begin_time, | 414 gfx::FrameTime frame_begin_time, |
415 gfx::Rect device_viewport_damage_rect, | 415 gfx::Rect device_viewport_damage_rect, |
416 bool for_readback, | 416 bool for_readback, |
417 LayerTreeHostImpl::FrameData* frame) { | 417 LayerTreeHostImpl::FrameData* frame) { |
418 DCHECK(Proxy::IsMainThread()); | 418 DCHECK(Proxy::IsMainThread()); |
419 | 419 |
420 if (!layer_tree_host_->InitializeOutputSurfaceIfNeeded()) | 420 if (!layer_tree_host_->InitializeOutputSurfaceIfNeeded()) |
421 return false; | 421 return false; |
422 | 422 |
423 layer_tree_host_->AnimateLayers(frame_begin_time); | 423 layer_tree_host_->AnimateLayers(frame_begin_time); |
424 | 424 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
467 } | 467 } |
468 | 468 |
469 void SingleThreadProxy::UpdateBackgroundAnimateTicking() { | 469 void SingleThreadProxy::UpdateBackgroundAnimateTicking() { |
470 DCHECK(Proxy::IsImplThread()); | 470 DCHECK(Proxy::IsImplThread()); |
471 layer_tree_host_impl_->UpdateBackgroundAnimateTicking( | 471 layer_tree_host_impl_->UpdateBackgroundAnimateTicking( |
472 !ShouldComposite() && layer_tree_host_impl_->active_tree()->root_layer()); | 472 !ShouldComposite() && layer_tree_host_impl_->active_tree()->root_layer()); |
473 } | 473 } |
474 | 474 |
475 bool SingleThreadProxy::DoComposite( | 475 bool SingleThreadProxy::DoComposite( |
476 scoped_refptr<cc::ContextProvider> offscreen_context_provider, | 476 scoped_refptr<cc::ContextProvider> offscreen_context_provider, |
477 base::TimeTicks frame_begin_time, | 477 gfx::FrameTime frame_begin_time, |
478 gfx::Rect device_viewport_damage_rect, | 478 gfx::Rect device_viewport_damage_rect, |
479 bool for_readback, | 479 bool for_readback, |
480 LayerTreeHostImpl::FrameData* frame) { | 480 LayerTreeHostImpl::FrameData* frame) { |
481 DCHECK(!layer_tree_host_->output_surface_lost()); | 481 DCHECK(!layer_tree_host_->output_surface_lost()); |
482 | 482 |
483 bool lost_output_surface = false; | 483 bool lost_output_surface = false; |
484 { | 484 { |
485 DebugScopedSetImplThread impl(this); | 485 DebugScopedSetImplThread impl(this); |
486 base::AutoReset<bool> mark_inside(&inside_draw_, true); | 486 base::AutoReset<bool> mark_inside(&inside_draw_, true); |
487 | 487 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
530 void SingleThreadProxy::DidSwapFrame() { | 530 void SingleThreadProxy::DidSwapFrame() { |
531 if (next_frame_is_newly_committed_frame_) { | 531 if (next_frame_is_newly_committed_frame_) { |
532 next_frame_is_newly_committed_frame_ = false; | 532 next_frame_is_newly_committed_frame_ = false; |
533 layer_tree_host_->DidCommitAndDrawFrame(); | 533 layer_tree_host_->DidCommitAndDrawFrame(); |
534 } | 534 } |
535 } | 535 } |
536 | 536 |
537 bool SingleThreadProxy::CommitPendingForTesting() { return false; } | 537 bool SingleThreadProxy::CommitPendingForTesting() { return false; } |
538 | 538 |
539 } // namespace cc | 539 } // namespace cc |
OLD | NEW |